fix(dto): small fix to leave-request dto to inlcude bank_code_id

This commit is contained in:
Matthieu Haineault 2025-07-30 14:44:58 -04:00
parent f874d2c5c6
commit cbb863ac27
5 changed files with 146 additions and 680 deletions

View File

@ -29,6 +29,125 @@
] ]
} }
}, },
"/bank-codes": {
"post": {
"operationId": "BankCodesControllers_create",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateBankCodeDto"
}
}
}
},
"responses": {
"201": {
"description": "Bank code successfully created."
},
"400": {
"description": "Invalid input data."
}
},
"summary": "Create a new bank code",
"tags": [
"BankCodesControllers"
]
},
"get": {
"operationId": "BankCodesControllers_findAll",
"parameters": [],
"responses": {
"200": {
"description": "List of bank codes."
}
},
"summary": "Retrieve all bank codes",
"tags": [
"BankCodesControllers"
]
}
},
"/bank-codes/{id}": {
"get": {
"operationId": "BankCodesControllers_findOne",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"404": {
"description": "Bank code not found."
}
},
"summary": "Retrieve a bank code by its ID",
"tags": [
"BankCodesControllers"
]
},
"patch": {
"operationId": "BankCodesControllers_update",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateBankCodeDto"
}
}
}
},
"responses": {
"404": {
"description": "Bank code not found."
}
},
"summary": "Update an existing bank code",
"tags": [
"BankCodesControllers"
]
},
"delete": {
"operationId": "BankCodesControllers_remove",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"404": {
"description": "Bank code not found."
}
},
"summary": "Delete a bank code",
"tags": [
"BankCodesControllers"
]
}
},
"/archives/employees": { "/archives/employees": {
"get": { "get": {
"operationId": "EmployeesArchiveController_findOneArchived", "operationId": "EmployeesArchiveController_findOneArchived",
@ -1515,394 +1634,6 @@
] ]
} }
}, },
"/expense-codes": {
"post": {
"operationId": "ExpenseCodesController_create",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateExpenseCodeDto"
}
}
}
},
"responses": {
"201": {
"description": "Expense code created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExpenseCodesEntity"
}
}
}
},
"400": {
"description": "Incomplete task or invalid data"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Create expense code",
"tags": [
"Expense Codes"
]
},
"get": {
"operationId": "ExpenseCodesController_findAll",
"parameters": [],
"responses": {
"201": {
"description": "List of expense codes found",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ExpenseCodesEntity"
}
}
}
}
},
"400": {
"description": "List of expense codes not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find all expense codes",
"tags": [
"Expense Codes"
]
}
},
"/expense-codes/{id}": {
"get": {
"operationId": "ExpenseCodesController_findOne",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"201": {
"description": "Expense code found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExpenseCodesEntity"
}
}
}
},
"400": {
"description": "Expense code not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find expense code",
"tags": [
"Expense Codes"
]
},
"patch": {
"operationId": "ExpenseCodesController_update",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateExpenseCodeDto"
}
}
}
},
"responses": {
"201": {
"description": "Expense code updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExpenseCodesEntity"
}
}
}
},
"400": {
"description": "Expense code not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Update expense code",
"tags": [
"Expense Codes"
]
},
"delete": {
"operationId": "ExpenseCodesController_remove",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"201": {
"description": "Expense code deleted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExpenseCodesEntity"
}
}
}
},
"400": {
"description": "Expense code not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Delete expense code",
"tags": [
"Expense Codes"
]
}
},
"/shift-codes": {
"post": {
"operationId": "ShiftCodesController_create",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateShiftCodeDto"
}
}
}
},
"responses": {
"201": {
"description": "Shift code created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ShiftCodesEntity"
}
}
}
},
"400": {
"description": "Incomplete task or invalid data"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Create shift code",
"tags": [
"Shift Codes"
]
},
"get": {
"operationId": "ShiftCodesController_findAll",
"parameters": [],
"responses": {
"201": {
"description": "List of shift codes found",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ShiftCodesEntity"
}
}
}
}
},
"400": {
"description": "List of shift codes not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find all shift codes",
"tags": [
"Shift Codes"
]
}
},
"/shift-codes/{id}": {
"get": {
"operationId": "ShiftCodesController_findOne",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"201": {
"description": "Shift code found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ShiftCodesEntity"
}
}
}
},
"400": {
"description": "Shift code not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find shift code",
"tags": [
"Shift Codes"
]
},
"patch": {
"operationId": "ShiftCodesController_update",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateShiftCodeDto"
}
}
}
},
"responses": {
"201": {
"description": "Shift code updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ShiftCodesEntity"
}
}
}
},
"400": {
"description": "Shift code not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Update shift code",
"tags": [
"Shift Codes"
]
},
"delete": {
"operationId": "ShiftCodesController_remove",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"201": {
"description": "Shift code deleted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ShiftCodesEntity"
}
}
}
},
"400": {
"description": "Shift code not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Delete shift code",
"tags": [
"Shift Codes"
]
}
},
"/auth/login": { "/auth/login": {
"get": { "get": {
"operationId": "AuthController_login", "operationId": "AuthController_login",
@ -2119,6 +1850,14 @@
} }
}, },
"schemas": { "schemas": {
"CreateBankCodeDto": {
"type": "object",
"properties": {}
},
"UpdateBankCodeDto": {
"type": "object",
"properties": {}
},
"CreateEmployeeDto": { "CreateEmployeeDto": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2341,53 +2080,7 @@
}, },
"CreateExpenseDto": { "CreateExpenseDto": {
"type": "object", "type": "object",
"properties": { "properties": {}
"timesheet_id": {
"type": "number",
"example": "Th3F3110w5h1pX2024",
"description": "ID number for a set timesheet"
},
"expense_code_id": {
"type": "number",
"example": "0n3R1n962Ru13xX",
"description": "ID number of an expense code (link with shift-codes)"
},
"date": {
"format": "date-time",
"type": "string",
"example": "20/10/3018",
"description": "Date where the expense was made"
},
"amount": {
"type": "number",
"example": "280 000 000,00",
"description": "Amount of the expense"
},
"description": {
"type": "string",
"example": "Spent for mileage between A and B",
"description": "explain`s why the expense was made"
},
"is_approved": {
"type": "boolean",
"example": "True or False or Pending or Denied or Cancelled or Escalated",
"description": "Expense`s approval status"
},
"supervisor_comment": {
"type": "string",
"example": "Asked X to go there as an emergency response",
"description": "Supervisro`s justification for the spending of an employee"
}
},
"required": [
"timesheet_id",
"expense_code_id",
"date",
"amount",
"description",
"is_approved",
"supervisor_comment"
]
}, },
"ExpenseEntity": { "ExpenseEntity": {
"type": "object", "type": "object",
@ -2402,10 +2095,10 @@
"example": 101, "example": 101,
"description": "ID number for a set timesheet" "description": "ID number for a set timesheet"
}, },
"expense": { "bank_code_id": {
"type": "number", "type": "number",
"example": 7, "example": 7,
"description": "ID number of an expense code (link with expense-codes)" "description": "ID number of an bank code (link with bank-codes)"
}, },
"date": { "date": {
"format": "date-time", "format": "date-time",
@ -2432,7 +2125,7 @@
"required": [ "required": [
"id", "id",
"timesheet_id", "timesheet_id",
"expense", "bank_code_id",
"date", "date",
"is_approuved", "is_approuved",
"description", "description",
@ -2441,90 +2134,11 @@
}, },
"UpdateExpenseDto": { "UpdateExpenseDto": {
"type": "object", "type": "object",
"properties": { "properties": {}
"timesheet_id": {
"type": "number",
"example": "Th3F3110w5h1pX2024",
"description": "ID number for a set timesheet"
},
"expense_code_id": {
"type": "number",
"example": "0n3R1n962Ru13xX",
"description": "ID number of an expense code (link with shift-codes)"
},
"date": {
"format": "date-time",
"type": "string",
"example": "20/10/3018",
"description": "Date where the expense was made"
},
"amount": {
"type": "number",
"example": "280 000 000,00",
"description": "Amount of the expense"
},
"description": {
"type": "string",
"example": "Spent for mileage between A and B",
"description": "explain`s why the expense was made"
},
"is_approved": {
"type": "boolean",
"example": "True or False or Pending or Denied or Cancelled or Escalated",
"description": "Expense`s approval status"
},
"supervisor_comment": {
"type": "string",
"example": "Asked X to go there as an emergency response",
"description": "Supervisro`s justification for the spending of an employee"
}
}
}, },
"CreateShiftDto": { "CreateShiftDto": {
"type": "object", "type": "object",
"properties": { "properties": {}
"timesheet_id": {
"type": "number",
"example": "Th3F3110w5h1pX2024",
"description": "ID number for a set timesheet"
},
"shift_code_id": {
"type": "number",
"example": "0n3R1n962Ru13xX",
"description": "ID number of a shift code (link with shift-codes)"
},
"date": {
"format": "date-time",
"type": "string",
"example": "20/10/3018",
"description": "Date where the shift takes place"
},
"start_time": {
"format": "date-time",
"type": "string",
"example": "08:00",
"description": "Start time of the said shift"
},
"end_time": {
"format": "date-time",
"type": "string",
"example": "17:00",
"description": "End time of the said shift"
},
"description": {
"type": "string",
"example": "Called for an emergency at X` place",
"description": "justify the purpose of the shift"
}
},
"required": [
"timesheet_id",
"shift_code_id",
"date",
"start_time",
"end_time",
"description"
]
}, },
"ShiftEntity": { "ShiftEntity": {
"type": "object", "type": "object",
@ -2539,10 +2153,10 @@
"example": 101, "example": 101,
"description": "ID number for a set timesheet" "description": "ID number for a set timesheet"
}, },
"shift_code_id": { "bank_code_id": {
"type": "number", "type": "number",
"example": 7, "example": 7,
"description": "ID number of a shift code (link with shift-codes)" "description": "ID number of a shift code (link with bank-codes)"
}, },
"date": { "date": {
"format": "date-time", "format": "date-time",
@ -2566,7 +2180,7 @@
"required": [ "required": [
"id", "id",
"timesheet_id", "timesheet_id",
"shift_code_id", "bank_code_id",
"date", "date",
"start_time", "start_time",
"end_time" "end_time"
@ -2574,41 +2188,7 @@
}, },
"UpdateShiftsDto": { "UpdateShiftsDto": {
"type": "object", "type": "object",
"properties": { "properties": {}
"timesheet_id": {
"type": "number",
"example": "Th3F3110w5h1pX2024",
"description": "ID number for a set timesheet"
},
"shift_code_id": {
"type": "number",
"example": "0n3R1n962Ru13xX",
"description": "ID number of a shift code (link with shift-codes)"
},
"date": {
"format": "date-time",
"type": "string",
"example": "20/10/3018",
"description": "Date where the shift takes place"
},
"start_time": {
"format": "date-time",
"type": "string",
"example": "08:00",
"description": "Start time of the said shift"
},
"end_time": {
"format": "date-time",
"type": "string",
"example": "17:00",
"description": "End time of the said shift"
},
"description": {
"type": "string",
"example": "Called for an emergency at X` place",
"description": "justify the purpose of the shift"
}
}
}, },
"CreateLeaveRequestsDto": { "CreateLeaveRequestsDto": {
"type": "object", "type": "object",
@ -3051,124 +2631,6 @@
} }
} }
}, },
"CreateExpenseCodeDto": {
"type": "object",
"properties": {
"expense_type": {
"type": "string",
"example": "mileage, overnight, etc...",
"description": "Type of expenses for an account perception"
},
"bank_code": {
"type": "string",
"example": "G500, G501, etc...",
"description": "bank`s code related to the type of expense"
}
},
"required": [
"expense_type",
"bank_code"
]
},
"ExpenseCodesEntity": {
"type": "object",
"properties": {
"id": {
"type": "number",
"example": 1,
"description": "Unique ID of a expense-code (auto-generated)"
},
"shift_type": {
"type": "string",
"example": "Mileage",
"description": "Type of expenses for an account perception"
},
"bank_code": {
"type": "string",
"example": "G501",
"description": "bank`s code related to the type of expense"
}
},
"required": [
"id",
"shift_type",
"bank_code"
]
},
"UpdateExpenseCodeDto": {
"type": "object",
"properties": {
"expense_type": {
"type": "string",
"example": "mileage, overnight, etc...",
"description": "Type of expenses for an account perception"
},
"bank_code": {
"type": "string",
"example": "G500, G501, etc...",
"description": "bank`s code related to the type of expense"
}
}
},
"CreateShiftCodeDto": {
"type": "object",
"properties": {
"shift_type": {
"type": "string",
"example": "Regular or Night or Emergency, etc...",
"description": "Type of shifts for an account perception"
},
"bank_code": {
"type": "string",
"example": "G1, G2, G3, etc...",
"description": "bank`s code related to the type of shift"
}
},
"required": [
"shift_type",
"bank_code"
]
},
"ShiftCodesEntity": {
"type": "object",
"properties": {
"id": {
"type": "number",
"example": 1,
"description": "Unique ID of a shift-code (auto-generated)"
},
"shift_type": {
"type": "string",
"example": "Night",
"description": "Type of shifts for an account perception"
},
"bank_code": {
"type": "string",
"example": "G2",
"description": "bank`s code related to the type of shift"
}
},
"required": [
"id",
"shift_type",
"bank_code"
]
},
"UpdateShiftCodeDto": {
"type": "object",
"properties": {
"shift_type": {
"type": "string",
"example": "Regular or Night or Emergency, etc...",
"description": "Type of shifts for an account perception"
},
"bank_code": {
"type": "string",
"example": "G1, G2, G3, etc...",
"description": "bank`s code related to the type of shift"
}
}
},
"PayPeriodEntity": { "PayPeriodEntity": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -9,19 +9,19 @@ import { OauthAccessTokensModule } from './modules/oauth-access-tokens/oauth-acc
import { CustomersModule } from './modules/customers/customers.module'; import { CustomersModule } from './modules/customers/customers.module';
import { EmployeesModule } from './modules/employees/employees.module'; import { EmployeesModule } from './modules/employees/employees.module';
import { LeaveRequestsModule } from './modules/leave-requests/leave-requests.module'; import { LeaveRequestsModule } from './modules/leave-requests/leave-requests.module';
import { ShiftCodesModule } from './modules/shift-codes/shift-codes.module';
import { ShiftsModule } from './modules/shifts/shifts.module'; import { ShiftsModule } from './modules/shifts/shifts.module';
import { TimesheetsModule } from './modules/timesheets/timesheets.module'; import { TimesheetsModule } from './modules/timesheets/timesheets.module';
import { AuthenticationModule } from './modules/authentication/auth.module'; import { AuthenticationModule } from './modules/authentication/auth.module';
import { ExpensesModule } from './modules/expenses/expenses.module'; import { ExpensesModule } from './modules/expenses/expenses.module';
import { ExpenseCodesModule } from './modules/expense-codes/expense-codes.module';
import { PayperiodsModule } from './modules/pay-periods/pay-periods.module'; import { PayperiodsModule } from './modules/pay-periods/pay-periods.module';
import { ScheduleModule } from '@nestjs/schedule'; import { ScheduleModule } from '@nestjs/schedule';
import { ArchivalModule } from './modules/archival/archival.module'; import { ArchivalModule } from './modules/archival/archival.module';
import { BankCodesModule } from './modules/bank-codes/bank-codes.module';
@Module({ @Module({
imports: [ imports: [
ScheduleModule.forRoot(), ScheduleModule.forRoot(),
BankCodesModule,
ArchivalModule, ArchivalModule,
PrismaModule, PrismaModule,
HealthModule, HealthModule,
@ -31,8 +31,6 @@ import { ArchivalModule } from './modules/archival/archival.module';
EmployeesModule, EmployeesModule,
LeaveRequestsModule, LeaveRequestsModule,
ExpensesModule, ExpensesModule,
ExpenseCodesModule,
ShiftCodesModule,
ShiftsModule, ShiftsModule,
TimesheetsModule, TimesheetsModule,
AuthenticationModule, AuthenticationModule,

View File

@ -9,4 +9,4 @@ import { BankCodesService } from "./services/bank-codes.services";
providers: [BankCodesService, PrismaService], providers: [BankCodesService, PrismaService],
}) })
export class ShiftCodesModule {} export class BankCodesModule {}

View File

@ -12,6 +12,10 @@ export class CreateLeaveRequestsDto {
@IsInt() @IsInt()
employee_id: number; employee_id: number;
@Type(()=> Number)
@IsInt()
bank_code_id: number;
@ApiProperty({ @ApiProperty({
example: 'Sick or Vacation or Unpaid or Bereavement or Parental or Legal', example: 'Sick or Vacation or Unpaid or Bereavement or Parental or Legal',
description: 'type of leave request for an accounting perception', description: 'type of leave request for an accounting perception',

View File

@ -11,6 +11,7 @@ export class LeaveRequestsService {
async create(dto: CreateLeaveRequestsDto): Promise<LeaveRequests> { async create(dto: CreateLeaveRequestsDto): Promise<LeaveRequests> {
const { const {
employee_id, employee_id,
bank_code_id,
leave_type, leave_type,
start_date_time, start_date_time,
end_date_time, end_date_time,
@ -21,6 +22,7 @@ export class LeaveRequestsService {
return this.prisma.leaveRequests.create({ return this.prisma.leaveRequests.create({
data: { data: {
employee_id, employee_id,
bank_code_id,
leave_type, leave_type,
start_date_time, start_date_time,
end_date_time, end_date_time,