Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwn04 committed Oct 24, 2024
1 parent 94474ae commit b9acade
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions models/UserModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class UserModel extends BaseEntity {
onboardingSeen: boolean;

@Column('boolean', { default: false })
onboardingCollected: boolean;
firstTasksCompleted: boolean;

@OneToMany((type) => ActivityModel, (activity) => activity.user, { cascade: true })
activities: ActivityModel[];
Expand Down Expand Up @@ -161,7 +161,7 @@ export class UserModel extends BaseEntity {
credits: this.credits,
isAttendancePublic: this.isAttendancePublic,
onboardingSeen: this.onboardingSeen,
onboardingCollected: this.onboardingCollected,
firstTasksCompleted: this.firstTasksCompleted,
};
if (this.attendances) {
fullUserProfile.attendanceCount = this.attendances.length;
Expand Down
4 changes: 2 additions & 2 deletions services/UserAccountService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ export default class UserAccountService {
|| userProfile.bio == null) {
throw new BadRequestError('Onboarding tasks not completed!');
}
if (userProfile.onboardingCollected) {
if (userProfile.firstTasksCompleted) {
throw new BadRequestError('Onboarding reward already collected!');
}
return this.transactions.readWrite(async (txn) => {
const userRepository = Repositories.user(txn);
await userRepository.addPoints(user, 10);
Repositories.activity(txn).logBonus([user], 'First tasks reward', 10);
return userRepository.upsertUser(user, { onboardingCollected: true });
return userRepository.upsertUser(user, { firstTasksCompleted: true });
});
}

Expand Down
2 changes: 1 addition & 1 deletion types/ApiResponses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export interface PrivateProfile extends PublicProfile {
resumes?: PublicResume[],
attendanceCount?: number,
onboardingSeen: boolean,
onboardingCollected: boolean,
firstTasksCompleted: boolean,
}

export interface PublicFeedback {
Expand Down

0 comments on commit b9acade

Please sign in to comment.