Skip to content

Commit

Permalink
Merge pull request #23 from CS3219-AY2324S1/feat/user-ui
Browse files Browse the repository at this point in the history
feat: implement users crud
  • Loading branch information
raynerljm authored Oct 14, 2023
2 parents 5bd1633 + 63ae027 commit 26061c5
Show file tree
Hide file tree
Showing 99 changed files with 5,429 additions and 6,326 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Users Service Pulumi Preview
name: User Service Pulumi Preview
on:
pull_request:
branches: ["staging", "master"]
paths: ["backend/users-service/**"]
env:
WORKING_DIRECTORY_INFRA: ./backend/users-service/infra
STACK_NAME: ${{ github.ref == 'refs/heads/master' && 'cs3219/users-service-infra/prod' || 'cs3219/users-service-infra/staging'}}
WORKING_DIRECTORY_INFRA: ./backend/user-service/infra
STACK_NAME: ${{ github.ref == 'refs/heads/master' && 'cs3219/user-service-infra/prod' || 'cs3219/user-service-infra/staging'}}
jobs:
preview:
name: Preview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Users Service Pulumi Update
name: User Service Pulumi Update
on:
push:
branches: ["staging", "master"]
paths: ["backend/users-service/**"]
env:
WORKING_DIRECTORY_INFRA: ./backend/users-service/infra
STACK_NAME: ${{ github.ref == 'refs/heads/master' && 'cs3219/users-service-infra/prod' || 'cs3219/users-service-infra/staging'}}
WORKING_DIRECTORY_INFRA: ./backend/user-service/infra
STACK_NAME: ${{ github.ref == 'refs/heads/master' && 'cs3219/user-service-infra/prod' || 'cs3219/user-service-infra/staging'}}
jobs:
update:
name: Update
Expand Down
4 changes: 2 additions & 2 deletions backend/api-gateway/app/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=http://localhost:8000/github/callback

# These are the service names defined in docker-compose.yml (for inter-container communication)
USERS_SERVICE_URL=http://users-service
QUESTIONS_SERVICE_URL=http://questions-service
USERS_SERVICE_URL=http://user-service
QUESTIONS_SERVICE_URL=http://question-service-server
MATCHING_SERVICE_URL=http://matching-service
COLLABORATION_SERVICE_URL=http://collaboration-service

Expand Down
32 changes: 24 additions & 8 deletions backend/api-gateway/app/libs/utils.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import { z } from "zod";
import { HTTP_STATUS } from "../types";
import jwt from "jsonwebtoken";
import { GithubEmailResponse } from "../types/github";

/**
* API Utils
*/
export const successApiResponse = (data: any) => ({
status: HTTP_STATUS.SUCCESS,
data,
});
export const successApiResponse = (data: any) => {
const res = {
status: HTTP_STATUS.SUCCESS,
data,
};
console.log(res);
return res;
};

export const failApiResponse = (data: any) => ({
status: HTTP_STATUS.FAIL,
data,
});
export const failApiResponse = (data: any) => {
const res = {
status: HTTP_STATUS.FAIL,
data,
};
console.log(res);
return res;
};

/**
* JWT Utils
Expand Down Expand Up @@ -41,3 +50,10 @@ export const unwrapJwt = (
});
});
};

/**
* GitHub Auth Utils
*/
export const getPrimaryEmail = (githubEmailResponse: GithubEmailResponse) => {
return githubEmailResponse.find((email) => email.primary)?.email;
};
Loading

0 comments on commit 26061c5

Please sign in to comment.