This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implements attendance statistic page
- Loading branch information
1 parent
50e1650
commit ceff3db
Showing
20 changed files
with
803 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
import { Controller } from '@nestjs/common' | ||
import { Controller, Get, ParseIntPipe, Query } from '@nestjs/common' | ||
import { Roles } from '@libs/decorator' | ||
import { BusinessExceptionHandler } from '@libs/exception' | ||
import { Role } from '@prisma/client' | ||
import { AttendanceService } from './attendance.service' | ||
import type { AttendanceWithRoster } from './dto/attendance.dto' | ||
|
||
@Controller('attendances') | ||
export class AttendanceController { | ||
constructor(private readonly attendanceService: AttendanceService) {} | ||
|
||
@Get('') | ||
@Roles(Role.Manager) | ||
async getAttendances( | ||
@Query('scheduleId', ParseIntPipe) scheduleId: number, | ||
@Query('page', ParseIntPipe) page: number, | ||
@Query('searchTerm') searchTerm: string, | ||
@Query('limit', new ParseIntPipe({ optional: true })) limit?: number, | ||
@Query('rosterType') rosterType?: string | ||
): Promise<{ attendances: AttendanceWithRoster[]; total: number }> { | ||
try { | ||
return await this.attendanceService.getAttendances( | ||
scheduleId, | ||
searchTerm, | ||
page, | ||
rosterType, | ||
limit | ||
) | ||
} catch (error) { | ||
BusinessExceptionHandler(error) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.