From a3639dd89bc0557a26514108a3e1f6c23d3048c1 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Fri, 28 Mar 2025 17:05:10 +0000 Subject: [PATCH] feat: created_via for tracking how runners got into the system (#212) close #211 squash merge please:) Reviewed-on: https://git.odit.services/lfk/backend/pulls/212 --- .../actions/create/CreateSelfServiceCitizenRunner.ts | 1 + src/models/actions/create/CreateSelfServiceRunner.ts | 1 + src/models/entities/Participant.ts | 8 ++++++++ src/models/responses/ResponseParticipant.ts | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/src/models/actions/create/CreateSelfServiceCitizenRunner.ts b/src/models/actions/create/CreateSelfServiceCitizenRunner.ts index d3a9d12..93ad392 100644 --- a/src/models/actions/create/CreateSelfServiceCitizenRunner.ts +++ b/src/models/actions/create/CreateSelfServiceCitizenRunner.ts @@ -26,6 +26,7 @@ export class CreateSelfServiceCitizenRunner extends CreateParticipant { public async toEntity(): Promise { let newRunner: Runner = new Runner(); + newRunner.created_via = "selfservice"; newRunner.firstname = this.firstname; newRunner.middlename = this.middlename; newRunner.lastname = this.lastname; diff --git a/src/models/actions/create/CreateSelfServiceRunner.ts b/src/models/actions/create/CreateSelfServiceRunner.ts index 953db43..163a16d 100644 --- a/src/models/actions/create/CreateSelfServiceRunner.ts +++ b/src/models/actions/create/CreateSelfServiceRunner.ts @@ -28,6 +28,7 @@ export class CreateSelfServiceRunner extends CreateParticipant { public async toEntity(group: RunnerGroup): Promise { let newRunner: Runner = new Runner(); + newRunner.created_via = "selfservice"; newRunner.firstname = this.firstname; newRunner.middlename = this.middlename; newRunner.lastname = this.lastname; diff --git a/src/models/entities/Participant.ts b/src/models/entities/Participant.ts index ccf7656..ba0c741 100644 --- a/src/models/entities/Participant.ts +++ b/src/models/entities/Participant.ts @@ -75,6 +75,14 @@ export abstract class Participant { @IsEmail() email?: string; + /** + * how the participant got into the system + */ + @Column({ nullable: true, default: "backend" }) + @IsOptional() + @IsEmail() + created_via?: string; + /** * Turns this entity into it's response class. */ diff --git a/src/models/responses/ResponseParticipant.ts b/src/models/responses/ResponseParticipant.ts index b5ca124..5262f89 100644 --- a/src/models/responses/ResponseParticipant.ts +++ b/src/models/responses/ResponseParticipant.ts @@ -50,6 +50,12 @@ export abstract class ResponseParticipant implements IResponse { @IsString() email?: string; + /** + * how the participant got into the system + */ + @IsString() + created_via?: string; + /** * The participant's address. */