Skip to content

Commit

Permalink
Merge pull request #19 from cdalton713/backend
Browse files Browse the repository at this point in the history
Backend
  • Loading branch information
alxford45 authored Nov 29, 2020
2 parents 7c4b76c + 05139ad commit 83b1e60
Show file tree
Hide file tree
Showing 18 changed files with 301 additions and 154 deletions.
48 changes: 47 additions & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,31 @@ Get all users

```
GET /api​/user
req: none
res: body: {UserDTO[]}
```

Get all users who are admins

```
GET /api​/user/admin
req: none
res: body: {UserDTO[]}
```

Get all users who are not admins

```
GET /api​/user/student
req: none
res: body: {UserDTO[]}
```

Get user by lsu_id

```
GET /api​/user/{lsu_id}
req: none
res: body: {UserDTO}
```

Expand All @@ -178,27 +182,31 @@ Get all assignments

```
GET /api/assignment
req: none
res: body: {AssignmentDTO}
```

Get all assignments assigned to admin by lsu_id

```
GET /api/assignment/user/{lsu_id}
req: none
res: body: {AssignmentDTO[]}
```

Get all assignments assigned to ticket by ticket_id

```
GET /api/assignment/ticket/{ticket_id}
req: none
res: body: {AssignmentDTO[]}
```

Get one assignment by assignment_id

```
GET /api/assignment/{assignment_id}
req: none
res: body: {AssignmentDTO}
```

Expand All @@ -212,4 +220,42 @@ res: body: {AssignmentDTO}

## Work

TODO
Get all work

```
GET /api/work
req: none
res: body: {WorkDTO[]}
```

Get all work by ticket_id

```
GET /api/work/ticket/{ticket_id}
req: none
res: body: {WorkDTO[]}
```

Get all work by lsu_id

```
GET /api/work/user/{lsu_id}
req: none
res: body: {WorkDTO[]}
```

Get work by work_id

```
GET /api/work/{work_id}
req: none
res: body: {WorkDTO}
```

Post new work

```
POST /api/work
req: body: {CreateWorkDTO}
res: body: {WorkDTO}
```
4 changes: 2 additions & 2 deletions api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { join } from 'path';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TicketModule } from './ticket/ticket.module';
import { TicketWorkModule } from './work/ticketwork.module';
import { WorkModule } from './work/work.module';
import { AssignmentModule } from './assignment/assignment.module.';
import { UserModule } from './user/uer.module';

Expand Down Expand Up @@ -40,7 +40,7 @@ const configImports = (modules: ModuleMetadata['imports']) => {
@Module({
imports: configImports([
TicketModule,
TicketWorkModule,
WorkModule,
AssignmentModule,
UserModule,
]),
Expand Down
1 change: 1 addition & 0 deletions api/src/ticket/dto/create-ticket.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export class CreateTicketDTO extends Omit(TicketDTO, [
'ticket_id',
'status',
'submission_date',
'notes',
]) {}
3 changes: 2 additions & 1 deletion api/src/ticket/dto/device.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion api/src/ticket/dto/ticket.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;
}
4 changes: 1 addition & 3 deletions api/src/ticket/dto/update-ticket.dto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { PartialType } from '@nestjs/swagger';
import { CreateTicketDTO } from './create-ticket.dto';
import { TicketDTO } from './ticket.dto';
import { OmitType as Omit } from '@nestjs/swagger';
import { TicketDTO } from './ticket.dto';

export class UpdateTicketDto extends Omit(TicketDTO, [
'ticket_id',
Expand Down
4 changes: 3 additions & 1 deletion api/src/ticket/ticket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
};
Expand Down
18 changes: 0 additions & 18 deletions api/src/work/dto/create-ticketwork.dto.ts

This file was deleted.

4 changes: 4 additions & 0 deletions api/src/work/dto/create-work.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { OmitType as Omit } from '@nestjs/swagger';
import { WorkDTO } from './work.dto';

export class CreateWorkDTO extends Omit(WorkDTO, ['work_id']) {}
7 changes: 0 additions & 7 deletions api/src/work/dto/update-ticketwork.dto.ts

This file was deleted.

40 changes: 40 additions & 0 deletions api/src/work/dto/work.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { ApiProperty } from '@nestjs/swagger';

export enum WorkType {
'LSU_ID',
'TICKET_ID',
}

export class WorkDTO {
@ApiProperty({
readOnly: true,
description: 'serially generated id for work',
})
work_id: number;

@ApiProperty({
description: 'id that references ticket',
example: 1,
})
ticket_id: number;

@ApiProperty({
minLength: 9,
maxLength: 9,
description: '9-digit number starting with 89',
example: 897584512,
})
lsu_id: number;

@ApiProperty({
description: 'YYYY-MM-DD HH:MM:SS',
example: '2020-07-21 12:44:22',
})
start_datetime: string;

@ApiProperty({
description: 'YYYY-MM-DD HH:MM:SS',
example: '2020-07-21 12:44:22',
})
end_datetime: string;
}
7 changes: 0 additions & 7 deletions api/src/work/entities/ticketwork.entity.ts

This file was deleted.

44 changes: 0 additions & 44 deletions api/src/work/ticketwork.controller.ts

This file was deleted.

11 changes: 0 additions & 11 deletions api/src/work/ticketwork.module.ts

This file was deleted.

58 changes: 0 additions & 58 deletions api/src/work/ticketwork.service.ts

This file was deleted.

Loading

0 comments on commit 83b1e60

Please sign in to comment.