lecoffre-ressources/src/Customer/UserHasNotification.ts
Vincent Alamelle d2e854f3a4 test
2023-05-02 16:44:19 +02:00

32 lines
917 B
TypeScript

import { IsNotEmpty, IsDate, ValidateNested } from "class-validator";
import Notification from "./Notification";
import User from "../Notary/User";
import Resource from "../Resource";
import { Type } from "class-transformer";
export default class UserHasNotification extends Resource {
@IsNotEmpty({ groups: ["update"] ,message: "UID is required" })
public uid?: string;
@IsNotEmpty({ groups: ["create"], message: "User is required" })
@ValidateNested({ groups: ["create", "update"] })
@Type(() => User)
public user!: User;
@IsNotEmpty({ groups: ["create"], message: "Notification is required" })
@ValidateNested({ groups: ["create", "update"] })
@Type(() => Notification)
public notification!: Notification;
@IsDate()
public created_at: Date | null = null;
@IsDate()
public updated_at: Date | null = null;
}
export enum ENotificationStatus {
READ = "READ",
UNREAD = "UNREAD",
}