Skip to content

Commit

Permalink
Merge branch 'master' into react-frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
cdalton713 committed Nov 29, 2020
2 parents e4086a8 + 83b1e60 commit f7e40a1
Show file tree
Hide file tree
Showing 21 changed files with 460 additions and 184 deletions.
54 changes: 50 additions & 4 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ req: none
res: body: {CombineDTO}
```

Updates one ticket by ticket_id; Does NOT update user or device
Updates user, ticket, and device by ticket_id;

```
PUT /api​/ticket​/{ticket_id}
req: body: {UpdateTicketDTO}
res: body: {TicketDTO}
req: body: {UpdateCombinedDTO}
res: body: {CombinedDTO}
```

## User
Expand All @@ -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;
}
14 changes: 14 additions & 0 deletions api/src/ticket/dto/update-combined.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IntersectionType } from '@nestjs/swagger';
import { UpdateUserDTO } from 'src/user/dto/update-user.dto';
import { UpdateDeviceDTO } from './update-device.dto';
import { UpdateTicketDto } from './update-ticket.dto';

class UpdateTicketandDevice extends IntersectionType(
UpdateTicketDto,
UpdateDeviceDTO,
) {}

export class UpdateCombinedDTO extends IntersectionType(
UpdateTicketandDevice,
UpdateUserDTO,
) {}
4 changes: 4 additions & 0 deletions api/src/ticket/dto/update-device.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { CreateDeviceDTO } from './create-device.dto';
import { OmitType as Omit } from '@nestjs/swagger';

export class UpdateDeviceDTO extends Omit(CreateDeviceDTO, ['ticket_id']) {}
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
17 changes: 3 additions & 14 deletions api/src/ticket/ticket.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { ApiTags } from '@nestjs/swagger';
import { CreateCombinedDTO } from './dto/create-combined.dto';
import { TicketType } from './dto/ticket.dto';
import { UpdateCombinedDTO } from './dto/update-combined.dto';
import { UpdateTicketDto } from './dto/update-ticket.dto';
import { TicketService } from './ticket.service';

Expand Down Expand Up @@ -68,20 +69,8 @@ export class TicketController {
@Put(':ticket_id')
update(
@Param('ticket_id') ticket_id: number,
@Body() updateTicketDto: UpdateTicketDto,
@Body() updateCombinedDTO: UpdateCombinedDTO,
) {
Logger.log(
{
req: {
http: `PUT /api/ticket/${ticket_id}`,
params: ticket_id,
body: updateTicketDto,
},
},
'TicketController.update',
false,
);

return this.ticketService.update(ticket_id, updateTicketDto);
return this.ticketService.update(ticket_id, updateCombinedDTO);
}
}
Loading

0 comments on commit f7e40a1

Please sign in to comment.