Skip to content

Commit

Permalink
Merge branch 'main' into Grade-Dist-Styling-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisl10 authored Dec 7, 2024
2 parents 5217d83 + 7113666 commit b7063b4
Show file tree
Hide file tree
Showing 31 changed files with 2,033 additions and 5,296 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
- reopened
- synchronize

# do not cancel in progress, SST will be stuck in a "locked" state if cancelled mid-deployment
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_and_deploy:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clean-up-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on:
pull_request:
types: [closed]

# use pr number for group instead of github.ref because ref will be main branch when the PR closes which is not a unique group for the PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -46,8 +47,7 @@ jobs:
HUSKY: 0

- name: Remove staging stack
# need to clean up frontend stack first then backend stack or else backend stack doesn't get removed
run: pnpm sst remove --stage staging-${{ github.event.pull_request.number }} frontend && pnpm sst remove --stage staging-${{ github.event.pull_request.number }} backend
run: pnpm sst remove --stage staging-${{ github.event.pull_request.number }}
env:
CI: false
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ node_modules/
# sst files
.sst
cdk.context.json
sst-env.d.ts

# IDE settings
.idea
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Features include:
- Express
- React
- tRPC
- SST and AWS CDK
- SST
- PostgreSQL
- Drizzle ORM
- TypeScript
Expand All @@ -39,7 +39,7 @@ Features include:

### Prerequisites

1. Check your Node version with `node -v`. Make sure you have version 18 or 20 LTS. If you don't, we recommend [nvm](https://github.com/nvm-sh/nvm) to manage node versions (or [nvm-windows](https://github.com/coreybutler/nvm-windows)).
1. Check your Node version with `node -v`. Make sure you have version 18, 20, or 22 LTS. If you don't, we recommend [nvm](https://github.com/nvm-sh/nvm) to manage node versions (or [nvm-windows](https://github.com/coreybutler/nvm-windows)).

2. We use pnpm as our package manager. If you don't have pnpm, install it with `npm i -g pnpm`

Expand Down
34 changes: 17 additions & 17 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,39 @@
"db:studio": "drizzle-kit studio"
},
"dependencies": {
"@trpc/server": "^10.45.1",
"@trpc/server": "^10.45.2",
"@vendia/serverless-express": "^4.12.6",
"axios": "^1.6.8",
"axios": "^1.7.8",
"connect-pg-simple": "^10.0.0",
"cookie-parser": "^1.4.6",
"cookie-parser": "^1.4.7",
"dotenv-flow": "^4.1.0",
"drizzle-orm": "^0.35.3",
"express": "^4.19.2",
"express-session": "^1.18.0",
"drizzle-orm": "^0.37.0",
"express": "^4.21.1",
"express-session": "^1.18.1",
"morgan": "^1.10.0",
"passport": "^0.7.0",
"passport-google-oauth": "^2.0.0",
"pg": "^8.13.0",
"pg": "^8.13.1",
"zod": "^3.23.8"
},
"devDependencies": {
"@peterportal/types": "workspace:*",
"@types/connect-pg-simple": "^7.0.3",
"@types/cookie-parser": "^1.4.7",
"@types/cookie-parser": "^1.4.8",
"@types/dotenv-flow": "^3.3.3",
"@types/express": "^4.17.21",
"@types/express-session": "^1.18.0",
"@types/express": "^5.0.0",
"@types/express-session": "^1.18.1",
"@types/morgan": "^1.9.9",
"@types/passport": "^1.0.16",
"@types/passport": "^1.0.17",
"@types/passport-google-oauth": "^1.0.45",
"@types/pg": "^8.11.10",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"drizzle-kit": "^0.26.2",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"drizzle-kit": "^0.29.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"nodemon": "^3.1.7",
"tsx": "^4.19.1",
"typescript": "^5.4.2"
"tsx": "^4.19.2",
"typescript": "^5.5.4"
}
}
44 changes: 17 additions & 27 deletions api/src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export const user = pgTable(
theme: text('theme'),
lastRoadmapEditAt: timestamp('last_roadmap_edit_at'),
},
(table) => ({
uniqueGoogleId: unique('unique_google_id').on(table.googleId),
}),
(table) => [unique('unique_google_id').on(table.googleId)],
);

export const report = pgTable(
Expand All @@ -40,9 +38,7 @@ export const report = pgTable(
reason: text('reason').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
},
(table) => ({
reviewIdIdx: index('reports_review_id_idx').on(table.reviewId),
}),
(table) => [index('reports_review_id_idx').on(table.reviewId)],
);

