From 6ff2e8fd85ba0bf1f87079c61dc306224600ae55 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 28 Nov 2020 18:10:42 -0600 Subject: [PATCH] updated dtos --- api/src/assignment/dto/assignment.dto.ts | 34 ++++++++++++++++--- .../assignment/dto/create-assignment.dto.ts | 20 ++++------- api/src/ticket/dto/ticket.dto.ts | 1 + 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/api/src/assignment/dto/assignment.dto.ts b/api/src/assignment/dto/assignment.dto.ts index 678b507..fcd42c4 100644 --- a/api/src/assignment/dto/assignment.dto.ts +++ b/api/src/assignment/dto/assignment.dto.ts @@ -1,6 +1,32 @@ +import { ApiProperty } from '@nestjs/swagger'; +export enum AssignmentType { + 'LSU_ID', + 'TICKET_ID', +} export class AssignmentDTO { - assignedby: string; - assignedto: string; - comment: string; - assigndate: Date; + @ApiProperty({ + description: 'serial generated assignment id', + example: 1, + }) + assignment_id: number; + + @ApiProperty({ + minLength: 9, + maxLength: 9, + description: '9-digit number starting with 89', + example: 897584512, + }) + lsu_id: number; + + @ApiProperty({ + description: 'serial generated ticket id', + example: 1, + }) + ticket_id: number; + + @ApiProperty({ + description: 'YYYY-MM-DD HH:MM:SS', + example: '2020-07-21 12:44:22', + }) + assigned_date: string; } diff --git a/api/src/assignment/dto/create-assignment.dto.ts b/api/src/assignment/dto/create-assignment.dto.ts index d834e94..533aeaa 100644 --- a/api/src/assignment/dto/create-assignment.dto.ts +++ b/api/src/assignment/dto/create-assignment.dto.ts @@ -1,15 +1,7 @@ -import { ApiProperty } from '@nestjs/swagger'; +import { ApiProperty, OmitType as Omit } from '@nestjs/swagger'; +import { AssignmentDTO } from './assignment.dto'; -export class CreateAssignmentDTO { - @ApiProperty({ minLength: 3 }) - assignedby: string; - - @ApiProperty({ minLength: 3 }) - assignedto: string; - - @ApiProperty({}) - comment: number; - - @ApiProperty({}) - assigndate: Date; -} +export class CreateAssignmentDTO extends Omit(AssignmentDTO, [ + 'assignment_id', + 'assigned_date', +]) {} diff --git a/api/src/ticket/dto/ticket.dto.ts b/api/src/ticket/dto/ticket.dto.ts index 4d5fd08..2048e6c 100644 --- a/api/src/ticket/dto/ticket.dto.ts +++ b/api/src/ticket/dto/ticket.dto.ts @@ -47,6 +47,7 @@ export class TicketDTO { @ApiProperty({ description: 'YYYY-MM-DD HH:MM:SS', + example: '2020-07-21 12:44:22', }) submission_date: string; }