Skip to content

Commit

Permalink
chore: change handle jwt guard
Browse files Browse the repository at this point in the history
  • Loading branch information
1tpp committed Aug 4, 2023
1 parent 3f90c91 commit 8f0224e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/offer/dto/create-offer.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TimePeriod, Contract } from '../schemas/offer.schema';

export class CreateOfferDto {
type: string;
project_name: string;
Expand All @@ -7,7 +8,6 @@ export class CreateOfferDto {
time_period: TimePeriod;
contact: Contract;
price_by_unit: number;
_id: string;
image: string;
maximum: number;
}
7 changes: 3 additions & 4 deletions src/tickets/tickets.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import { UpdateTicketDto } from './dto/update-ticket.dto';

@ApiTags('Tickets')
@ApiBearerAuth()
@UseGuards(JwtGuard)
@Controller('tickets')
export class TicketsController {
constructor(private readonly ticketsService: TicketsService) {}

@Post()
@Roles(Role.Provider, Role.Admin)
@UseGuards(RolesGuard)
@UseGuards(RolesGuard, JwtGuard)
async create(@Body() createTicketDto: CreateTicketDto, @GetUser() user) {
const newTicket = await this.ticketsService.create(createTicketDto, user);
return {
Expand Down Expand Up @@ -62,7 +61,7 @@ export class TicketsController {

@Patch(':id')
@Roles(Role.Provider, Role.Admin)
@UseGuards(RolesGuard)
@UseGuards(RolesGuard, JwtGuard)
async update(
@Param('id') id: string,
@Body() updateTicketDto: UpdateTicketDto,
Expand All @@ -77,7 +76,7 @@ export class TicketsController {
}

@Roles(Role.Provider, Role.Admin)
@UseGuards(RolesGuard)
@UseGuards(RolesGuard, JwtGuard)
@Delete(':id')
async remove(@Param('id') id: string) {
const ticketRemoved = await this.ticketsService.remove(id);
Expand Down

0 comments on commit 8f0224e

Please sign in to comment.