export const review = pgTable(
Expand All @@ -69,13 +65,13 @@ export const review = pgTable(
tags: text('tags').array(),
verified: boolean('verified').notNull().default(false),
},
(table) => ({
ratingCheck: check('rating_check', sql`${table.rating} >= 1 AND ${table.rating} <= 5`),
difficultyCheck: check('difficulty_check', sql`${table.difficulty} >= 1 AND ${table.difficulty} <= 5`),
unique: unique('unique_review').on(table.userId, table.professorId, table.courseId),
professorIdIdx: index('reviews_professor_id_idx').on(table.professorId),
courseIdIdx: index('reviews_course_id_idx').on(table.courseId),
}),
(table) => [
check('rating_check', sql`${table.rating} >= 1 AND ${table.rating} <= 5`),
check('difficulty_check', sql`${table.difficulty} >= 1 AND ${table.difficulty} <= 5`),
unique('unique_review').on(table.userId, table.professorId, table.courseId),
index('reviews_professor_id_idx').on(table.professorId),
index('reviews_course_id_idx').on(table.courseId),
],
);

export const planner = pgTable(
Expand All @@ -88,9 +84,7 @@ export const planner = pgTable(
name: text('name').notNull(),
years: jsonb('years').$type<SavedPlannerYearData>().array().notNull(),
},
(table) => ({
userIdIdx: index('planners_user_id_idx').on(table.userId),
}),
(table) => [index('planners_user_id_idx').on(table.userId)],
);

export const transferredCourse = pgTable(
Expand All @@ -100,9 +94,7 @@ export const transferredCourse = pgTable(
courseName: text('course_name'),
units: real('units'),
},
(table) => ({
userIdIdx: index('transferred_courses_user_id_idx').on(table.userId),
}),
(table) => [index('transferred_courses_user_id_idx').on(table.userId)],
);

export const vote = pgTable(
Expand All @@ -116,11 +108,11 @@ export const vote = pgTable(
.references(() => user.id),
vote: integer('vote').notNull(),
},
(table) => ({
voteCheck: check('votes_vote_check', sql`${table.vote} = 1 OR ${table.vote} = -1`),
primaryKey: primaryKey({ columns: [table.reviewId, table.userId] }),
userIdIdx: index('votes_user_id_idx').on(table.userId),
}),
(table) => [
check('votes_vote_check', sql`${table.vote} = 1 OR ${table.vote} = -1`),
primaryKey({ columns: [table.reviewId, table.userId] }),
index('votes_user_id_idx').on(table.userId),
],
);

export const savedCourse = pgTable(
Expand All @@ -131,9 +123,7 @@ export const savedCourse = pgTable(
.notNull(),
courseId: text('course_id').notNull(),
},
(table) => ({
primaryKey: primaryKey({ columns: [table.userId, table.courseId] }),
}),
(table) => [primaryKey({ columns: [table.userId, table.courseId] })],
);

export const session = pgTable('session', {
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
"version": "0.1.0",
"scripts": {
"dev": "concurrently -n backend,frontend -c blue,green \"pnpm --filter=api dev\" \"pnpm --filter=site dev\"",
"prepare": "husky install",
"prepare": "husky",
"format": "prettier --write **/*.{css,scss,cjs,js,ts,tsx,yml,json,html}",
"lint": "prettier **/*.{css,scss,cjs,js,ts,tsx,yml,json,html} --check && pnpm --filter=site lint && pnpm --filter=api lint",
"db:generate": "pnpm --filter=api db:generate",
"db:migrate": "pnpm --filter=api db:migrate",
"db:studio": "pnpm --filter=api db:studio"
},
"dependencies": {
"aws-cdk-lib": "2.132.1",
"dotenv-flow": "^4.0.1",
"sst": "2.41.5"
"sst": "3.3.47"
},
"engines": {
"node": "^18 || ^20",
"node": "^18 || ^20 || ^22",
"pnpm": "^9"
},
"devDependencies": {
"@types/aws-lambda": "8.10.145",
"@types/node": "20.12.8",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"concurrently": "^9.0.1",
"concurrently": "^9.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^8.0.0",
"lint-staged": "^15.2.0",
"prettier": "^3.1.0"
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "^3.4.1"
}
}
Loading

0 comments on commit b7063b4

Please sign in to comment.