Skip to content

Commit 67c1285

Browse files
authored
Merge pull request #216 from chingu-x/dev
End of sprint merge into main (29/30)
2 parents 88d366c + 84301a6 commit 67c1285

File tree

95 files changed

+1566
-319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1566
-319
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: 'Pull request reviewer reminder'
2+
on:
3+
schedule:
4+
# Check reviews every weekday, 10:00 and 17:00
5+
- cron: '0 10,17 * * 1-5'
6+
7+
jobs:
8+
pull-request-reviewer-reminder:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: tommykw/pull-request-reviewer-reminder-action@v2
12+
with:
13+
github_token: ${{ secrets.GITHUB_TOKEN }} # Required
14+
reminder_message: 'One business day has passed since the review started. Give priority to reviews as much as possible.' # Required. Messages to send to reviewers on Github.
15+
review_turnaround_hours: 24 # Required. This is the deadline for reviews. If this time is exceeded, a reminder wil be send.

CHANGELOG.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,49 @@ Another example [here](https://co-pilot.dev/changelog)
1010

1111
### Added
1212

13+
- Add units tests for the forms controller and services([#204](https://github.com/chingu-x/chingu-dashboard-be/pull/204))
14+
- Add same site property to cookie ([#212](https://github.com/chingu-x/chingu-dashboard-be/pull/212))
15+
- Add same site property to cookie in refresh endpoint ([#214](https://github.com/chingu-x/chingu-dashboard-be/pull/214))
16+
- Add new comment model ([#213](https://github.com/chingu-x/chingu-dashboard-be/pull/213))
17+
1318
### Changed
1419

20+
- Update PostgreSQL image to timescale/timescaledb-ha:pg16 to match railway postgres image ([#210](https://github.com/chingu-x/chingu-dashboard-be/pull/210))
21+
- refactored e2e tests to use absolute import paths ([#207](https://github.com/chingu-x/chingu-dashboard-be/pull/207))
22+
- Updated seed data of user voyage roles and added new users([#206](https://github.com/chingu-x/chingu-dashboard-be/pull/206))
23+
- Refactored e2e tests to use absolute import paths ([#207](https://github.com/chingu-x/chingu-dashboard-be/pull/207))
24+
- Update solo project model ([#213](https://github.com/chingu-x/chingu-dashboard-be/pull/213))
25+
- Update readme to include more instructions for using the test database ([#213](https://github.com/chingu-x/chingu-dashboard-be/pull/213))
26+
- refactored unit tests to use absolute import paths ([#215](https://github.com/chingu-x/chingu-dashboard-be/pull/215))
27+
1528
### Fixed
1629

17-
### Removed
30+
- Fix cors localhost address ([#205](https://github.com/chingu-x/chingu-dashboard-be/pull/205))
31+
- Fix voyages/sprints/teams/{teamId} returning wrong meetingIds ([#209](https://github.com/chingu-x/chingu-dashboard-be/pull/209))
32+
- Fix one of the regex in cors origin list ([#211](https://github.com/chingu-x/chingu-dashboard-be/pull/211))
1833

34+
### Removed
1935

2036
## [v1.0.1-alpha]
2137

2238
### Added
39+
2340
- Add units tests for the teams controller & services([#189](https://github.com/chingu-x/chingu-dashboard-be/pull/189))
2441
- Add discord oauth and e2e test ([#194](https://github.com/chingu-x/chingu-dashboard-be/pull/194))
2542
- Add morgan middleware for request logging with custom logger ([#200](https://github.com/chingu-x/chingu-dashboard-be/pull/200))
2643
- Add CASL permissions for Team Sprint endpoint ([#193](https://github.com/chingu-x/chingu-dashboard-be/pull/193))
2744
- Add units tests for the teams resource controller & services([#201](https://github.com/chingu-x/chingu-dashboard-be/pull/201))
45+
- Add github workflow for PR reminders ([#202](https://github.com/chingu-x/chingu-dashboard-be/pull/202))
2846

2947
### Changed
48+
3049
- updated changelog ([#195](https://github.com/chingu-x/chingu-dashboard-be/pull/195))
3150
- Update accepted localhost port and docker compose file for a custom network setup ([#199](https://github.com/chingu-x/chingu-dashboard-be/pull/199))
3251

3352
### Fixed
53+
3454
- Fix seed data for alpha test (check in form question changes, gravatar) ([#190](https://github.com/chingu-x/chingu-dashboard-be/pull/190))
55+
- Fix voyageNumber generation from sprintId for check-in submissions ([#186](https://github.com/chingu-x/chingu-dashboard-be/pull/186))
3556
- revised 2 checkin questions for alpha test ([#192](https://github.com/chingu-x/chingu-dashboard-be/pull/192))
3657
- Fix seed checkin form data for PO and SM , and voyage-role for team 6 ([#196](https://github.com/chingu-x/chingu-dashboard-be/pull/196))
3758
- Bug add check for team id in place memberId ([#197](https://github.com/chingu-x/chingu-dashboard-be/pull/197))
@@ -81,14 +102,10 @@ Another example [here](https://co-pilot.dev/changelog)
81102
- Add CASL permissions for Tech endpoint ([#174](https://github.com/chingu-x/chingu-dashboard-be/pull/174))
82103
- Add CASL permissions for Team Resource endpoint ([#177](https://github.com/chingu-x/chingu-dashboard-be/pull/177))
83104
- Add units tests for the users controller & services([#179](https://github.com/chingu-x/chingu-dashboard-be/pull/178))
84-
- Add CASL permissions for Team features endpoint ([#184](https://github.com/chingu-x/chingu-dashboard-be/pull/184))
105+
- Add CASL permissions for Team features endpoint ([#184](https://github.com/chingu-x/chingu-dashboard-be/pull/184))
85106
- Add production seed for alpha test ([#185](https://github.com/chingu-x/chingu-dashboard-be/pull/185))
86107
- Add types and validation to env variables ([#187](https://github.com/chingu-x/chingu-dashboard-be/pull/187))
87108

88-
89-
90-
91-
92109
### Changed
93110

94111
- Update docker compose and scripts in package.json to include a test database container and remove usage of .env.dev to avoid confusion ([#100](https://github.com/chingu-x/chingu-dashboard-be/pull/100))
@@ -105,7 +122,7 @@ Another example [here](https://co-pilot.dev/changelog)
105122
- updated meeting model schema to include optional description field [#135](https://github.com/chingu-x/chingu-dashboard-be/pull/135)
106123
- Remove teamMeetings from response for getSprintDatesByTeamId [#139](https://github.com/chingu-x/chingu-dashboard-be/pull/139)
107124
- Updated response for route GET sprints/meetings/{meetingId} to include updatedAt for agendas [#140](https://github.com/chingu-x/chingu-dashboard-be/pull/140)
108-
- Updated response for route GET /sprints/teams/{teamId} to include voyage start and end dates [#147](https://github.com/chingu-x/chingu-dashboard-be/pull/147)
125+
- Updated response for route GET /sprints/teams/{teamId} to include voyage start and end dates [#147](https://github.com/chingu-x/chingu-dashboard-be/pull/147)
109126
- Update test github actions workflow with timeout [#143](https://github.com/chingu-x/chingu-dashboard-be/pull/143)
110127
- Refractor of all form title reference to use values from formTitle.ts [#145](https://github.com/chingu-x/chingu-dashboard-be/pull/145)
111128
- Update/Add more form input types [#146](https://github.com/chingu-x/chingu-dashboard-be/pull/146)
@@ -116,11 +133,10 @@ Another example [here](https://co-pilot.dev/changelog)
116133
- Updated DELETE ideation-vote service to also delete ideation when no votes remain [#161](https://github.com/chingu-x/chingu-dashboard-be/pull/161)
117134
- Refactored the prisma models to be grouped by domain type [#172](https://github.com/chingu-x/chingu-dashboard-be/pull/172)
118135
- Updated response for GET teams/:teamId/techs to include isSelected value for techs [#173](https://github.com/chingu-x/chingu-dashboard-be/pull/173)
119-
- Refactor ideation endpoints to remove redundant teamId params [#175](https://github.com/chingu-x/chingu-dashboard-be/pull/175)
136+
- Refactor ideation endpoints to remove redundant teamId params [#175](https://github.com/chingu-x/chingu-dashboard-be/pull/175)
120137
- Squashed migration files into one [#176](https://github.com/chingu-x/chingu-dashboard-be/pull/176)
121138
- Update prisma schema to include oauth [#181](https://github.com/chingu-x/chingu-dashboard-be/pull/181)
122139

123-
124140
### Fixed
125141

126142
- Fix failed tests in app and ideation due to the change from jwt token response to http cookies ([#98](https://github.com/chingu-x/chingu-dashboard-be/pull/98))
@@ -131,8 +147,6 @@ Another example [here](https://co-pilot.dev/changelog)
131147
- Fix a bug for check on voyageTeamMemberId ([#159](https://github.com/chingu-x/chingu-dashboard-be/pull/159))
132148
- Fix users unit test failing due to a schema change ([#182](https://github.com/chingu-x/chingu-dashboard-be/pull/182))
133149

134-
135-
136150
### Removed
137151

138152
- Removed email from reset-password request body ([#118](https://github.com/chingu-x/chingu-dashboard-be/pull/118))

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ $ yarn seed
6868
# run Prisma Studio
6969
$ yarn studio
7070
```
71+
> [!TIP]
72+
> It is recommended to use `db push` to [prototype your schema](https://www.prisma.io/docs/orm/prisma-migrate/workflows/prototyping-your-schema)
7173
7274
## Running the app
7375

@@ -84,6 +86,9 @@ $ yarn start:prod
8486

8587
## Test<a name="tests"></a>
8688

89+
> [!IMPORTANT]
90+
> To prepare the test database, run `yarn push:test` or `yarn push:test:docker`
91+
8792
```bash
8893
# all tests (unit and e2e for now)
8994
$ yarn test
@@ -250,4 +255,4 @@ Permissions based on roles are defined in the CASL ability factory (`ability.fac
250255
### JWT Refresh Token Guard (JwtRefreshAuthGuard) - `jwt-rt-auth.guard.ts`
251256
This guard is only used for the refresh access token route, `/refresh`, using passport 'jwt-refresh' strategy
252257
### Local Auth guard (LocalAuthGuard) - `local-auth.guard.ts`
253-
This guard is only used for the `/login` route, using the passport 'local' strategy
258+
This guard is only used for the `/login` route, using the passport 'local' strategy

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
postgres:
33
container_name: postgres
4-
image: postgres:15-alpine
4+
image: timescale/timescaledb-ha:pg16
55
restart: always
66
ports:
77
- "5433:5433"
@@ -15,7 +15,7 @@ services:
1515

1616
postgres-test:
1717
container_name: postgres-test
18-
image: postgres:15-alpine
18+
image: timescale/timescaledb-ha:pg16
1919
restart: always
2020
environment:
2121
- POSTGRES_USER=chingu

package.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,21 @@
113113
"json",
114114
"ts"
115115
],
116-
"rootDir": "src",
117-
"testRegex": ".*\\.spec|.jest\\.ts$",
116+
"moduleDirectories": [
117+
"node_modules",
118+
"src"
119+
],
120+
"rootDir": ".",
121+
"moduleNameMapper": {
122+
"@/(.*)": "<rootDir>/src/$1",
123+
"@Prisma/(.*)": "<rootDir>/prisma/$1"
124+
},
125+
"modulePaths": [
126+
"<rootDir>"
127+
],
128+
"testRegex": [
129+
".*\\.spec|.jest\\.ts$"
130+
],
118131
"transform": {
119132
"^.+\\.(t|j)s$": "ts-jest"
120133
},
@@ -124,11 +137,11 @@
124137
"coverageDirectory": "../coverage",
125138
"testEnvironment": "node",
126139
"setupFilesAfterEnv": [
127-
"<rootDir>/prisma/singleton.ts"
140+
"<rootDir>/src/prisma/singleton.ts"
128141
]
129142
},
130143
"prisma": {
131-
"seed": "ts-node prisma/seed/index.ts"
144+
"seed": "ts-node -r tsconfig-paths/register prisma/seed/index.ts"
132145
},
133146
"lint-staged": {
134147
"src/**/*.ts": [
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `adminComments` on the `SoloProject` table. All the data in the column will be lost.
5+
6+
*/
7+
-- CreateEnum
8+
CREATE TYPE "CommentType" AS ENUM ('SoloProject');
9+
10+
-- AlterTable
11+
ALTER TABLE "SoloProject" DROP COLUMN "adminComments";
12+
13+
-- CreateTable
14+
CREATE TABLE "Comment" (
15+
"id" SERIAL NOT NULL,
16+
"content" TEXT NOT NULL,
17+
"authorId" UUID,
18+
"path" TEXT,
19+
"parentCommentId" INTEGER,
20+
"type" "CommentType" NOT NULL,
21+
"soloProjectId" INTEGER,
22+
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
23+
"updatedAt" TIMESTAMP(3) NOT NULL,
24+
25+
CONSTRAINT "Comment_pkey" PRIMARY KEY ("id")
26+
);
27+
28+
-- AddForeignKey
29+
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
30+
31+
-- AddForeignKey
32+
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_parentCommentId_fkey" FOREIGN KEY ("parentCommentId") REFERENCES "Comment"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
33+
34+
-- AddForeignKey
35+
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_soloProjectId_fkey" FOREIGN KEY ("soloProjectId") REFERENCES "SoloProject"("id") ON DELETE CASCADE ON UPDATE CASCADE;

prisma/schema/comment.prisma

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// === Comment ===
2+
model Comment {
3+
id Int @id @default(autoincrement())
4+
content String
5+
author User? @relation(fields: [authorId], references: [id], onDelete: SetNull)
6+
authorId String? @db.Uuid()
7+
path String?
8+
parentCommentId Int?
9+
parentComment Comment? @relation("ParentChildComment", fields: [parentCommentId], references: [id], onDelete: Restrict)
10+
11+
type CommentType
12+
SoloProject SoloProject? @relation(fields: [soloProjectId], references: [id], onDelete: Cascade)
13+
soloProjectId Int?
14+
15+
createdAt DateTime @default(now()) @db.Timestamptz()
16+
updatedAt DateTime @updatedAt
17+
18+
childComments Comment[] @relation("ParentChildComment")
19+
}
20+
21+
enum CommentType {
22+
SoloProject
23+
}

prisma/schema/soloproject.prisma

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ model SoloProject {
1616
evaluatorUserId String? @db.Uuid()
1717
evaluator User? @relation(fields: [evaluatorUserId], references: [id], name: "evaluators", onDelete: SetNull)
1818
evaluatorFeedback String?
19-
adminComments String?
2019
statusId Int?
2120
status SoloProjectStatus? @relation(fields: [statusId], references: [id], onDelete: SetNull)
2221
formId Int?
@@ -26,4 +25,6 @@ model SoloProject {
2625
2726
createdAt DateTime @default(now()) @db.Timestamptz()
2827
updatedAt DateTime @updatedAt
28+
29+
comments Comment[]
2930
}

prisma/schema/user.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ model User {
3838
emailVerificationToken EmailVerificationToken?
3939
roles UserRole[]
4040
oAuthProfiles UserOAuthProfile[]
41+
comments Comment[]
4142
}
4243

4344
model Role {

prisma/seed/solo-project.ts

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const populateSoloProjects = async () => {
3131
},
3232
});
3333

34+
// Solo Project 1
3435
const responseGroup = await prisma.responseGroup.create({
3536
data: {
3637
responses: {
@@ -50,11 +51,31 @@ export const populateSoloProjects = async () => {
5051
},
5152
});
5253

53-
// solo project entries
5454
await prisma.soloProject.create({
5555
data: {
5656
userId: users[0].id,
57-
adminComments: "This is a tier 3 project, not tier 2",
57+
comments: {
58+
createMany: {
59+
data: [
60+
{
61+
content: "This is a tier 2 project, not tier 3",
62+
type: "SoloProject",
63+
},
64+
{
65+
content: "ok",
66+
parentCommentId: 1,
67+
type: "SoloProject",
68+
path: "/1",
69+
},
70+
{
71+
content: "not ok",
72+
parentCommentId: 2,
73+
type: "SoloProject",
74+
path: "/1/2",
75+
},
76+
],
77+
},
78+
},
5879
evaluatorUserId: users[1].id,
5980
evaluatorFeedback: passedSampleFeedback,
6081
statusId: (await prisma.soloProjectStatus.findUnique({
@@ -67,5 +88,40 @@ export const populateSoloProjects = async () => {
6788
},
6889
});
6990

91+
// Solo Project 2
92+
const responseGroup2 = await prisma.responseGroup.create({
93+
data: {
94+
responses: {
95+
createMany: {
96+
data: [
97+
{
98+
questionId: soloProjectForm!.questions[0].id,
99+
text: "www.github.com/repo2",
100+
},
101+
{
102+
questionId: soloProjectForm!.questions[1].id,
103+
text: "www.vercel.com/2",
104+
},
105+
],
106+
},
107+
},
108+
},
109+
});
110+
111+
await prisma.soloProject.create({
112+
data: {
113+
userId: users[5].id,
114+
evaluatorUserId: users[2].id,
115+
evaluatorFeedback: passedSampleFeedback,
116+
statusId: (await prisma.soloProjectStatus.findUnique({
117+
where: {
118+
status: "Waiting Evaluation",
119+
},
120+
}))!.id,
121+
formId: soloProjectForm!.id,
122+
responseGroupId: responseGroup2.id,
123+
},
124+
});
125+
70126
console.log("Solo projects populated.");
71127
};

0 commit comments

Comments
 (0)