clean(schedule-presets): clean module of unused imports
This commit is contained in:
parent
8dca65d00e
commit
03d9fa2cf4
|
|
@ -500,24 +500,7 @@
|
|||
"/schedule-presets/apply-presets": {
|
||||
"post": {
|
||||
"operationId": "SchedulePresetsController_applyPresets",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "preset",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "start",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": ""
|
||||
|
|
@ -556,6 +539,16 @@
|
|||
"patch": {
|
||||
"operationId": "ExpenseController_update",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ExpenseDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import { Controller, Param, Query, Body, Get, Post, BadRequestException, ParseIntPipe, Delete, Patch, Req } from "@nestjs/common";
|
||||
import { Controller, Param, Query, Body, Get, Post, ParseIntPipe, Delete, Patch, Req } from "@nestjs/common";
|
||||
import { RolesAllowed } from "src/common/decorators/roles.decorators";
|
||||
import { SchedulePresetsDto } from "src/time-and-attendance/time-tracker/schedule-presets/dtos/create-schedule-presets.dto";
|
||||
import { SchedulePresetsUpdateDto } from "src/time-and-attendance/time-tracker/schedule-presets/dtos/update-schedule-presets.dto";
|
||||
import { SchedulePresetsApplyService } from "src/time-and-attendance/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
||||
import { SchedulePresetsGetService } from "src/time-and-attendance/time-tracker/schedule-presets/services/schedule-presets-get.service";
|
||||
import { SchedulePresetsUpsertService } from "src/time-and-attendance/time-tracker/schedule-presets/services/schedule-presets-upsert.service";
|
||||
import { Roles as RoleEnum } from '.prisma/client';
|
||||
import { GLOBAL_CONTROLLER_ROLES, MANAGER_ROLES } from "src/common/shared/role-groupes";
|
||||
|
||||
@Controller('schedule-presets')
|
||||
|
|
@ -28,14 +27,18 @@ export class SchedulePresetsController {
|
|||
//used to update an already existing schedule preset
|
||||
@Patch('update/:preset_id')
|
||||
@RolesAllowed(...MANAGER_ROLES)
|
||||
async updatePreset(@Param('preset_id', ParseIntPipe) preset_id: number, @Body() dto: SchedulePresetsUpdateDto) {
|
||||
async updatePreset(
|
||||
@Param('preset_id', ParseIntPipe) preset_id: number,
|
||||
@Body() dto: SchedulePresetsUpdateDto
|
||||
) {
|
||||
return await this.upsertService.updatePreset(preset_id, dto);
|
||||
}
|
||||
|
||||
//used to delete a schedule preset
|
||||
@Delete('delete/:preset_id')
|
||||
@RolesAllowed(RoleEnum.ADMIN)
|
||||
async deletePreset(@Param('preset_id') preset_id: number) {
|
||||
@RolesAllowed(...MANAGER_ROLES)
|
||||
async deletePreset(
|
||||
@Param('preset_id', ParseIntPipe) preset_id: number) {
|
||||
return await this.upsertService.deletePreset(preset_id);
|
||||
}
|
||||
|
||||
|
|
@ -50,10 +53,12 @@ export class SchedulePresetsController {
|
|||
|
||||
//used to apply a preset to a timesheet
|
||||
@Post('apply-presets')
|
||||
async applyPresets(@Req() req, @Query('preset') preset_name: string, @Query('start') start_date: string) {
|
||||
async applyPresets(
|
||||
@Req() req,
|
||||
@Body('preset') preset_name: string,
|
||||
@Body('start') start_date: string
|
||||
) {
|
||||
const email = req.user?.email;
|
||||
if (!preset_name?.trim()) throw new BadRequestException('Query "preset" is required');
|
||||
if (!start_date?.trim()) throw new BadRequestException('Query "start" is required YYYY-MM-DD');
|
||||
return this.applyPresetsService.applyToTimesheet(email, preset_name, start_date);
|
||||
return this.applyPresetsService.applyToTimesheet(email, preset_name, start_date);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user