32 lines
917 B
TypeScript
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",
|
|
}
|