fix(mock): small typo in mock datas

This commit is contained in:
Matthieu Haineault 2025-09-30 11:12:46 -04:00
parent 52114deb33
commit 3b4dd9ddb5
7 changed files with 79 additions and 13 deletions

View File

@ -654,6 +654,52 @@
] ]
} }
}, },
"/Expenses/upsert/{email}/{date}": {
"put": {
"operationId": "ExpensesController_upsert_by_date",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "date",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpsertExpenseDto"
}
}
}
},
"responses": {
"200": {
"description": ""
}
},
"security": [
{
"access-token": []
}
],
"tags": [
"Expenses"
]
}
},
"/Expenses": { "/Expenses": {
"post": { "post": {
"operationId": "ExpensesController_create", "operationId": "ExpensesController_create",
@ -2459,6 +2505,10 @@
"type": "object", "type": "object",
"properties": {} "properties": {}
}, },
"UpsertExpenseDto": {
"type": "object",
"properties": {}
},
"CreateExpenseDto": { "CreateExpenseDto": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -143,7 +143,7 @@ async function main() {
bank_code_id, bank_code_id,
date, date,
amount, // string "xx.yy" (2 décimales exactes) amount, // string "xx.yy" (2 décimales exactes)
attachement: null, attachment: null,
comment: `Expense ${code} ${amount}$ (emp ${e.id})`, comment: `Expense ${code} ${amount}$ (emp ${e.id})`,
is_approved: Math.random() < 0.65, is_approved: Math.random() < 0.65,
supervisor_comment: Math.random() < 0.25 ? 'OK' : null, supervisor_comment: Math.random() < 0.25 ? 'OK' : null,

View File

@ -32,7 +32,7 @@ async function main() {
bank_code_id: bc.id, bank_code_id: bc.id,
date: daysAgo(60 + i), date: daysAgo(60 + i),
amount: (20 + i * 3.5).toFixed(2), // ok: Decimal accepte string amount: (20 + i * 3.5).toFixed(2), // ok: Decimal accepte string
attachement: null, attachment: null,
comment: `Old expense #${i + 1}`, comment: `Old expense #${i + 1}`,
is_approved: true, is_approved: true,
supervisor_comment: null, supervisor_comment: null,
@ -50,7 +50,7 @@ async function main() {
bank_code_id: e.bank_code_id, bank_code_id: e.bank_code_id,
date: e.date, date: e.date,
amount: e.amount, amount: e.amount,
attachement: e.attachement, attachment: e.attachment,
comment: e.comment, comment: e.comment,
is_approved: e.is_approved, is_approved: e.is_approved,
supervisor_comment: e.supervisor_comment, supervisor_comment: e.supervisor_comment,

View File

@ -17,7 +17,12 @@ import { EmployeesRepo } from "./repos/employee.repo";
TimesheetsRepo, TimesheetsRepo,
EmployeesRepo, EmployeesRepo,
], ],
exports: [ ExpensesQueryService ], exports: [
ExpensesQueryService,
BankCodesRepo,
TimesheetsRepo,
EmployeesRepo,
],
}) })
export class ExpensesModule {} export class ExpensesModule {}

View File

