chore: annoucement module with user-group
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { ArrayMinSize, IsArray, IsBoolean, IsNotEmpty, IsOptional, IsString, IsUUID, MinLength } from "class-validator";
|
||||
|
||||
export class CreateAnnouncementDto {
|
||||
@IsNotEmpty({ message: "عنوان نمیتواند خالی باشد" })
|
||||
@IsString({ message: "عنوان باید رشته باشد" })
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
description: "Title of the announcement",
|
||||
example: "اطلاعیه جدید",
|
||||
})
|
||||
title: string;
|
||||
|
||||
@IsNotEmpty({ message: "متن اطلاعیه نمیتواند خالی باشد" })
|
||||
@IsString({ message: "متن اطلاعیه باید رشته باشد" })
|
||||
@MinLength(10, { message: "متن اطلاعیه باید حداقل ۱۰ کاراکتر باشد" })
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
description: "Content of the announcement",
|
||||
example: "اطلاعیه جدید برای کاربران",
|
||||
})
|
||||
content: string;
|
||||
|
||||
@IsBoolean()
|
||||
@ApiProperty({
|
||||
type: Boolean,
|
||||
description: "Is this announcement important?",
|
||||
example: false,
|
||||
})
|
||||
isPublic: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayMinSize(1, { message: "حداقل یک گروه باید انتخاب شود" })
|
||||
@IsUUID("4", {
|
||||
each: true,
|
||||
message: "شناسه هر گروه باید یک UUID معتبر نسخه ۴ باشد",
|
||||
})
|
||||
@ApiProperty({
|
||||
type: [String],
|
||||
description: "Array of group ids",
|
||||
example: ["f7b1b3b1-1b1b-4b1b-8b1b-1b1b1b1b1b1b"],
|
||||
})
|
||||
groupIds: string[];
|
||||
}
|
||||
Reference in New Issue
Block a user