From 66d6023335c7a9d1a145c4189b610940ef5a525a Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sat, 6 Mar 2021 13:15:27 +0100 Subject: [PATCH] Added last reset requested timestamp to runners ref #154 --- src/models/entities/Runner.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/models/entities/Runner.ts b/src/models/entities/Runner.ts index ad16eae..87ef38d 100644 --- a/src/models/entities/Runner.ts +++ b/src/models/entities/Runner.ts @@ -1,5 +1,5 @@ -import { IsInt, IsNotEmpty } from "class-validator"; -import { ChildEntity, ManyToOne, OneToMany } from "typeorm"; +import { IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator"; +import { ChildEntity, Column, ManyToOne, OneToMany } from "typeorm"; import { ResponseRunner } from '../responses/ResponseRunner'; import { DistanceDonation } from "./DistanceDonation"; import { Participant } from "./Participant"; @@ -43,6 +43,15 @@ export class Runner extends Participant { @OneToMany(() => Scan, scan => scan.runner, { nullable: true }) scans: Scan[]; + /** + * The last time the runner requested a selfservice link. + * Used to prevent spamming of the selfservice link forgotten route. + */ + @Column({ nullable: true, unique: false }) + @IsString() + @IsOptional() + resetRequestedTimestamp?: number; + /** * Returns all valid scans associated with this runner. * This is implemented here to avoid duplicate code in other files.