Stockage de l'heure de début et des heures de pénalités
This commit is contained in:
parent
97d61497bc
commit
0a89676b7e
@ -0,0 +1,5 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "ChallengeAction" ADD COLUMN "end" TIMESTAMP(3),
|
||||||
|
ADD COLUMN "penaltyEnd" TIMESTAMP(3),
|
||||||
|
ADD COLUMN "penaltyStart" TIMESTAMP(3),
|
||||||
|
ADD COLUMN "start" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
@ -41,13 +41,17 @@ model Challenge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model ChallengeAction {
|
model ChallengeAction {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
user User @relation(fields: [userId], references: [id])
|
user User @relation(fields: [userId], references: [id])
|
||||||
userId Int
|
userId Int
|
||||||
challenge Challenge @relation(fields: [challengeId], references: [id])
|
challenge Challenge @relation(fields: [challengeId], references: [id])
|
||||||
challengeId Int @unique
|
challengeId Int @unique
|
||||||
active Boolean @default(false)
|
active Boolean @default(false)
|
||||||
success Boolean @default(false)
|
success Boolean @default(false)
|
||||||
|
start DateTime @default(now())
|
||||||
|
end DateTime?
|
||||||
|
penaltyStart DateTime?
|
||||||
|
penaltyEnd DateTime?
|
||||||
moneyUpdate MoneyUpdate?
|
moneyUpdate MoneyUpdate?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { ApiProperty } from "@nestjs/swagger"
|
import { ApiProperty } from "@nestjs/swagger"
|
||||||
import { ChallengeAction } from "@prisma/client"
|
import { ChallengeAction } from "@prisma/client"
|
||||||
|
import { IsOptional } from "class-validator"
|
||||||
|
|
||||||
export class ChallengeActionEntity implements ChallengeAction {
|
export default class ChallengeActionEntity implements ChallengeAction {
|
||||||
constructor(partial: Partial<ChallengeActionEntity>) {
|
constructor(partial: Partial<ChallengeActionEntity>) {
|
||||||
Object.assign(this, partial)
|
Object.assign(this, partial)
|
||||||
}
|
}
|
||||||
@ -20,4 +21,19 @@ export class ChallengeActionEntity implements ChallengeAction {
|
|||||||
|
|
||||||
@ApiProperty({ description: "Est-ce que le défi a été réussi" })
|
@ApiProperty({ description: "Est-ce que le défi a été réussi" })
|
||||||
success: boolean
|
success: boolean
|
||||||
|
|
||||||
|
@ApiProperty({ description: "Heure à laquelle le défi a été démarré" })
|
||||||
|
start: Date
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@ApiProperty({ description: "Heure à laquelle le défi a été terminé", required: false, nullable: true })
|
||||||
|
end: Date
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@ApiProperty({ description: "Heure à laquelle la pénalité a commencé, si applicable", required: false, nullable: true })
|
||||||
|
penaltyStart: Date
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@ApiProperty({ description: "Heure à laquelle la pénalité s'est terminée, si applicable", required: false, nullable: true })
|
||||||
|
penaltyEnd: Date
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user