group.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { Allow, ArrayMinSize, ArrayNotEmpty, IsInt, IsOptional, IsString } from 'class-validator';
  2. import { Expose } from 'class-transformer';
  3. export class CreateGroupDto {
  4. @Allow()
  5. @Expose()
  6. name: string;
  7. @Allow()
  8. @Expose()
  9. username: string;
  10. @Allow()
  11. @IsInt()
  12. @Expose()
  13. groupId:number;
  14. @Allow()
  15. @Expose()
  16. description:string;
  17. @IsInt()
  18. @Expose()
  19. type:number;
  20. @Allow()
  21. @IsInt()
  22. @Expose()
  23. defaultBotId:number;
  24. @IsInt()
  25. @Expose()
  26. status:number;
  27. @IsOptional()
  28. @ArrayMinSize(0)
  29. @Expose()
  30. tgGroupBots: number[];
  31. }
  32. export class UpdateGroupDto extends CreateGroupDto {
  33. @IsInt()
  34. @Expose()
  35. id: number;
  36. }
  37. export class DeleteGroupDto {
  38. @ArrayNotEmpty()
  39. @Expose()
  40. ids: number[];
  41. }
  42. export class SendGroupsMsgDto {
  43. @ArrayNotEmpty()
  44. @Expose()
  45. groupIds:number[];
  46. @IsString()
  47. @Expose()
  48. message:string;
  49. }
  50. export class SendMsgDto{
  51. @IsInt()
  52. @Expose()
  53. groupId: number;
  54. @IsInt()
  55. @Expose()
  56. botId: number;
  57. @IsString()
  58. @Expose()
  59. message:string;
  60. }