clean(modules): modules file cleaning
This commit is contained in:
parent
8fdbdafd91
commit
a5917cbe9d
|
|
@ -1,814 +0,0 @@
|
|||
{
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
"/auth/v1/login": {
|
||||
"get": {
|
||||
"operationId": "AuthController_login",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Auth"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/auth/callback": {
|
||||
"get": {
|
||||
"operationId": "AuthController_loginCallback",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Auth"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/auth/me": {
|
||||
"get": {
|
||||
"operationId": "AuthController_getProfile",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Auth"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/notifications/summary": {
|
||||
"get": {
|
||||
"operationId": "NotificationsController_summary",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Notifications"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/notifications/stream": {
|
||||
"get": {
|
||||
"operationId": "NotificationsController_stream",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Notifications"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/timesheets/{year}/{period_number}": {
|
||||
"get": {
|
||||
"operationId": "TimesheetController_getTimesheetByPayPeriod",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "year",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "period_number",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "employee_email",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Timesheet"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/timesheets/timesheet-approval": {
|
||||
"patch": {
|
||||
"operationId": "TimesheetController_approveTimesheet",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Timesheet"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/shift/create": {
|
||||
"post": {
|
||||
"operationId": "ShiftController_createBatch",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Shift"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/shift/update": {
|
||||
"patch": {
|
||||
"operationId": "ShiftController_updateBatch",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Shift"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/shift/{shift_id}": {
|
||||
"delete": {
|
||||
"operationId": "ShiftController_remove",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "shift_id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Shift"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/schedule-presets/find-list": {
|
||||
"get": {
|
||||
"operationId": "SchedulePresetsController_findListById",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SchedulePresets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/schedule-presets/create": {
|
||||
"post": {
|
||||
"operationId": "SchedulePresetsController_createPreset",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SchedulePresetsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SchedulePresets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/schedule-presets/update": {
|
||||
"patch": {
|
||||
"operationId": "SchedulePresetsController_updatePreset",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SchedulePresetsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SchedulePresets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/schedule-presets/delete/{id}": {
|
||||
"delete": {
|
||||
"operationId": "SchedulePresetsController_deletePreset",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SchedulePresets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/expense/create": {
|
||||
"post": {
|
||||
"operationId": "ExpenseController_create",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ExpenseDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Expense"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/expense/update": {
|
||||
"patch": {
|
||||
"operationId": "ExpenseController_update",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ExpenseDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Expense"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/expense/delete/{expense_id}": {
|
||||
"delete": {
|
||||
"operationId": "ExpenseController_remove",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "expense_id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Expense"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pay-periods/current-and-all": {
|
||||
"get": {
|
||||
"operationId": "PayPeriodsController_getCurrentAndAll",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "date",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"PayPeriods"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pay-periods/date/{date}": {
|
||||
"get": {
|
||||
"operationId": "PayPeriodsController_findByDate",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "date",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"PayPeriods"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pay-periods/{year}/{periodNumber}": {
|
||||
"get": {
|
||||
"operationId": "PayPeriodsController_findOneByYear",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "year",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "periodNumber",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"PayPeriods"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pay-periods/crew/pay-period-approval": {
|
||||
"patch": {
|
||||
"operationId": "PayPeriodsController_bulkApproval",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/BulkCrewApprovalDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"PayPeriods"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pay-periods/crew/{year}/{periodNumber}": {
|
||||
"get": {
|
||||
"operationId": "PayPeriodsController_getCrewOverview",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "year",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "periodNumber",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"PayPeriods"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pay-periods/overview/{year}/{periodNumber}": {
|
||||
"get": {
|
||||
"operationId": "PayPeriodsController_getOverviewByYear",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "year",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "periodNumber",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"PayPeriods"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/exports/csv": {
|
||||
"get": {
|
||||
"operationId": "CsvExportController_exportCsv",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"CsvExport"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/employees/personal-profile": {
|
||||
"get": {
|
||||
"operationId": "EmployeesController_findOwnProfile",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Employees"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/employees/profile": {
|
||||
"get": {
|
||||
"operationId": "EmployeesController_findProfile",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "employee_email",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Employees"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/employees/employee-list": {
|
||||
"get": {
|
||||
"operationId": "EmployeesController_findListEmployees",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Employees"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/employees/create": {
|
||||
"post": {
|
||||
"operationId": "EmployeesController_createEmployee",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/EmployeeDetailedDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Employees"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/employees/update": {
|
||||
"patch": {
|
||||
"operationId": "EmployeesController_updateEmployee",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/EmployeeDetailedDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Employees"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/preferences/update": {
|
||||
"patch": {
|
||||
"operationId": "PreferencesController_updatePreferences",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PreferencesDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Preferences"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/preferences": {
|
||||
"get": {
|
||||
"operationId": "PreferencesController_findPreferences",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Preferences"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/module_access": {
|
||||
"get": {
|
||||
"operationId": "ModuleAccessController_findAccess",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "employee_email",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"ModuleAccess"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/module_access/update": {
|
||||
"patch": {
|
||||
"operationId": "ModuleAccessController_updateAccess",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "employee_email",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ModuleAccess"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"ModuleAccess"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"title": "Targo_Backend",
|
||||
"description": "Documentation de l`API REST pour Targo (NestJS + Prisma)",
|
||||
"version": "1.0",
|
||||
"contact": {}
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "Users",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Employees",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Customers",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Timesheets",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Shifts",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Leave Requests",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Shift Codes",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "OAuth Access Tokens",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "Authorization",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"servers": [],
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"access-token": {
|
||||
"scheme": "bearer",
|
||||
"bearerFormat": "JWT",
|
||||
"type": "http",
|
||||
"name": "Authorization",
|
||||
"description": "Invalid JWT token",
|
||||
"in": "header"
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"SchedulePresetsDto": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"ExpenseDto": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"BulkCrewApprovalDto": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"EmployeeDetailedDto": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"PreferencesDto": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"ModuleAccess": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import { Type } from "class-transformer";
|
||||
import { Allow, IsNotEmpty, IsNumber, IsString } from "class-validator";
|
||||
|
||||
export class BankCodeDto {
|
||||
@Allow()
|
||||
id: number;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
type: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
categorie: string;
|
||||
|
||||
@Type(()=> Number)
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
modifier: number;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
bank_code: string;
|
||||
}
|
||||
|
|
@ -1,40 +1,34 @@
|
|||
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post } from "@nestjs/common";
|
||||
|
||||
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post } from "@nestjs/common";
|
||||
import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators";
|
||||
import { Modules as ModulesEnum } from ".prisma/client";
|
||||
import { BankCodeDto } from "src/time-and-attendance/bank-codes/bank-code.dto";
|
||||
import { Result } from "src/common/errors/result-error.factory";
|
||||
import { Modules as ModulesEnum, Prisma } from ".prisma/client";
|
||||
import { BankCodesService } from "src/time-and-attendance/bank-codes/bank-codes.service";
|
||||
|
||||
@Controller('bank-codes')
|
||||
@ModuleAccessAllowed(ModulesEnum.employee_management)
|
||||
export class BankCodesControllers {
|
||||
constructor(private readonly bankCodesService: BankCodesService) {}
|
||||
constructor(private readonly bankCodesService: BankCodesService) { }
|
||||
//_____________________________________________________________________________________________
|
||||
// Deprecated or unused methods
|
||||
//_____________________________________________________________________________________________
|
||||
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: BankCodeDto) {
|
||||
@ModuleAccessAllowed(ModulesEnum.employee_management)
|
||||
create(@Body() dto: Prisma.BankCodesCreateInput
|
||||
): Promise<Result<boolean, string>> {
|
||||
return this.bankCodesService.create(dto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@ModuleAccessAllowed(ModulesEnum.employee_management)
|
||||
findAll() {
|
||||
return this.bankCodesService.findAll();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id', ParseIntPipe) id: number){
|
||||
return this.bankCodesService.findOne(id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(@Param('id', ParseIntPipe) id: number, @Body() dto: BankCodeDto) {
|
||||
@ModuleAccessAllowed(ModulesEnum.employee_management)
|
||||
update(@Param('id', ParseIntPipe) id: number, @Body() dto: Prisma.BankCodesUpdateInput
|
||||
): Promise<Result<boolean, string>> {
|
||||
return this.bankCodesService.update(id, dto)
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.bankCodesService.remove(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
// import { Module } from "@nestjs/common";
|
||||
// import { PrismaService } from "src/prisma/prisma.service";
|
||||
// import { BankCodesControllers } from "./controllers/bank-codes.controller";
|
||||
// import { BankCodesService } from "./services/bank-codes.service";
|
||||
import { Module } from "@nestjs/common";
|
||||
import { PrismaService } from "src/prisma/prisma.service";
|
||||
import { BankCodesControllers } from "src/time-and-attendance/bank-codes/bank-codes.controller";
|
||||
import { BankCodesService } from "src/time-and-attendance/bank-codes/bank-codes.service";
|
||||
|
||||
// @Module({
|
||||
// controllers: [BankCodesControllers],
|
||||
// providers: [BankCodesService, PrismaService],
|
||||
// })
|
||||
@Module({
|
||||
controllers: [BankCodesControllers],
|
||||
providers: [BankCodesService, PrismaService],
|
||||
})
|
||||
|
||||
// export class BankCodesModule {}
|
||||
export class BankCodesModule {}
|
||||
|
|
@ -1,50 +1,47 @@
|
|||
import { Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { PrismaService } from "src/prisma/prisma.service";
|
||||
import { BankCodes } from "@prisma/client";
|
||||
import { BankCodeDto } from "src/time-and-attendance/bank-codes/bank-code.dto";
|
||||
import { Result } from "src/common/errors/result-error.factory";
|
||||
|
||||
@Injectable()
|
||||
export class BankCodesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
constructor(private readonly prisma: PrismaService) { }
|
||||
|
||||
async create(dto: BankCodeDto): Promise<BankCodes>{
|
||||
return this.prisma.bankCodes.create({
|
||||
data: {
|
||||
type: dto.type,
|
||||
categorie: dto.categorie,
|
||||
modifier: dto.modifier,
|
||||
bank_code: dto.bank_code,
|
||||
},
|
||||
});
|
||||
async create(dto: Prisma.BankCodesCreateInput): Promise<Result<boolean, string>> {
|
||||
try {
|
||||
await this.prisma.bankCodes.create({
|
||||
data: {
|
||||
type: dto.type,
|
||||
categorie: dto.categorie,
|
||||
modifier: dto.modifier,
|
||||
bank_code: dto.bank_code,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
return { success: false, error: 'INVALID_BANK_CODE' + error };
|
||||
}
|
||||
return { success: true, data: true };
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.bankCodes.findMany();
|
||||
}
|
||||
|
||||
async findOne(id: number) {
|
||||
const bankCode = await this.prisma.bankCodes.findUnique({ where: {id} });
|
||||
|
||||
if(!bankCode) throw new NotFoundException(`Bank Code #${id} not found`);
|
||||
|
||||
return bankCode;
|
||||
async update(id: number, dto: Prisma.BankCodesUpdateInput): Promise<Result<boolean, string>> {
|
||||
try {
|
||||
await this.prisma.bankCodes.update({
|
||||
where: { id },
|
||||
data: {
|
||||
type: dto.type,
|
||||
categorie: dto.categorie,
|
||||
modifier: dto.modifier,
|
||||
bank_code: dto.bank_code,
|
||||
},
|
||||
});
|
||||
return { success: true, data: true };
|
||||
} catch (error) {
|
||||
return { success: false, error: 'INVALID_BANK_CODE' + error };
|
||||
}
|
||||
}
|
||||
|
||||
async update(id:number, dto: BankCodeDto) {
|
||||
return await this.prisma.bankCodes.update({
|
||||
where: { id },
|
||||
data: {
|
||||
type: dto.type,
|
||||
categorie: dto.categorie,
|
||||
modifier: dto.modifier as any,
|
||||
bank_code: dto.bank_code,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async remove(id: number) {
|
||||
await this.findOne(id);
|
||||
return this.prisma.bankCodes.delete({ where: {id} });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +1,8 @@
|
|||
import { PrismaService } from "src/prisma/prisma.service";
|
||||
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { Filters, CsvRow } from "src/time-and-attendance/exports/export-csv-options.dto";
|
||||
|
||||
export interface CsvRow {
|
||||
company_code: number;
|
||||
external_payroll_id: number;
|
||||
full_name: string;
|
||||
bank_code: string;
|
||||
quantity_hours?: number;
|
||||
amount?: number;
|
||||
week_number: number;
|
||||
pay_date: string;
|
||||
holiday_date?: string;
|
||||
}
|
||||
|
||||
type Filters = {
|
||||
types: {
|
||||
shifts: boolean;
|
||||
expenses: boolean;
|
||||
holiday: boolean;
|
||||
vacation: boolean;
|
||||
};
|
||||
companies: {
|
||||
targo: boolean;
|
||||
solucom: boolean;
|
||||
};
|
||||
approved: boolean;
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
export class CsvExportService {
|
||||
|
|
@ -35,7 +12,7 @@ export class CsvExportService {
|
|||
year: number,
|
||||
period_no: number,
|
||||
filters: Filters,
|
||||
approved: boolean = true
|
||||
// approved: boolean = true
|
||||
): Promise<CsvRow[]> {
|
||||
//fetch period
|
||||
const period = await this.prisma.payPeriods.findFirst({
|
||||
|
|
|
|||
|
|
@ -2,46 +2,72 @@ import { Transform } from "class-transformer";
|
|||
import { IsBoolean, IsInt, IsOptional, Max, Min } from "class-validator";
|
||||
|
||||
const toBoolean = (v: any) => {
|
||||
if(typeof v === 'boolean') return v;
|
||||
if(typeof v === 'string') return ['true', '1', 'on','yes'].includes(v.toLowerCase());
|
||||
if (typeof v === 'boolean') return v;
|
||||
if (typeof v === 'string') return ['true', '1', 'on', 'yes'].includes(v.toLowerCase());
|
||||
return false;
|
||||
}
|
||||
|
||||
export class ExportCsvOptionsDto {
|
||||
|
||||
@Transform(({ value }) => parseInt(value,10))
|
||||
@Transform(({ value }) => parseInt(value, 10))
|
||||
@IsInt() @Min(2023)
|
||||
year! : number;
|
||||
year!: number;
|
||||
|
||||
@Transform(({ value }) => parseInt(value,10))
|
||||
@Transform(({ value }) => parseInt(value, 10))
|
||||
@IsInt() @Min(1) @Max(26)
|
||||
period_no!: number;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
approved? : boolean = true;
|
||||
approved?: boolean = true;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
shifts? : boolean = true;
|
||||
shifts?: boolean = true;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
expenses? : boolean = true;
|
||||
expenses?: boolean = true;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
holiday? : boolean = true;
|
||||
holiday?: boolean = true;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
vacation? : boolean = true;
|
||||
vacation?: boolean = true;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
targo? : boolean = true;
|
||||
|
||||
targo?: boolean = true;
|
||||
|
||||
@IsOptional() @IsBoolean()
|
||||
@Transform(({ value }) => toBoolean(value))
|
||||
solucom? : boolean = true;
|
||||
}
|
||||
solucom?: boolean = true;
|
||||
}
|
||||
|
||||
export interface CsvRow {
|
||||
company_code: number;
|
||||
external_payroll_id: number;
|
||||
full_name: string;
|
||||
bank_code: string;
|
||||
quantity_hours?: number;
|
||||
amount?: number;
|
||||
week_number: number;
|
||||
pay_date: string;
|
||||
holiday_date?: string;
|
||||
}
|
||||
|
||||
export type Filters = {
|
||||
types: {
|
||||
shifts: boolean;
|
||||
expenses: boolean;
|
||||
holiday: boolean;
|
||||
vacation: boolean;
|
||||
};
|
||||
companies: {
|
||||
targo: boolean;
|
||||
solucom: boolean;
|
||||
};
|
||||
approved: boolean;
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user