From 74231e79bb597c9aa3216abbc9112a09eb6743ce Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 28 Nov 2020 21:53:20 -0600 Subject: [PATCH] updated fields notes on ticket and component on device --- api/src/ticket/dto/create-ticket.dto.ts | 1 + api/src/ticket/dto/device.dto.ts | 3 ++- api/src/ticket/dto/ticket.dto.ts | 10 +++++++++- api/src/ticket/ticket.service.ts | 4 +++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/api/src/ticket/dto/create-ticket.dto.ts b/api/src/ticket/dto/create-ticket.dto.ts index a8adb5f..506c558 100644 --- a/api/src/ticket/dto/create-ticket.dto.ts +++ b/api/src/ticket/dto/create-ticket.dto.ts @@ -5,4 +5,5 @@ export class CreateTicketDTO extends Omit(TicketDTO, [ 'ticket_id', 'status', 'submission_date', + 'notes', ]) {} diff --git a/api/src/ticket/dto/device.dto.ts b/api/src/ticket/dto/device.dto.ts index 022de62..6d0c3d7 100644 --- a/api/src/ticket/dto/device.dto.ts +++ b/api/src/ticket/dto/device.dto.ts @@ -18,8 +18,9 @@ export class DeviceDTO { description: 'physical hardware part that is damaged', example: 'screen', nullable: true, + default: null, }) - component: string; + component: string | null; @ApiProperty({ description: 'manufacturer of device', example: 'dell' }) manufacturer: string; diff --git a/api/src/ticket/dto/ticket.dto.ts b/api/src/ticket/dto/ticket.dto.ts index 2048e6c..f2844a9 100644 --- a/api/src/ticket/dto/ticket.dto.ts +++ b/api/src/ticket/dto/ticket.dto.ts @@ -38,7 +38,6 @@ export class TicketDTO { }) description: string; - // Not sure of difference between description and problem @ApiProperty({ description: 'label of problem student is facing', example: 'computer slowdown', @@ -50,4 +49,13 @@ export class TicketDTO { example: '2020-07-21 12:44:22', }) submission_date: string; + + @ApiProperty({ + description: 'notes for admin to add', + example: 'TODO: some note', + maxLength: 500, + default: null, + nullable: true, + }) + notes: string | null; } diff --git a/api/src/ticket/ticket.service.ts b/api/src/ticket/ticket.service.ts index 50ca0ff..12e9304 100644 --- a/api/src/ticket/ticket.service.ts +++ b/api/src/ticket/ticket.service.ts @@ -502,17 +502,19 @@ export class TicketService { problem_category, status, priority, + notes, } = updateTicket; const updateTicketQuery = { name: 'update_ticket', text: - 'UPDATE ticket SET core_issue = $1, description = $2, problem_category = $3, status = $4, priority = $5 WHERE ticket_id = $6 RETURNING *', + 'UPDATE ticket SET core_issue = $1, description = $2, problem_category = $3, status = $4, priority = $5, notes = $6 WHERE ticket_id = $7 RETURNING *', values: [ core_issue, description, problem_category, status, priority, + notes, ticket_id, ], };