Skip to content

Commit

Permalink
removed all ratings data usage & update test
Browse files Browse the repository at this point in the history
  • Loading branch information
richard483 committed Jan 24, 2024
1 parent 163d959 commit 7d33b17
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/users/test/users.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ describe('AuthController', () => {
hasGoogleAccount: false,
description: 'desc',
password: 'password',
ratingsAvg: 0,
companyId: '1',
portfolio: ['1', '2'],
previousWorkplaceCount: 0,
previousWorkplaceId: ['1', '2'],
profilePicture: 'picture',
cv: 'cv',
};

const createSpy = jest
Expand Down
8 changes: 0 additions & 8 deletions src/users/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export class UserRepository {
'-previousWorkplace': {
previousWorkplaceCount: 'desc',
},
ratings: { ratingsAvg: 'asc' },
'-ratings': {
ratingsAvg: 'desc',
},
};

this.field = {
Expand Down Expand Up @@ -90,10 +86,6 @@ export class UserRepository {
const data = {
...user,
previousWorkplaceCount: user.previousWorkplaceId?.length,
ratingsAvg:
user.ratings
?.map((rating) => rating.ratingOf10)
.reduce((a, b) => a + b, 0) / user.ratings?.length,
};
return this.prisma.user.create({
data,
Expand Down

0 comments on commit 7d33b17

Please sign in to comment.