@ -1,14 +1,14 @@
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common"; import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
import { Expenses, Prisma } from "@prisma/client";
import { BaseApprovalService } from "src/common/shared/base-approval.service"; import { BaseApprovalService } from "src/common/shared/base-approval.service";
import { Expenses, Prisma } from "@prisma/client";
import { PrismaService } from "src/prisma/prisma.service"; import { PrismaService } from "src/prisma/prisma.service";
import { UpsertExpenseDto } from "../dtos/upsert-expense.dto"; import { UpsertExpenseDto } from "../dtos/upsert-expense.dto";
import { BankCodesRepo } from "../repos/bank-codes.repo"; import { BankCodesRepo } from "../repos/bank-codes.repo";
import { TimesheetsRepo } from "../repos/timesheets.repo"; import { TimesheetsRepo } from "../repos/timesheets.repo";
import { EmployeesRepo } from "../repos/employee.repo"; import { EmployeesRepo } from "../repos/employee.repo";
import { toDateOnlyUTC } from "src/modules/shifts/helpers/shifts-date-time-helpers";
import { assertAndTrimComment, computeMileageAmount, mapDbExpenseToDayResponse, normalizeType as normalizeTypeUtil } from "../utils/expenses.utils"; import { assertAndTrimComment, computeMileageAmount, mapDbExpenseToDayResponse, normalizeType as normalizeTypeUtil } from "../utils/expenses.utils";
import { DayExpenseResponse, UpsertAction } from "../types and interfaces/expenses.types.interfaces"; import { DayExpenseResponse, UpsertAction } from "../types and interfaces/expenses.types.interfaces";
import { toDateOnlyUTC } from "src/modules/shifts/helpers/shifts-date-time-helpers";
@Injectable() @Injectable()
export class ExpensesCommandService extends BaseApprovalService<Expenses> { export class ExpensesCommandService extends BaseApprovalService<Expenses> {

View File

@ -7,6 +7,9 @@ import { TimesheetsModule } from "../timesheets/timesheets.module";
import { TimesheetsCommandService } from "../timesheets/services/timesheets-command.service"; import { TimesheetsCommandService } from "../timesheets/services/timesheets-command.service";
import { ExpensesCommandService } from "../expenses/services/expenses-command.service"; import { ExpensesCommandService } from "../expenses/services/expenses-command.service";
import { ShiftsCommandService } from "../shifts/services/shifts-command.service"; import { ShiftsCommandService } from "../shifts/services/shifts-command.service";
import { BankCodesRepo } from "../expenses/repos/bank-codes.repo";
import { EmployeesRepo } from "../expenses/repos/employee.repo";
import { TimesheetsRepo } from "../expenses/repos/timesheets.repo";
@Module({ @Module({
imports: [PrismaModule, TimesheetsModule], imports: [PrismaModule, TimesheetsModule],
@ -16,12 +19,14 @@ import { ShiftsCommandService } from "../shifts/services/shifts-command.service"
TimesheetsCommandService, TimesheetsCommandService,
ExpensesCommandService, ExpensesCommandService,
ShiftsCommandService, ShiftsCommandService,
BankCodesRepo,
TimesheetsRepo,
EmployeesRepo,
], ],
controllers: [PayPeriodsController], controllers: [PayPeriodsController],
exports: [ exports: [
PayPeriodsQueryService, PayPeriodsQueryService,
PayPeriodsCommandService, PayPeriodsCommandService,
PayPeriodsQueryService,
] ]
}) })

View File

@ -5,6 +5,9 @@ import { BusinessLogicsModule } from 'src/modules/business-logics/business-logic
import { TimesheetsCommandService } from './services/timesheets-command.service'; import { TimesheetsCommandService } from './services/timesheets-command.service';
import { ShiftsCommandService } from '../shifts/services/shifts-command.service'; import { ShiftsCommandService } from '../shifts/services/shifts-command.service';
import { ExpensesCommandService } from '../expenses/services/expenses-command.service'; import { ExpensesCommandService } from '../expenses/services/expenses-command.service';
import { BankCodesRepo } from '../expenses/repos/bank-codes.repo';
import { TimesheetsRepo } from '../expenses/repos/timesheets.repo';
import { EmployeesRepo } from '../expenses/repos/employee.repo';
@Module({ @Module({
imports: [BusinessLogicsModule], imports: [BusinessLogicsModule],
@ -13,7 +16,10 @@ import { ExpensesCommandService } from '../expenses/services/expenses-command.se
TimesheetsQueryService, TimesheetsQueryService,
TimesheetsCommandService, TimesheetsCommandService,
ShiftsCommandService, ShiftsCommandService,
ExpensesCommandService ExpensesCommandService,
BankCodesRepo,
TimesheetsRepo,
EmployeesRepo,
], ],
exports: [TimesheetsQueryService], exports: [TimesheetsQueryService],
}) })