Skip to content

Commit

Permalink
add onboarding seen (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwn04 authored Nov 5, 2024
1 parent ff05d6b commit 5933e49
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/validators/UserControllerRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class UserPatches implements IUserPatches {
@Allow()
isAttendancePublic?: boolean;

@Allow()
onboardingSeen?: boolean;

@Type(() => PasswordUpdate)
@ValidateNested()
@HasMatchingPasswords()
Expand Down
25 changes: 25 additions & 0 deletions migrations/0047-add-onboarding-seen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';

const TABLE_NAME = 'Users';

export class AddOnboardingSeen1730353019494 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn(TABLE_NAME,
new TableColumn({
name: 'onboardingSeen',
type: 'boolean',
isNullable: true,
default: false,
}));
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn(TABLE_NAME,
new TableColumn({
name: 'onboardingSeen',
type: 'boolean',
isNullable: true,
default: false,
}));
}
}
7 changes: 7 additions & 0 deletions models/UserModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export class UserModel extends BaseEntity {
@Column('integer', { default: 0 })
credits: number;

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

@OneToMany((type) => ActivityModel, (activity) => activity.user, { cascade: true })
activities: ActivityModel[];

Expand Down Expand Up @@ -154,10 +157,14 @@ export class UserModel extends BaseEntity {
points: this.points,
credits: this.credits,
isAttendancePublic: this.isAttendancePublic,
onboardingSeen: this.onboardingSeen,
};
if (this.userSocialMedia) {
fullUserProfile.userSocialMedia = this.userSocialMedia.map((sm) => sm.getPublicSocialMedia());
}
if (this.resumes) {
fullUserProfile.resumes = this.resumes.map((rm) => rm.getPublicResume());
}
return fullUserProfile;
}
}
1 change: 1 addition & 0 deletions types/ApiRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface UserPatches {
graduationYear?: number;
bio?: string;
isAttendancePublic?: boolean;
onboardingSeen?: boolean;
passwordChange?: PasswordUpdate;
}

Expand Down
1 change: 1 addition & 0 deletions types/ApiResponses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export interface PrivateProfile extends PublicProfile {
state: string,
credits: number,
resumes?: PublicResume[],
onboardingSeen: boolean,
}

export interface PublicFeedback {
Expand Down

0 comments on commit 5933e49

Please sign in to comment.