diff --git a/api/validators/UserControllerRequests.ts b/api/validators/UserControllerRequests.ts index f0b03f9b..f3ba77ce 100644 --- a/api/validators/UserControllerRequests.ts +++ b/api/validators/UserControllerRequests.ts @@ -47,6 +47,9 @@ export class UserPatches implements IUserPatches { @Allow() isAttendancePublic?: boolean; + @Allow() + onboardingSeen?: boolean; + @Type(() => PasswordUpdate) @ValidateNested() @HasMatchingPasswords() diff --git a/migrations/0047-add-onboarding-seen.ts b/migrations/0047-add-onboarding-seen.ts new file mode 100644 index 00000000..afcb1585 --- /dev/null +++ b/migrations/0047-add-onboarding-seen.ts @@ -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 { + await queryRunner.addColumn(TABLE_NAME, + new TableColumn({ + name: 'onboardingSeen', + type: 'boolean', + isNullable: true, + default: false, + })); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropColumn(TABLE_NAME, + new TableColumn({ + name: 'onboardingSeen', + type: 'boolean', + isNullable: true, + default: false, + })); + } +} diff --git a/models/UserModel.ts b/models/UserModel.ts index 677ec3f1..0b594c2a 100644 --- a/models/UserModel.ts +++ b/models/UserModel.ts @@ -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[]; @@ -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; } } diff --git a/types/ApiRequests.ts b/types/ApiRequests.ts index ed571143..a09860ea 100644 --- a/types/ApiRequests.ts +++ b/types/ApiRequests.ts @@ -68,6 +68,7 @@ export interface UserPatches { graduationYear?: number; bio?: string; isAttendancePublic?: boolean; + onboardingSeen?: boolean; passwordChange?: PasswordUpdate; } diff --git a/types/ApiResponses.ts b/types/ApiResponses.ts index 275d6e77..1cf3d2ee 100644 --- a/types/ApiResponses.ts +++ b/types/ApiResponses.ts @@ -359,6 +359,7 @@ export interface PrivateProfile extends PublicProfile { state: string, credits: number, resumes?: PublicResume[], + onboardingSeen: boolean, } export interface PublicFeedback {