From edddb8423dfe18957a346862091a118e0fffb69f Mon Sep 17 00:00:00 2001 From: Matthieu Haineault Date: Thu, 24 Jul 2025 10:27:07 -0400 Subject: [PATCH] fix(import): added imports for expenses and expense-codes modules to app.module --- docs/swagger/swagger-spec.json | 588 ++++++++++++++++++ .../migration.sql | 2 + src/app.module.ts | 4 + 3 files changed, 594 insertions(+) create mode 100644 prisma/migrations/20250724141128_added_comment_to_shifts_and_minor_expenses_fix/migration.sql diff --git a/docs/swagger/swagger-spec.json b/docs/swagger/swagger-spec.json index 79b557e..655f5b3 100644 --- a/docs/swagger/swagger-spec.json +++ b/docs/swagger/swagger-spec.json @@ -805,6 +805,394 @@ ] } }, + "/Expenses": { + "post": { + "operationId": "ExpensesController_create", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateExpenseDto" + } + } + } + }, + "responses": { + "201": { + "description": "Expense created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExpenseEntity" + } + } + } + }, + "400": { + "description": "Incomplete task or invalid data" + } + }, + "security": [ + { + "access-token": [] + } + ], + "summary": "Create expense", + "tags": [ + "Expenses" + ] + }, + "get": { + "operationId": "ExpensesController_findAll", + "parameters": [], + "responses": { + "201": { + "description": "List of expenses found", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExpenseEntity" + } + } + } + } + }, + "400": { + "description": "List of expenses not found" + } + }, + "security": [ + { + "access-token": [] + } + ], + "summary": "Find all expenses", + "tags": [ + "Expenses" + ] + } + }, + "/Expenses/{id}": { + "get": { + "operationId": "ExpensesController_findOne", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } + ], + "responses": { + "201": { + "description": "Expense found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExpenseEntity" + } + } + } + }, + "400": { + "description": "Expense not found" + } + }, + "security": [ + { + "access-token": [] + } + ], + "summary": "Find expense", + "tags": [ + "Expenses" + ] + }, + "patch": { + "operationId": "ExpensesController_update", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateExpenseDto" + } + } + } + }, + "responses": { + "201": { + "description": "Expense updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExpenseEntity" + } + } + } + }, + "400": { + "description": "Expense not found" + } + }, + "security": [ + { + "access-token": [] + } + ], + "summary": "Expense shift", + "tags": [ + "Expenses" + ] + }, + "delete": { + "operationId": "ExpensesController_remove", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } + ], + "responses": { + "201": { + "description": "Expense deleted", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExpenseEntity" + } + } + } + }, + "400": { + "description": "Expense not found" + } + }, + "security": [ + { + "access-token": [] + } + ], + "summary": "Delete expense", + "tags": [ + "Expenses" + ] + } + }, + "/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", @@ -2043,6 +2431,206 @@ } } }, + "CreateExpenseDto": { + "type": "object", + "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": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1, + "description": "Unique ID of the expense (auto-generated)" + }, + "timesheet_id": { + "type": "number", + "example": 101, + "description": "ID number for a set timesheet" + }, + "expense": { + "type": "number", + "example": 7, + "description": "ID number of an expense code (link with expense-codes)" + }, + "date": { + "format": "date-time", + "type": "string", + "example": "3018-10-20T00:00:00.000Z", + "description": "Date where the expense was made" + }, + "is_approuved": { + "type": "boolean", + "example": "DENIED, APPROUVED, PENDING, etc...", + "description": "validation status" + }, + "description": { + "type": "string", + "example": "Spent for mileage between A and B", + "description": "explain`s why the expense was made" + }, + "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": [ + "id", + "timesheet_id", + "expense", + "date", + "is_approuved", + "description", + "supervisor_comment" + ] + }, + "UpdateExpenseDto": { + "type": "object", + "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" + } + } + }, + "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": { diff --git a/prisma/migrations/20250724141128_added_comment_to_shifts_and_minor_expenses_fix/migration.sql b/prisma/migrations/20250724141128_added_comment_to_shifts_and_minor_expenses_fix/migration.sql new file mode 100644 index 0000000..b71159f --- /dev/null +++ b/prisma/migrations/20250724141128_added_comment_to_shifts_and_minor_expenses_fix/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "shifts" ADD COLUMN "description" TEXT; diff --git a/src/app.module.ts b/src/app.module.ts index 55f1753..3fe6f7f 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -13,6 +13,8 @@ import { ShiftCodesModule } from './modules/shift-codes/shift-codes.module'; import { ShiftsModule } from './modules/shifts/shifts.module'; import { TimesheetsModule } from './modules/timesheets/timesheets.module'; import { AuthenticationModule } from './modules/authentication/auth.module'; +import { ExpensesModule } from './modules/expenses/expenses.module'; +import { ExpenseCodesModule } from './modules/expense-codes/expense-codes.module'; @Module({ imports: [ @@ -23,6 +25,8 @@ import { AuthenticationModule } from './modules/authentication/auth.module'; CustomersModule, EmployeesModule, LeaveRequestsModule, + ExpensesModule, + ExpenseCodesModule, ShiftCodesModule, ShiftsModule, TimesheetsModule,