Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: added new user checklist items #243

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "hasCompletedAssessment" BOOLEAN NOT NULL DEFAULT false;
1 change: 1 addition & 0 deletions prisma/schema/user.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ model User {
countryCode String?
timezone String?
comment String?
hasCompletedAssessment Boolean @default(false)
refreshToken String[]

createdAt DateTime @default(now()) @db.Timestamptz()
Expand Down
12 changes: 12 additions & 0 deletions src/global/selects/users.select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export const privateUserDetailSelect = {
},
},
email: true,
emailVerified: true,
hasCompletedAssessment: true,
countryCode: true,
timezone: true,
voyageTeamMembers: {
Expand Down Expand Up @@ -117,6 +119,16 @@ export const privateUserDetailSelect = {
},
},
},
soloProjects: {
select: {
id: true,
status: {
select: {
status: true,
},
},
},
},
};

export const publicUserDetailSelect = {
Expand Down
3 changes: 3 additions & 0 deletions src/users/entities/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export class UserEntity implements User {
@ApiProperty()
avatar: string;

@ApiProperty()
hasCompletedAssessment: boolean;

@ApiProperty()
githubId: string;

Expand Down
15 changes: 15 additions & 0 deletions src/users/users.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe("UsersService", () => {
emailVerified: true,
firstName: "Jessica",
lastName: "Williamson",
hasCompletedAssessment: true,
avatar: "https://gravatar.com/avatar/3bfaef00e02a22f99e17c66e7a9fdd31?s=400&d=robohash&r=x",
timezone: "Australia/Melbourne",
countryCode: "AU",
Expand Down Expand Up @@ -197,6 +198,14 @@ describe("UsersService", () => {
},
},
],
soloProjects: [
{
id: 1,
status: {
status: "Passed",
},
},
],
};
const mockSprintCheckIns = [
{
Expand Down Expand Up @@ -239,6 +248,12 @@ describe("UsersService", () => {
},
},
],
soloProjects: [
{
id: 1,
status: "Passed",
},
],
};
prismaMock.user.findUnique.mockResolvedValue(mockUser);
prismaMock.formResponseCheckin.findMany.mockResolvedValue(
Expand Down
4 changes: 4 additions & 0 deletions src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ export class UsersService {
};
}
}),
soloProjects: user.soloProjects.map((soloProject) => ({
id: soloProject.id,
status: soloProject.status?.status,
})),
};

return this.formatUser(updatedUser);
Expand Down