From c0c50c2404336fb767b0480439d53a8820aea6b2 Mon Sep 17 00:00:00 2001 From: Vijak Khajornritdacha Date: Tue, 19 Sep 2023 23:31:10 +0700 Subject: [PATCH] Feat/backoffice (#636) * feat(codegen): add getPendingReviews query * feat(admin-web): setup apollo and add getPendingReviews api * feat: add override query in frontend * refactor: migrate apollo provider to AppProvider * Configure pre-release mode * change sync workflow * Version Packages (#512) Co-authored-by: github-actions[bot] * install changeset in workflow * fix sync beta workflow * add commit identity * Enter pre-release mode * fix transform packages * feat: add override query in frontend * fix: edit import path * feat: add HtmlSanitizer and Navbar * feat: add approvedReviews and GenEd Page * ci: update pnpm-lock * move transpile packages out of experimental * refactor: migrate appProvider to context folder * refactor: create pendingReviews page and remove api page * ci(gitignore): remove .env from gitignore * refactor: create genEd module * refactor: migrate pendingReviews to its own module * refactor: migrate approvedReviews to its own module * refactor: remove unused codes Including 1. Logging 2. proxy in httpClient 3. Admin access token leaked in apollo * fix(homePage): move router.push inside useEffect * refactor(pendingReviews): remove unused codes * refactor(apollo): remove course search cache from apollo client * ci(env): remove unused variables * feat: add MUI and create pendingReviews design * feat(pendingReviews): add skeleton * install mui * feat: add themeProvider * feat: add Poppin and Prompts fonts * feat: recreate Navbar with MUI's appbar * feat: add styling to Navbar(Appbar) * docs: add required environment variables to readme * feat: Demo genEd table * setup review with graphql * feat(admin-api): add override * feat(admin-api): add get-all-reviews query * refactor(admin-api): remove unused codes and comments * add graphql asset * add enum graphql * remove unused file * remove unused env from template and config * fix lockfile broken * add dashboard url to env * fix env and config * match dependencies version to api's * feat(sidebar): add sidebar * feat(sidebar): decorate sidebar * feat: add fonts * feat: add theme palette * feat: add highlight link when selected * fix(index): remove import .css * feat: pendingReview header * feat: upper Review page * feat: table header and card layout wip * feat(pendingReviews): add html sanitize to content * fix: padding * feat: WIP pendingReview * setup auth to request id_token * feat: add Thai font * feat: add mui icon * feat: polish pendingReview page * add config variable * feat: add login page and generate token page * add template env, validate token * feat(auth): add protectedRoutes * format: apply format * fix: update design to final WIP * format: format code * fix: remove .env files from remote and add .env.example * refactor: migrate code to its own module * ci: config tsconfig.json * feat(GenEd): decorate gened page * setup review with graphql * feat(admin-api): add override * feat(admin-api): add get-all-reviews query * refactor(admin-api): remove unused codes and comments * add enum graphql * remove unused env from template and config * fix lockfile broken * fix env and config * match dependencies version to api's * setup auth to request id_token * add config variable * add template env, validate token * fix: tsconfig * refactor: change 'Topbar' component name to 'Sidebar' * feat(gened): add topbar to gened page * feat(sidebar): add cugetreg logo * add jwt module * feat(pending reviews): add topbar * feat: cancel button * fix(topbar): center rightside buttons vertically * feat(pending reviews): add API for approve and reject reviews * feat: improve textfield * feat: error handling pendingReview * feat(gened): add delete button * feat(gened): add delete gened api * fix: change dependecy installation scope * feat(gened): add input for new gened course * change review and override schema * add idToken validation, me and remove unused code * feat(gened): add refresh button * feat(gened): add react toast for gened page * refactor: migrate toast config to /config * fix(sidebar): fix highlight current page bug * fix(gened): table head is now sticky * fix: make the program compilable * fix: fix sending code * feat: handle validating id_token and generate access_token * feat: handle sending cookie both frontend and backend * feat: add auth guard * feat: lazy query review * feat: add global auth guard * fix: first fetch * fix: fix circular structure by removing passthrough in res * feat(frontend): add protected routes * fix(frontend/generateToken): change from fetch to axios and add spinner * refactor: remove unused code in backend auth * feat: add logout feature * feat(frontend): add authApi * edit readme * fix(backend-api): change cookie expiry date to 30 days * fix(pendingReviews): fix select form type * refactor: remove unused code * feat: filter wip * feat: wip filter * regenerate lockfile * fix admin-web * migrate changes from api to admin-api * fix(admin-api): setReviewStatus return type * fix(admin-api): authentication for graphql * feat(frontend): add login page * feat(frontend): add user feedback approve review * fix(frontend): redirect if login fail * refactor(frontend): remove year and semester * feat(api): add filter to overrides * ci(admin-api): add Dockerfile * Revert "ci(admin-api): add Dockerfile" This reverts commit 1a3e4dfaad8532b7813602ca2d3e12b73d1adb8b. * ci(admin-web): add Dockerfile * ci(admin-web): edit Dockerfile * fix(admin-api): fix dashBoardUrl typo * fix: add skip auth to health check path * Revert "fix: add skip auth to health check path" This reverts commit babd8e3d1ba94f243a4bbb867fb31ae7c4d20d13. * fix: add skip auth in health check * ci: add changeset * ci(admin-web): edit .env * ci(admin-web): edit .env * ci(admin-web): edit .env * ci(admin-web): edit .env * chore: add changeset --------- Co-authored-by: Chanatip Pattanapen Co-authored-by: bombnp Co-authored-by: Nut Pinyo Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: nac Co-authored-by: Saenyakorn Siangsanoh Co-authored-by: Nutthapat Pongtanyavichai <59821765+Leomotors@users.noreply.github.com> --- .changeset/admin-web-env.md | 5 +++++ apps/admin-web/.env | 6 +++--- apps/admin-web/.env.beta | 8 ++++---- apps/admin-web/.env.dev | 8 ++++---- apps/admin-web/.env.prod | 8 ++++---- 5 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 .changeset/admin-web-env.md diff --git a/.changeset/admin-web-env.md b/.changeset/admin-web-env.md new file mode 100644 index 000000000..1a86b6f73 --- /dev/null +++ b/.changeset/admin-web-env.md @@ -0,0 +1,5 @@ +--- +'admin-web': patch +--- + +edit .env for admin-web diff --git a/apps/admin-web/.env b/apps/admin-web/.env index d91fa43bd..6225607a5 100644 --- a/apps/admin-web/.env +++ b/apps/admin-web/.env @@ -2,10 +2,10 @@ NEXT_PUBLIC_ENVIRONMENT=local # Backend -NEXT_PUBLIC_BACKEND_URL_BASE=http://localhost:3333 +NEXT_PUBLIC_BACKEND_URL_BASE=http://localhost:3333/_api # GraphQL -NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/_api/graphql +NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/graphql # Sitemap (Frontend URL) NEXT_PUBLIC_SITE_URL=http://localhost:4201 @@ -20,4 +20,4 @@ NEXT_PUBLIC_CLIENT_ID=2f3a5527c10a61c0489d75825011c69f59743981 NEXT_PUBLIC_REDIRECT_URI=${NEXT_PUBLIC_SITE_URL}/generateToken # Auth URL of backend -NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/auth +NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/auth diff --git a/apps/admin-web/.env.beta b/apps/admin-web/.env.beta index e5d7a8166..a8b6dba4e 100644 --- a/apps/admin-web/.env.beta +++ b/apps/admin-web/.env.beta @@ -2,13 +2,13 @@ NEXT_PUBLIC_ENVIRONMENT=beta # Backend -NEXT_PUBLIC_BACKEND_URL=http://localhost:3333 +NEXT_PUBLIC_BACKEND_URL_BASE=https://beta-admin.internal.cugetreg.com/_api # GraphQL -NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/graphql +NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/graphql # Sitemap (Frontend URL) -NEXT_PUBLIC_SITE_URL=http://localhost:4200 +NEXT_PUBLIC_SITE_URL=https://beta-admin.internal.cugetreg.com # OAuth url NEXT_PUBLIC_AUTHORIZE_URL=https://auth.internal.cugetreg.com/application/o/authorize/ @@ -20,4 +20,4 @@ NEXT_PUBLIC_CLIENT_ID=2f3a5527c10a61c0489d75825011c69f59743981 NEXT_PUBLIC_REDIRECT_URI=${NEXT_PUBLIC_SITE_URL}/generateToken # Auth URL of backend -NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/auth +NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/auth diff --git a/apps/admin-web/.env.dev b/apps/admin-web/.env.dev index 329091885..6f4461782 100644 --- a/apps/admin-web/.env.dev +++ b/apps/admin-web/.env.dev @@ -2,13 +2,13 @@ NEXT_PUBLIC_ENVIRONMENT=dev # Backend -NEXT_PUBLIC_BACKEND_URL=http://localhost:3333 +NEXT_PUBLIC_BACKEND_URL_BASE=https://dev-admin.internal.cugetreg.com/_api # GraphQL -NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/graphql +NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/graphql # Sitemap (Frontend URL) -NEXT_PUBLIC_SITE_URL=http://localhost:4200 +NEXT_PUBLIC_SITE_URL=https://dev-admin.internal.cugetreg.com # OAuth url NEXT_PUBLIC_AUTHORIZE_URL=https://auth.internal.cugetreg.com/application/o/authorize/ @@ -20,4 +20,4 @@ NEXT_PUBLIC_CLIENT_ID=2f3a5527c10a61c0489d75825011c69f59743981 NEXT_PUBLIC_REDIRECT_URI=${NEXT_PUBLIC_SITE_URL}/generateToken # Auth URL of backend -NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/auth +NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/auth diff --git a/apps/admin-web/.env.prod b/apps/admin-web/.env.prod index f6e505867..ebe8bb96a 100644 --- a/apps/admin-web/.env.prod +++ b/apps/admin-web/.env.prod @@ -2,13 +2,13 @@ NEXT_PUBLIC_ENVIRONMENT=production # Backend -NEXT_PUBLIC_BACKEND_URL=http://localhost:3333 +NEXT_PUBLIC_BACKEND_URL_BASE=https://admin.internal.cugetreg.com/_api # GraphQL -NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/graphql +NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/graphql # Sitemap (Frontend URL) -NEXT_PUBLIC_SITE_URL=http://localhost:4200 +NEXT_PUBLIC_SITE_URL=https://admin.internal.cugetreg.com # OAuth url NEXT_PUBLIC_AUTHORIZE_URL=https://auth.internal.cugetreg.com/application/o/authorize/ @@ -20,4 +20,4 @@ NEXT_PUBLIC_CLIENT_ID=2f3a5527c10a61c0489d75825011c69f59743981 NEXT_PUBLIC_REDIRECT_URI=${NEXT_PUBLIC_SITE_URL}/generateToken # Auth URL of backend -NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL}/_api/auth +NEXT_PUBLIC_AUTH_URL=${NEXT_PUBLIC_BACKEND_URL_BASE}/auth