-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 626-chore-move-authentication-route-to-speci…
…fic-endpoints
- Loading branch information
Showing
273 changed files
with
16,739 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Dashboard | ||
|
||
permissions: read-all | ||
|
||
on: | ||
push: | ||
paths: | ||
- frontend/dashboard/** | ||
- .github/workflows/dashboard.yml | ||
pull_request: | ||
types: opened | ||
paths: | ||
- frontend/dashboard/** | ||
- .github/workflows/dashboard.yml | ||
|
||
jobs: | ||
format: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: yarn | ||
cache-dependency-path: frontend/dashboard/yarn.lock | ||
- name: Install dependencies | ||
run: | | ||
cd frontend/dashboard | ||
yarn install | ||
- name: Format | ||
run: | | ||
cd frontend/dashboard | ||
yarn format | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: yarn | ||
cache-dependency-path: frontend/dashboard/yarn.lock | ||
- name: Install dependencies | ||
run: | | ||
cd frontend/dashboard | ||
yarn install | ||
- name: Lint | ||
run: | | ||
cd frontend/dashboard | ||
yarn lint | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: yarn | ||
cache-dependency-path: frontend/dashboard/yarn.lock | ||
- name: Install dependencies | ||
run: | | ||
cd frontend/dashboard | ||
yarn install | ||
- name: Test | ||
run: | | ||
cd frontend/dashboard | ||
yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Dashboard CodeQL | ||
|
||
on: | ||
push: | ||
paths: | ||
- "frontend/dashboard/**" | ||
- ".github/workflows/dashboard_codeql.yml" | ||
pull_request: | ||
types: [opened] | ||
paths: | ||
- "frontend/dashboard/**" | ||
- ".github/workflows/dashboard_codeql.yml" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
security-events: write | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: javascript-typescript | ||
queries: security-and-quality | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v3 | ||
with: | ||
working-directory: frontend/dashboard | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "next/core-web-vitals", | ||
"plugins": ["prettier"] | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "sac-dashboard", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"format": "prettier --write .", | ||
"test": "echo \"Woah there, we have no frontend tests as of right now. Let's just say we're passing.\" && exit 0" | ||
|
||
}, | ||
"dependencies": { | ||
"@reduxjs/toolkit": "^2.2.3", | ||
"next": "14.2.2", | ||
"react": "^18", | ||
"react-dom": "^18", | ||
"react-redux": "^9.1.1", | ||
"zod": "^3.23.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"autoprefixer": "^10.4.19", | ||
"eslint": "^8", | ||
"eslint-config-next": "14.2.2", | ||
"postcss": "^8", | ||
"tailwindcss": "^3.4.1", | ||
"typescript": "^5", | ||
"@trivago/prettier-plugin-sort-imports": "^4.3.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"prettier": "^3.2.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
const config = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; | ||
|
||
export default config; |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; | ||
|
||
export const API_BASE_URL = 'http://127.0.0.1:8080/api/v1'; | ||
|
||
// BaseAPI for the entire application: | ||
export const baseApi = createApi({ | ||
baseQuery: fetchBaseQuery({ | ||
baseUrl: API_BASE_URL, | ||
credentials: 'include', | ||
}), | ||
tagTypes: [ | ||
"User", | ||
"Tag", | ||
"Category", | ||
"Club", | ||
"Contact", | ||
"Event", | ||
"PointOfContact", | ||
"File", | ||
"Follower", | ||
"Member", | ||
], | ||
endpoints: () => ({}), | ||
}); | ||
|
||
// Add query params to a request: | ||
export function handleQueryParams(baseUrl: string, queryParams?: Record<string, string | number | boolean>): string { | ||
const url = new URL(baseUrl); | ||
if (queryParams) { | ||
Object.entries(queryParams).forEach(([key, value]) => { | ||
url.searchParams.append(key, value.toString()); | ||
}); | ||
} | ||
return url.toString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { baseApi } from "./api"; | ||
import { LoginRequestBody, RefreshTokenRequestBody } from "../types/auth"; | ||
import { User, userSchema } from "../types/user"; | ||
import { EmailRequestBody, VerifyEmailRequestBody, VerifyPasswordResetTokenRequestBody } from "../types/verification"; | ||
|
||
const AUTH_API_BASE_URL = '/auth'; | ||
|
||
const authApi = baseApi.injectEndpoints({ | ||
endpoints: (builder) => ({ | ||
login: builder.mutation<User, LoginRequestBody>({ | ||
query: (body) => ({ | ||
url: `${AUTH_API_BASE_URL}/login`, | ||
method: 'POST', | ||
body, | ||
}), | ||
transformResponse: (response: User) => { | ||
return userSchema.parse(response); | ||
}, | ||
}), | ||
logout: builder.mutation<void, void>({ | ||
query: () => ({ | ||
url: `${AUTH_API_BASE_URL}/logout`, | ||
method: 'POST', | ||
}), | ||
}), | ||
refresh: builder.mutation<void, RefreshTokenRequestBody>({ | ||
query: (body) => ({ | ||
url: 'refresh', | ||
method: 'POST', | ||
body, | ||
}), | ||
}), | ||
forgotPassword: builder.mutation<void, EmailRequestBody>({ | ||
query: (body) => ({ | ||
url: `${AUTH_API_BASE_URL}/forgot-password`, | ||
method: 'POST', | ||
body, | ||
}), | ||
}), | ||
verifyPasswordResetToken: builder.mutation<void, VerifyPasswordResetTokenRequestBody>({ | ||
query: (body) => ({ | ||
url: `${AUTH_API_BASE_URL}/verify-reset`, | ||
method: 'POST', | ||
body, | ||
}), | ||
}), | ||
sendCode: builder.mutation<void, EmailRequestBody>({ | ||
query: (body) => ({ | ||
url: `${AUTH_API_BASE_URL}/send-code`, | ||
method: 'POST', | ||
body, | ||
}), | ||
}), | ||
verifyEmail: builder.mutation<void, VerifyEmailRequestBody>({ | ||
query: (body) => ({ | ||
url: `${AUTH_API_BASE_URL}/verify-email`, | ||
method: 'POST', | ||
body, | ||
}), | ||
}), | ||
}), | ||
}); | ||
|
||
export const { | ||
useLoginMutation, | ||
useLogoutMutation, | ||
useRefreshMutation, | ||
useForgotPasswordMutation, | ||
useVerifyPasswordResetTokenMutation, | ||
useSendCodeMutation, | ||
useVerifyEmailMutation, | ||
} = authApi; |
Oops, something went wrong.