fix(prisma): minor fix

This commit is contained in:
Matthieu Haineault 2025-08-13 15:51:46 -04:00
parent 3307f3c334
commit 5b1746da9d
4 changed files with 51 additions and 3 deletions

View File

@ -220,6 +220,39 @@
]
}
},
"/employees/employee-list": {
"get": {
"operationId": "EmployeesController_findListEmployees",
"parameters": [],
"responses": {
"200": {
"description": "List of employees with scoped info found",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EmployeeListItemDto"
}
}
}
}
},
"400": {
"description": "List of employees with scoped info not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find all employees with scoped info",
"tags": [
"Employees"
]
}
},
"/employees/{id}": {
"get": {
"operationId": "EmployeesController_findOne",
@ -2241,6 +2274,11 @@
"example": 335567447,
"description": "Employee`s company code"
},
"job_title": {
"type": "string",
"example": "technicient",
"description": "employee`s job title"
},
"first_work_day": {
"type": "string",
"example": "23/09/3018",
@ -2261,9 +2299,14 @@
"phone_number",
"external_payroll_id",
"company_code",
"job_title",
"first_work_day"
]
},
"EmployeeListItemDto": {
"type": "object",
"properties": {}
},
"UpdateEmployeeDto": {
"type": "object",
"properties": {
@ -2312,6 +2355,11 @@
"example": 335567447,
"description": "Employee`s company code"
},
"job_title": {
"type": "string",
"example": "technicient",
"description": "employee`s job title"
},
"first_work_day": {
"format": "date-time",
"type": "string",

View File

@ -21,7 +21,7 @@ export class CsvExportService {
async collectTransaction(periodId: number, companies: ExportCompany[]): Promise<CsvRow[]> {
const companyCodes = companies.map(c => c === ExportCompany.TARGO ? 1 : 2);
const period = await this.prisma.payPeriods.findUnique({
const period = await this.prisma.payPeriods.findFirst({
where: { period_number: periodId },
});
if(!period) {

View File

@ -10,7 +10,7 @@ export class PayPeriodsCommandService {
) {}
async approvalPayPeriod(year: number , periodNumber: number): Promise<void> {
const period = await this.prisma.payPeriods.findUnique({
const period = await this.prisma.payPeriods.findFirst({
where: { period_number: periodNumber },
});
if (!period) throw new NotFoundException(`PayPeriod #${periodNumber} not found`);

View File

@ -116,7 +116,7 @@ export class ShiftsQueryService {
async getSummary(period_id: number): Promise<OverviewRow[]> {
//fetch pay-period to display
const period = await this.prisma.payPeriods.findUnique({
const period = await this.prisma.payPeriods.findFirst({
where: { period_number: period_id },
});
if(!period) {