Skip to content

Commit

Permalink
add admin reserved API (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueHorn07 authored Feb 2, 2025
1 parent 71ab727 commit e692795
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/popo/reservation/equip/reserve.equip.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ export class ReserveEquipController {
return this.reserveEquipService.joinEquips(reservations);
}

@Get('user/admin/:uuid')
@Roles(UserType.admin)
@UseGuards(JwtAuthGuard, RolesGuard)
async getUserReservationByAdmin(@Param('uuid') uuid: string) {
const reservations = await this.reserveEquipService.find({
where: { booker_id: uuid },
order: { date: 'DESC', start_time: 'DESC' },
});
return this.reserveEquipService.joinEquips(reservations);
}

@Get('sync-reservation-count')
async syncPlaceReservationCount() {
const equipmentList = await this.equipService.find();
Expand Down
11 changes: 11 additions & 0 deletions src/popo/reservation/place/reserve.place.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ export class ReservePlaceController {
return this.reservePlaceService.joinPlace(reservations);
}

@Get('user/admin/:uuid')
@Roles(UserType.admin)
@UseGuards(JwtAuthGuard, RolesGuard)
async getUserReservationByAdmin(@Param('uuid') uuid: string) {
const reservations = await this.reservePlaceService.find({
where: { booker_id: uuid },
order: { date: 'DESC', start_time: 'DESC' },
});
return this.reservePlaceService.joinPlace(reservations);
}

@Get('place/:place_uuid')
@Roles(UserType.admin, UserType.association, UserType.staff)
@UseGuards(JwtAuthGuard, RolesGuard)
Expand Down
7 changes: 7 additions & 0 deletions src/popo/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ export class UserController {
return this.userService.findOneByUuid(uuid);
}

@Get('admin/:uuid')
@Roles(UserType.admin)
@UseGuards(JwtAuthGuard, RolesGuard)
async getOneByAdmin(@Param('uuid') uuid: string) {
return this.userService.findOneByUuid(uuid);
}

@Get('email/:email')
async getOneByEmail(@Param('email') email: string) {
return this.userService.findOneByEmail(email);
Expand Down

0 comments on commit e692795

Please sign in to comment.