update: add new field for subscription of user when purchased
This commit is contained in:
@@ -1,77 +1,54 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsBoolean, IsNotEmpty, IsOptional, IsString, IsUUID, MinLength } from "class-validator";
|
||||
import {
|
||||
ArrayMinSize,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsDateString,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
Length,
|
||||
MinLength,
|
||||
} from "class-validator";
|
||||
|
||||
import { AnnouncementMessage } from "../../../common/enums/message.enum";
|
||||
|
||||
export class CreateAnnouncementDto {
|
||||
@IsNotEmpty({ message: AnnouncementMessage.TITLE_IS_REQUIRED })
|
||||
@IsString({ message: AnnouncementMessage.TITLE_STRING })
|
||||
@ApiProperty({
|
||||
description: "Title of the announcement",
|
||||
example: "اطلاعیه جدید",
|
||||
})
|
||||
@Length(5, 100, { message: AnnouncementMessage.TITLE_LENGTH })
|
||||
@ApiProperty({ description: "Title of the announcement", example: "اطلاعیه جدید" })
|
||||
title: string;
|
||||
|
||||
@IsNotEmpty({ message: AnnouncementMessage.CONTENT_IS_REQUIRED })
|
||||
@IsString({ message: AnnouncementMessage.CONTENT_IS_STRING })
|
||||
@MinLength(10, { message: AnnouncementMessage.CONTENT_MUST_BE_LONGER })
|
||||
@ApiProperty({
|
||||
description: "Content of the announcement",
|
||||
example: "اطلاعیه جدید برای کاربران",
|
||||
})
|
||||
@ApiProperty({ description: "Content of the announcement", example: "اطلاعیه جدید برای کاربران" })
|
||||
content: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNotEmpty({ message: AnnouncementMessage.PUBLISH_AT_IS_REQUIRED })
|
||||
@ApiProperty({
|
||||
description: "Publish date of the announcement",
|
||||
example: "2023-10-01T10:00:00Z",
|
||||
})
|
||||
@IsDateString({}, { message: AnnouncementMessage.PUBLISH_AT_MUST_BE_DATE })
|
||||
@ApiProperty({ description: "Publish date of the announcement", example: "2023-10-01T10:00:00Z" })
|
||||
publishAt: Date;
|
||||
|
||||
@IsBoolean()
|
||||
@ApiProperty({
|
||||
description: "Is this announcement public?",
|
||||
example: false,
|
||||
})
|
||||
isPublic: boolean;
|
||||
|
||||
@IsBoolean()
|
||||
@ApiProperty({
|
||||
description: "Is this announcement important?",
|
||||
example: false,
|
||||
})
|
||||
@IsNotEmpty({ message: AnnouncementMessage.IMPORTANT_IS_REQUIRED })
|
||||
@IsBoolean({ message: AnnouncementMessage.IMPORTANT_MUST_BE_BOOLEAN })
|
||||
@ApiProperty({ description: "Is this announcement important?", example: false })
|
||||
isImportant: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsNotEmpty({ message: AnnouncementMessage.SERVICE_MUST_BE_ID })
|
||||
@IsUUID("4", { message: AnnouncementMessage.SERVICE_MUST_BE_UUID })
|
||||
@ApiProperty({ description: "Service ID", example: "d290f1ee-6c54-4b01-90e6-d701748f0851" })
|
||||
serviceId: string;
|
||||
@ArrayMinSize(1)
|
||||
@IsUUID("4", { message: AnnouncementMessage.SERVICE_MUST_BE_UUID, each: true })
|
||||
@ApiProperty({ type: [String], description: "Service IDs", example: ["d290f1ee-6c54-4b01-90e6-d701748f0851"] })
|
||||
serviceIds: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsUUID("4", {
|
||||
each: true,
|
||||
message: AnnouncementMessage.GROUP_MUST_BE_UUID,
|
||||
})
|
||||
@ApiProperty({
|
||||
type: [String],
|
||||
description: "Array of group ids",
|
||||
example: ["f7b1b3b1-1b1b-4b1b-8b1b-1b1b1b1b1b1b"],
|
||||
})
|
||||
groupIds: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsUUID("4", {
|
||||
each: true,
|
||||
message: AnnouncementMessage.USER_MUST_BE_UUID,
|
||||
})
|
||||
@ApiProperty({
|
||||
type: [String],
|
||||
description: "Array of users ids",
|
||||
example: ["f7b1b3b1-1b1b-4b1b-8b1b-1b1b1b1b1b1b"],
|
||||
})
|
||||
@ArrayMinSize(1)
|
||||
@IsArray({ message: AnnouncementMessage.USER_IDS_MUST_BE_ARRAY })
|
||||
@IsUUID("4", { each: true, message: AnnouncementMessage.USER_MUST_BE_UUID })
|
||||
@ApiProperty({ type: [String], description: "Array of users ids", example: ["f7b1b3b1-1b1b-4b1b-8b1b-1b1b1b1b1b1b"] })
|
||||
userIds: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user