diff --git a/docs/swagger/swagger-spec.json b/docs/swagger/swagger-spec.json index 2e7fd71..e8045ac 100644 --- a/docs/swagger/swagger-spec.json +++ b/docs/swagger/swagger-spec.json @@ -163,37 +163,6 @@ "tags": [ "Employees" ] - }, - "get": { - "operationId": "EmployeesController_findAll", - "parameters": [], - "responses": { - "200": { - "description": "List of employees found", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateEmployeeDto" - } - } - } - } - }, - "400": { - "description": "List of employees not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find all employees", - "tags": [ - "Employees" - ] } }, "/employees/employee-list": { @@ -230,74 +199,6 @@ } }, "/employees/{email}": { - "get": { - "operationId": "EmployeesController_findOne", - "parameters": [ - { - "name": "email", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Employee found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEmployeeDto" - } - } - } - }, - "400": { - "description": "Employee not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find employee", - "tags": [ - "Employees" - ] - }, - "delete": { - "operationId": "EmployeesController_remove", - "parameters": [ - { - "name": "email", - "required": true, - "in": "path", - "description": "Email of the employee to delete", - "schema": { - "type": "number" - } - } - ], - "responses": { - "204": { - "description": "Employee deleted" - }, - "404": { - "description": "Employee not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Delete employee", - "tags": [ - "Employees" - ] - }, "patch": { "operationId": "EmployeesController_updateOrArchiveOrRestore", "parameters": [ @@ -360,46 +261,6 @@ ] } }, - "/employees/profile/{email}": { - "get": { - "operationId": "EmployeesController_findOneProfile", - "parameters": [ - { - "name": "email", - "required": true, - "in": "path", - "description": "Identifier of the employee", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Employee profile found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EmployeeProfileItemDto" - } - } - } - }, - "400": { - "description": "Employee profile not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find employee profile", - "tags": [ - "Employees" - ] - } - }, "/timesheets": { "get": { "operationId": "TimesheetsController_getPeriodByQuery", @@ -526,110 +387,6 @@ ] } }, - "/timesheets/{id}": { - "get": { - "operationId": "TimesheetsController_findOne", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "201": { - "description": "Timesheet found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateTimesheetDto" - } - } - } - }, - "400": { - "description": "Timesheet not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find timesheet", - "tags": [ - "Timesheets" - ] - }, - "delete": { - "operationId": "TimesheetsController_remove", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "201": { - "description": "Timesheet deleted", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateTimesheetDto" - } - } - } - }, - "400": { - "description": "Timesheet not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Delete timesheet", - "tags": [ - "Timesheets" - ] - } - }, - "/timesheets/approval/{id}": { - "patch": { - "operationId": "TimesheetsController_approve", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "security": [ - { - "access-token": [] - } - ], - "tags": [ - "Timesheets" - ] - } - }, "/Expenses/upsert/{email}/{date}": { "put": { "operationId": "ExpensesController_upsert_by_date", @@ -676,228 +433,6 @@ ] } }, - "/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/CreateExpenseDto" - } - } - } - }, - "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/CreateExpenseDto" - } - } - } - } - }, - "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/CreateExpenseDto" - } - } - } - }, - "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/CreateExpenseDto" - } - } - } - }, - "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/CreateExpenseDto" - } - } - } - }, - "400": { - "description": "Expense not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Delete expense", - "tags": [ - "Expenses" - ] - } - }, - "/Expenses/approval/{id}": { - "patch": { - "operationId": "ExpensesController_approve", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "security": [ - { - "access-token": [] - } - ], - "tags": [ - "Expenses" - ] - } - }, "/shifts/upsert/{email}/{date}": { "put": { "operationId": "ShiftsController_upsert_by_date", @@ -944,200 +479,6 @@ ] } }, - "/shifts": { - "post": { - "operationId": "ShiftsController_create", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateShiftDto" - } - } - } - }, - "responses": { - "201": { - "description": "Shift created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateShiftDto" - } - } - } - }, - "400": { - "description": "Incomplete task or invalid data" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Create shift", - "tags": [ - "Shifts" - ] - }, - "get": { - "operationId": "ShiftsController_findAll", - "parameters": [], - "responses": { - "201": { - "description": "List of shifts found", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateShiftDto" - } - } - } - } - }, - "400": { - "description": "List of shifts not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find all shifts", - "tags": [ - "Shifts" - ] - } - }, - "/shifts/{id}": { - "get": { - "operationId": "ShiftsController_findOne", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "201": { - "description": "Shift found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateShiftDto" - } - } - } - }, - "400": { - "description": "Shift not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find shift", - "tags": [ - "Shifts" - ] - }, - "patch": { - "operationId": "ShiftsController_update", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateShiftsDto" - } - } - } - }, - "responses": { - "201": { - "description": "Shift updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateShiftDto" - } - } - } - }, - "400": { - "description": "Shift not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Update shift", - "tags": [ - "Shifts" - ] - }, - "delete": { - "operationId": "ShiftsController_remove", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "201": { - "description": "Shift deleted", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateShiftDto" - } - } - } - }, - "400": { - "description": "Shift not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Delete shift", - "tags": [ - "Shifts" - ] - } - }, "/shifts/approval/{id}": { "patch": { "operationId": "ShiftsController_approve", @@ -1289,319 +630,6 @@ ] } }, - "/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" - ] - } - }, - "/customers": { - "post": { - "operationId": "CustomersController_create", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCustomerDto" - } - } - } - }, - "responses": { - "201": { - "description": "Customer created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCustomerDto" - } - } - } - }, - "400": { - "description": "Invalid task or invalid data" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Create customer", - "tags": [ - "Customers" - ] - }, - "get": { - "operationId": "CustomersController_findAll", - "parameters": [], - "responses": { - "201": { - "description": "List of customers found", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateCustomerDto" - } - } - } - } - }, - "400": { - "description": "List of customers not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find all customers", - "tags": [ - "Customers" - ] - } - }, - "/customers/{id}": { - "get": { - "operationId": "CustomersController_findOne", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "201": { - "description": "Customer found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCustomerDto" - } - } - } - }, - "400": { - "description": "Customer not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Find customer", - "tags": [ - "Customers" - ] - }, - "patch": { - "operationId": "CustomersController_update", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateCustomerDto" - } - } - } - }, - "responses": { - "201": { - "description": "Customer updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCustomerDto" - } - } - } - }, - "400": { - "description": "Customer not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Update customer", - "tags": [ - "Customers" - ] - }, - "delete": { - "operationId": "CustomersController_remove", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "responses": { - "201": { - "description": "Customer deleted", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCustomerDto" - } - } - } - }, - "400": { - "description": "Customer not found" - } - }, - "security": [ - { - "access-token": [] - } - ], - "summary": "Delete customer", - "tags": [ - "Customers" - ] - } - }, "/oauth-sessions": { "post": { "operationId": "OauthSessionsController_create", @@ -1796,31 +824,6 @@ ] } }, - "/pay-periods": { - "get": { - "operationId": "PayPeriodsController_findAll", - "parameters": [], - "responses": { - "200": { - "description": "List of pay period found", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PayPeriodDto" - } - } - } - } - } - }, - "summary": "Find all pay period", - "tags": [ - "pay-periods" - ] - } - }, "/pay-periods/current-and-all": { "get": { "operationId": "PayPeriodsController_getCurrentAndAll", @@ -2205,10 +1208,6 @@ "type": "object", "properties": {} }, - "EmployeeProfileItemDto": { - "type": "object", - "properties": {} - }, "UpdateEmployeeDto": { "type": "object", "properties": { @@ -2284,367 +1283,18 @@ "type": "object", "properties": {} }, - "CreateTimesheetDto": { - "type": "object", - "properties": {} - }, "UpsertExpenseDto": { "type": "object", "properties": {} }, - "CreateExpenseDto": { - "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" - }, - "bank_code_id": { - "type": "number", - "example": 7, - "description": "ID number of an bank code (link with bank-codes)" - }, - "date": { - "type": "string", - "example": "3018-10-20T00:00:00.000Z", - "description": "Date where the expense was made" - }, - "amount": { - "type": "number", - "example": 17.82, - "description": "amount in $ for a refund" - }, - "comment": { - "type": "string", - "example": "Spent for mileage between A and B", - "description": "explain`s why the expense was made" - }, - "is_approved": { - "type": "boolean", - "example": "DENIED, APPROUVED, PENDING, etc...", - "description": "validation 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": [ - "id", - "timesheet_id", - "bank_code_id", - "date", - "amount", - "comment", - "is_approved", - "supervisor_comment" - ] - }, - "UpdateExpenseDto": { - "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" - }, - "bank_code_id": { - "type": "number", - "example": 7, - "description": "ID number of an bank code (link with bank-codes)" - }, - "date": { - "type": "string", - "example": "3018-10-20T00:00:00.000Z", - "description": "Date where the expense was made" - }, - "amount": { - "type": "number", - "example": 17.82, - "description": "amount in $ for a refund" - }, - "comment": { - "type": "string", - "example": "Spent for mileage between A and B", - "description": "explain`s why the expense was made" - }, - "is_approved": { - "type": "boolean", - "example": "DENIED, APPROUVED, PENDING, etc...", - "description": "validation 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" - } - } - }, "UpsertShiftDto": { "type": "object", "properties": {} }, - "CreateShiftDto": { - "type": "object", - "properties": { - "id": { - "type": "number", - "example": 1, - "description": "Unique ID of the shift (auto-generated)" - }, - "timesheet_id": { - "type": "number", - "example": 101, - "description": "ID number for a set timesheet" - }, - "bank_code_id": { - "type": "number", - "example": 7, - "description": "ID number of a shift code (link with bank-codes)" - }, - "date": { - "type": "string", - "example": "3018-10-20T00:00:00.000Z", - "description": "Date where the shift takes place" - }, - "start_time": { - "type": "string", - "example": "3018-10-20T08:00:00.000Z", - "description": "Start time of the said shift" - }, - "end_time": { - "type": "string", - "example": "3018-10-20T17:00:00.000Z", - "description": "End time of the said shift" - } - }, - "required": [ - "id", - "timesheet_id", - "bank_code_id", - "date", - "start_time", - "end_time" - ] - }, - "UpdateShiftsDto": { - "type": "object", - "properties": { - "id": { - "type": "number", - "example": 1, - "description": "Unique ID of the shift (auto-generated)" - }, - "timesheet_id": { - "type": "number", - "example": 101, - "description": "ID number for a set timesheet" - }, - "bank_code_id": { - "type": "number", - "example": 7, - "description": "ID number of a shift code (link with bank-codes)" - }, - "date": { - "type": "string", - "example": "3018-10-20T00:00:00.000Z", - "description": "Date where the shift takes place" - }, - "start_time": { - "type": "string", - "example": "3018-10-20T08:00:00.000Z", - "description": "Start time of the said shift" - }, - "end_time": { - "type": "string", - "example": "3018-10-20T17:00:00.000Z", - "description": "End time of the said shift" - } - } - }, "UpsertLeaveRequestDto": { "type": "object", "properties": {} }, - "CreateBankCodeDto": { - "type": "object", - "properties": { - "id": { - "type": "number", - "example": 1, - "description": "Unique ID of a bank-code (auto-generated)", - "readOnly": true - }, - "type": { - "type": "string", - "example": "regular, vacation, emergency, sick, parental, etc", - "description": "Type of codes" - }, - "categorie": { - "type": "string", - "example": "shift, expense, leave", - "description": "categorie of the related code" - }, - "modifier": { - "type": "number", - "example": "0, 0.72, 1, 1.5, 2", - "description": "modifier number to apply to salary" - }, - "bank_code": { - "type": "string", - "example": "G1, G345, G501, G43, G700", - "description": "codes given by the bank" - } - }, - "required": [ - "id", - "type", - "categorie", - "modifier", - "bank_code" - ] - }, - "UpdateBankCodeDto": { - "type": "object", - "properties": { - "id": { - "type": "number", - "example": 1, - "description": "Unique ID of a bank-code (auto-generated)", - "readOnly": true - }, - "type": { - "type": "string", - "example": "regular, vacation, emergency, sick, parental, etc", - "description": "Type of codes" - }, - "categorie": { - "type": "string", - "example": "shift, expense, leave", - "description": "categorie of the related code" - }, - "modifier": { - "type": "number", - "example": "0, 0.72, 1, 1.5, 2", - "description": "modifier number to apply to salary" - }, - "bank_code": { - "type": "string", - "example": "G1, G345, G501, G43, G700", - "description": "codes given by the bank" - } - } - }, - "CreateCustomerDto": { - "type": "object", - "properties": { - "id": { - "type": "number", - "example": 1, - "description": "Unique ID of a customer(primary-key, auto-incremented)" - }, - "user_id": { - "type": "string", - "example": "0e6e2e1f-b157-4c7c-ae3f-999b3e4f914d", - "description": "UUID of the user linked to that customer" - }, - "first_name": { - "type": "string", - "example": "Gandalf", - "description": "Customer`s first name" - }, - "last_name": { - "type": "string", - "example": "TheGray", - "description": "Customer`s last name" - }, - "email": { - "type": "string", - "example": "you_shall_not_pass@middleEarth.com", - "description": "Customer`s email" - }, - "phone_number": { - "type": "string", - "example": "8436637464", - "description": "Customer`s phone number" - }, - "residence": { - "type": "string", - "example": "1 Ringbearer`s way, Mount Doom city, ME, T1R 1N6 ", - "description": "Customer`s residence" - }, - "invoice_id": { - "type": "number", - "example": "4263253", - "description": "Customer`s invoice number" - } - }, - "required": [ - "id", - "user_id", - "first_name", - "last_name", - "email", - "phone_number" - ] - }, - "UpdateCustomerDto": { - "type": "object", - "properties": { - "id": { - "type": "number", - "example": 1, - "description": "Unique ID of a customer(primary-key, auto-incremented)" - }, - "user_id": { - "type": "string", - "example": "0e6e2e1f-b157-4c7c-ae3f-999b3e4f914d", - "description": "UUID of the user linked to that customer" - }, - "first_name": { - "type": "string", - "example": "Gandalf", - "description": "Customer`s first name" - }, - "last_name": { - "type": "string", - "example": "TheGray", - "description": "Customer`s last name" - }, - "email": { - "type": "string", - "example": "you_shall_not_pass@middleEarth.com", - "description": "Customer`s email" - }, - "phone_number": { - "type": "string", - "example": "8436637464", - "description": "Customer`s phone number" - }, - "residence": { - "type": "string", - "example": "1 Ringbearer`s way, Mount Doom city, ME, T1R 1N6 ", - "description": "Customer`s residence" - }, - "invoice_id": { - "type": "number", - "example": "4263253", - "description": "Customer`s invoice number" - } - } - }, "CreateOauthSessionDto": { "type": "object", "properties": { diff --git a/src/modules/bank-codes/controllers/bank-codes.controller.ts b/src/modules/bank-codes/controllers/bank-codes.controller.ts index cb36ee2..678336c 100644 --- a/src/modules/bank-codes/controllers/bank-codes.controller.ts +++ b/src/modules/bank-codes/controllers/bank-codes.controller.ts @@ -7,40 +7,43 @@ import { ApiBadRequestResponse, ApiNotFoundResponse, ApiOperation, ApiResponse } @Controller('bank-codes') export class BankCodesControllers { constructor(private readonly bankCodesService: BankCodesService) {} + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ - @Post() - @ApiOperation({ summary: 'Create a new bank code' }) - @ApiResponse({ status: 201, description: 'Bank code successfully created.' }) - @ApiBadRequestResponse({ description: 'Invalid input data.' }) - create(@Body() dto: CreateBankCodeDto) { - return this.bankCodesService.create(dto); - } + // @Post() + // @ApiOperation({ summary: 'Create a new bank code' }) + // @ApiResponse({ status: 201, description: 'Bank code successfully created.' }) + // @ApiBadRequestResponse({ description: 'Invalid input data.' }) + // create(@Body() dto: CreateBankCodeDto) { + // return this.bankCodesService.create(dto); + // } - @Get() - @ApiOperation({ summary: 'Retrieve all bank codes' }) - @ApiResponse({ status: 200, description: 'List of bank codes.' }) - findAll() { - return this.bankCodesService.findAll(); - } + // @Get() + // @ApiOperation({ summary: 'Retrieve all bank codes' }) + // @ApiResponse({ status: 200, description: 'List of bank codes.' }) + // findAll() { + // return this.bankCodesService.findAll(); + // } - @Get(':id') - @ApiOperation({ summary: 'Retrieve a bank code by its ID' }) - @ApiNotFoundResponse({ description: 'Bank code not found.' }) - findOne(@Param('id', ParseIntPipe) id: number){ - return this.bankCodesService.findOne(id); - } + // @Get(':id') + // @ApiOperation({ summary: 'Retrieve a bank code by its ID' }) + // @ApiNotFoundResponse({ description: 'Bank code not found.' }) + // findOne(@Param('id', ParseIntPipe) id: number){ + // return this.bankCodesService.findOne(id); + // } - @Patch(':id') - @ApiOperation({ summary: 'Update an existing bank code' }) - @ApiNotFoundResponse({ description: 'Bank code not found.' }) - update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateBankCodeDto) { - return this.bankCodesService.update(id, dto) - } + // @Patch(':id') + // @ApiOperation({ summary: 'Update an existing bank code' }) + // @ApiNotFoundResponse({ description: 'Bank code not found.' }) + // update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateBankCodeDto) { + // return this.bankCodesService.update(id, dto) + // } - @Delete(':id') - @ApiOperation({ summary: 'Delete a bank code' }) - @ApiNotFoundResponse({ description: 'Bank code not found.' }) - remove(@Param('id', ParseIntPipe) id: number) { - return this.bankCodesService.remove(id); - } + // @Delete(':id') + // @ApiOperation({ summary: 'Delete a bank code' }) + // @ApiNotFoundResponse({ description: 'Bank code not found.' }) + // remove(@Param('id', ParseIntPipe) id: number) { + // return this.bankCodesService.remove(id); + // } } \ No newline at end of file diff --git a/src/modules/customers/controllers/customers.controller.ts b/src/modules/customers/controllers/customers.controller.ts index 83122d3..aaf4e42 100644 --- a/src/modules/customers/controllers/customers.controller.ts +++ b/src/modules/customers/controllers/customers.controller.ts @@ -14,51 +14,55 @@ import { ApiBearerAuth, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagg export class CustomersController { constructor(private readonly customersService: CustomersService) {} - @Post() - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Create customer' }) - @ApiResponse({ status: 201, description: 'Customer created', type: CreateCustomerDto }) - @ApiResponse({ status: 400, description: 'Invalid task or invalid data' }) - create(@Body() dto: CreateCustomerDto): Promise { - return this.customersService.create(dto); - } + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ + + // @Post() + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Create customer' }) + // @ApiResponse({ status: 201, description: 'Customer created', type: CreateCustomerDto }) + // @ApiResponse({ status: 400, description: 'Invalid task or invalid data' }) + // create(@Body() dto: CreateCustomerDto): Promise { + // return this.customersService.create(dto); + // } - @Get() - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find all customers' }) - @ApiResponse({ status: 201, description: 'List of customers found', type: CreateCustomerDto, isArray: true }) - @ApiResponse({ status: 400, description: 'List of customers not found' }) - findAll(): Promise { - return this.customersService.findAll(); - } + // @Get() + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find all customers' }) + // @ApiResponse({ status: 201, description: 'List of customers found', type: CreateCustomerDto, isArray: true }) + // @ApiResponse({ status: 400, description: 'List of customers not found' }) + // findAll(): Promise { + // return this.customersService.findAll(); + // } - @Get(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find customer' }) - @ApiResponse({ status: 201, description: 'Customer found', type: CreateCustomerDto }) - @ApiResponse({ status: 400, description: 'Customer not found' }) - findOne(@Param('id', ParseIntPipe) id: number): Promise { - return this.customersService.findOne(id); - } + // @Get(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find customer' }) + // @ApiResponse({ status: 201, description: 'Customer found', type: CreateCustomerDto }) + // @ApiResponse({ status: 400, description: 'Customer not found' }) + // findOne(@Param('id', ParseIntPipe) id: number): Promise { + // return this.customersService.findOne(id); + // } - @Patch(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE,RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Update customer' }) - @ApiResponse({ status: 201, description: 'Customer updated', type: CreateCustomerDto }) - @ApiResponse({ status: 400, description: 'Customer not found' }) - update( - @Param('id', ParseIntPipe) id: number, - @Body() dto: UpdateCustomerDto, - ): Promise { - return this.customersService.update(id, dto); - } + // @Patch(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE,RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Update customer' }) + // @ApiResponse({ status: 201, description: 'Customer updated', type: CreateCustomerDto }) + // @ApiResponse({ status: 400, description: 'Customer not found' }) + // update( + // @Param('id', ParseIntPipe) id: number, + // @Body() dto: UpdateCustomerDto, + // ): Promise { + // return this.customersService.update(id, dto); + // } - @Delete(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Delete customer' }) - @ApiResponse({ status: 201, description: 'Customer deleted', type: CreateCustomerDto }) - @ApiResponse({ status: 400, description: 'Customer not found' }) - remove(@Param('id', ParseIntPipe) id: number): Promise{ - return this.customersService.remove(id); - } + // @Delete(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Delete customer' }) + // @ApiResponse({ status: 201, description: 'Customer deleted', type: CreateCustomerDto }) + // @ApiResponse({ status: 400, description: 'Customer not found' }) + // remove(@Param('id', ParseIntPipe) id: number): Promise{ + // return this.customersService.remove(id); + // } } diff --git a/src/modules/employees/controllers/employees.controller.ts b/src/modules/employees/controllers/employees.controller.ts index e46d2cc..b20c78e 100644 --- a/src/modules/employees/controllers/employees.controller.ts +++ b/src/modules/employees/controllers/employees.controller.ts @@ -23,16 +23,7 @@ export class EmployeesController { create(@Body() dto: CreateEmployeeDto): Promise { return this.employeesService.create(dto); } - - @Get() - //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR, RoleEnum.ACCOUNTING) - @ApiOperation({summary: 'Find all employees' }) - @ApiResponse({ status: 200, description: 'List of employees found', type: CreateEmployeeDto, isArray: true }) - @ApiResponse({ status: 400, description: 'List of employees not found' }) - findAll(): Promise { - return this.employeesService.findAll(); - } - + @Get('employee-list') //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR, RoleEnum.ACCOUNTING) @ApiOperation({summary: 'Find all employees with scoped info' }) @@ -42,34 +33,6 @@ export class EmployeesController { return this.employeesService.findListEmployees(); } - @Get(':email') - //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR,RoleEnum.ACCOUNTING ) - @ApiOperation({summary: 'Find employee' }) - @ApiResponse({ status: 200, description: 'Employee found', type: CreateEmployeeDto }) - @ApiResponse({ status: 400, description: 'Employee not found' }) - findOne(@Param('email', ParseIntPipe) email: string): Promise { - return this.employeesService.findOne(email); - } - - @Get('profile/:email') - @ApiOperation({summary: 'Find employee profile' }) - @ApiParam({ name: 'email', type: String, description: 'Identifier of the employee' }) - @ApiResponse({ status: 200, description: 'Employee profile found', type: EmployeeProfileItemDto }) - @ApiResponse({ status: 400, description: 'Employee profile not found' }) - findOneProfile(@Param('email') email: string): Promise { - return this.employeesService.findOneProfile(email); - } - - @Delete(':email') - //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR ) - @ApiOperation({summary: 'Delete employee' }) - @ApiParam({ name: 'email', type: Number, description: 'Email of the employee to delete' }) - @ApiResponse({ status: 204, description: 'Employee deleted' }) - @ApiResponse({ status: 404, description: 'Employee not found' }) - remove(@Param('email', ParseIntPipe) email: string): Promise { - return this.employeesService.remove(email); - } - @Patch(':email') //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) @ApiBearerAuth('access-token') @@ -88,4 +51,47 @@ export class EmployeesController { } return result; } + + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ + + // @Get() + // //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR, RoleEnum.ACCOUNTING) + // @ApiOperation({summary: 'Find all employees' }) + // @ApiResponse({ status: 200, description: 'List of employees found', type: CreateEmployeeDto, isArray: true }) + // @ApiResponse({ status: 400, description: 'List of employees not found' }) + // findAll(): Promise { + // return this.employeesService.findAll(); + // } + + + // @Get(':email') + // //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR,RoleEnum.ACCOUNTING ) + // @ApiOperation({summary: 'Find employee' }) + // @ApiResponse({ status: 200, description: 'Employee found', type: CreateEmployeeDto }) + // @ApiResponse({ status: 400, description: 'Employee not found' }) + // findOne(@Param('email', ParseIntPipe) email: string): Promise { + // return this.employeesService.findOne(email); + // } + + // @Get('profile/:email') + // @ApiOperation({summary: 'Find employee profile' }) + // @ApiParam({ name: 'email', type: String, description: 'Identifier of the employee' }) + // @ApiResponse({ status: 200, description: 'Employee profile found', type: EmployeeProfileItemDto }) + // @ApiResponse({ status: 400, description: 'Employee profile not found' }) + // findOneProfile(@Param('email') email: string): Promise { + // return this.employeesService.findOneProfile(email); + // } + + // @Delete(':email') + // //@RolesAllowed(RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR ) + // @ApiOperation({summary: 'Delete employee' }) + // @ApiParam({ name: 'email', type: Number, description: 'Email of the employee to delete' }) + // @ApiResponse({ status: 204, description: 'Employee deleted' }) + // @ApiResponse({ status: 404, description: 'Employee not found' }) + // remove(@Param('email', ParseIntPipe) email: string): Promise { + // return this.employeesService.remove(email); + // } + } diff --git a/src/modules/expenses/controllers/expenses.controller.ts b/src/modules/expenses/controllers/expenses.controller.ts index 0309397..c352394 100644 --- a/src/modules/expenses/controllers/expenses.controller.ts +++ b/src/modules/expenses/controllers/expenses.controller.ts @@ -30,56 +30,60 @@ export class ExpensesController { return this.command.upsertExpensesByDate(email, date, dto); } - @Post() - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Create expense' }) - @ApiResponse({ status: 201, description: 'Expense created',type: CreateExpenseDto }) - @ApiResponse({ status: 400, description: 'Incomplete task or invalid data' }) - create(@Body() dto: CreateExpenseDto): Promise { - return this.query.create(dto); - } + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ - @Get() - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find all expenses' }) - @ApiResponse({ status: 201, description: 'List of expenses found',type: CreateExpenseDto, isArray: true }) - @ApiResponse({ status: 400, description: 'List of expenses not found' }) - @UsePipes(new ValidationPipe({ transform: true, whitelist: true })) - findAll(@Query() filters: SearchExpensesDto): Promise { - return this.query.findAll(filters); - } + // @Post() + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Create expense' }) + // @ApiResponse({ status: 201, description: 'Expense created',type: CreateExpenseDto }) + // @ApiResponse({ status: 400, description: 'Incomplete task or invalid data' }) + // create(@Body() dto: CreateExpenseDto): Promise { + // return this.query.create(dto); + // } - @Get(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find expense' }) - @ApiResponse({ status: 201, description: 'Expense found',type: CreateExpenseDto }) - @ApiResponse({ status: 400, description: 'Expense not found' }) - findOne(@Param('id', ParseIntPipe) id: number): Promise { - return this.query.findOne(id); - } + // @Get() + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find all expenses' }) + // @ApiResponse({ status: 201, description: 'List of expenses found',type: CreateExpenseDto, isArray: true }) + // @ApiResponse({ status: 400, description: 'List of expenses not found' }) + // @UsePipes(new ValidationPipe({ transform: true, whitelist: true })) + // findAll(@Query() filters: SearchExpensesDto): Promise { + // return this.query.findAll(filters); + // } - @Patch(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Expense shift' }) - @ApiResponse({ status: 201, description: 'Expense updated',type: CreateExpenseDto }) - @ApiResponse({ status: 400, description: 'Expense not found' }) - update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateExpenseDto) { - return this.query.update(id,dto); - } + // @Get(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find expense' }) + // @ApiResponse({ status: 201, description: 'Expense found',type: CreateExpenseDto }) + // @ApiResponse({ status: 400, description: 'Expense not found' }) + // findOne(@Param('id', ParseIntPipe) id: number): Promise { + // return this.query.findOne(id); + // } - @Delete(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Delete expense' }) - @ApiResponse({ status: 201, description: 'Expense deleted',type: CreateExpenseDto }) - @ApiResponse({ status: 400, description: 'Expense not found' }) - remove(@Param('id', ParseIntPipe) id: number): Promise { - return this.query.remove(id); - } + // @Patch(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Expense shift' }) + // @ApiResponse({ status: 201, description: 'Expense updated',type: CreateExpenseDto }) + // @ApiResponse({ status: 400, description: 'Expense not found' }) + // update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateExpenseDto) { + // return this.query.update(id,dto); + // } - @Patch('approval/:id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) - async approve(@Param('id', ParseIntPipe) id: number, @Body('is_approved', ParseBoolPipe) isApproved: boolean) { - return this.command.updateApproval(id, isApproved); - } + // @Delete(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Delete expense' }) + // @ApiResponse({ status: 201, description: 'Expense deleted',type: CreateExpenseDto }) + // @ApiResponse({ status: 400, description: 'Expense not found' }) + // remove(@Param('id', ParseIntPipe) id: number): Promise { + // return this.query.remove(id); + // } + + // @Patch('approval/:id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) + // async approve(@Param('id', ParseIntPipe) id: number, @Body('is_approved', ParseBoolPipe) isApproved: boolean) { + // return this.command.updateApproval(id, isApproved); + // } } \ No newline at end of file diff --git a/src/modules/pay-periods/controllers/pay-periods.controller.ts b/src/modules/pay-periods/controllers/pay-periods.controller.ts index c87c658..c12f810 100644 --- a/src/modules/pay-periods/controllers/pay-periods.controller.ts +++ b/src/modules/pay-periods/controllers/pay-periods.controller.ts @@ -18,13 +18,6 @@ export class PayPeriodsController { private readonly commandService: PayPeriodsCommandService, ) {} - @Get() - @ApiOperation({ summary: 'Find all pay period' }) - @ApiResponse({status: 200,description: 'List of pay period found', type: PayPeriodDto, isArray: true }) - async findAll(): Promise { - return this.queryService.findAll(); - } - @Get('current-and-all') @ApiOperation({summary: 'Return current pay period and the full list'}) @ApiQuery({name: 'date', required:false, example: '2025-08-11', description:'Override for resolving the current period'}) @@ -95,4 +88,16 @@ export class PayPeriodsController { ): Promise { return this.queryService.getOverviewByYearPeriod(year, period_no); } + + + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ + + // @Get() + // @ApiOperation({ summary: 'Find all pay period' }) + // @ApiResponse({status: 200,description: 'List of pay period found', type: PayPeriodDto, isArray: true }) + // async findAll(): Promise { + // return this.queryService.findAll(); + // } } diff --git a/src/modules/shifts/controllers/shifts.controller.ts b/src/modules/shifts/controllers/shifts.controller.ts index 3a261ce..c936026 100644 --- a/src/modules/shifts/controllers/shifts.controller.ts +++ b/src/modules/shifts/controllers/shifts.controller.ts @@ -29,52 +29,6 @@ export class ShiftsController { ) { return this.shiftsCommandService.upsertShiftsByDate(email_param, date_param, payload); } - - @Post() - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Create shift' }) - @ApiResponse({ status: 201, description: 'Shift created',type: CreateShiftDto }) - @ApiResponse({ status: 400, description: 'Incomplete task or invalid data' }) - create(@Body() dto: CreateShiftDto): Promise { - return this.shiftsService.create(dto); - } - - @Get() - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find all shifts' }) - @ApiResponse({ status: 201, description: 'List of shifts found',type: CreateShiftDto, isArray: true }) - @ApiResponse({ status: 400, description: 'List of shifts not found' }) - @UsePipes(new ValidationPipe({ transform: true, whitelist: true })) - findAll(@Query() filters: SearchShiftsDto) { - return this.shiftsService.findAll(filters); - } - - @Get(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find shift' }) - @ApiResponse({ status: 201, description: 'Shift found',type: CreateShiftDto }) - @ApiResponse({ status: 400, description: 'Shift not found' }) - findOne(@Param('id', ParseIntPipe) id: number): Promise { - return this.shiftsService.findOne(id); - } - - @Patch(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Update shift' }) - @ApiResponse({ status: 201, description: 'Shift updated',type: CreateShiftDto }) - @ApiResponse({ status: 400, description: 'Shift not found' }) - update(@Param('id', ParseIntPipe) id: number,@Body() dto: UpdateShiftsDto): Promise { - return this.shiftsService.update(id, dto); - } - - @Delete(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Delete shift' }) - @ApiResponse({ status: 201, description: 'Shift deleted',type: CreateShiftDto }) - @ApiResponse({ status: 400, description: 'Shift not found' }) - remove(@Param('id', ParseIntPipe) id: number): Promise { - return this.shiftsService.remove(id); - } @Patch('approval/:id') //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) @@ -92,7 +46,6 @@ export class ShiftsController { @Header('Content-Disposition', 'attachment; filename="shifts-validation.csv"') async exportCsv(@Query() query: GetShiftsOverviewDto): Promise{ const rows = await this.shiftsService.getSummary(query.period_id); - //CSV Headers const header = [ 'full_name', @@ -123,5 +76,55 @@ export class ShiftsController { return Buffer.from('\uFEFF' + header + body, 'utf8'); } + + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ + + // @Post() + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Create shift' }) + // @ApiResponse({ status: 201, description: 'Shift created',type: CreateShiftDto }) + // @ApiResponse({ status: 400, description: 'Incomplete task or invalid data' }) + // create(@Body() dto: CreateShiftDto): Promise { + // return this.shiftsService.create(dto); + // } + + // @Get() + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find all shifts' }) + // @ApiResponse({ status: 201, description: 'List of shifts found',type: CreateShiftDto, isArray: true }) + // @ApiResponse({ status: 400, description: 'List of shifts not found' }) + // @UsePipes(new ValidationPipe({ transform: true, whitelist: true })) + // findAll(@Query() filters: SearchShiftsDto) { + // return this.shiftsService.findAll(filters); + // } + + // @Get(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find shift' }) + // @ApiResponse({ status: 201, description: 'Shift found',type: CreateShiftDto }) + // @ApiResponse({ status: 400, description: 'Shift not found' }) + // findOne(@Param('id', ParseIntPipe) id: number): Promise { + // return this.shiftsService.findOne(id); + // } + + // @Patch(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Update shift' }) + // @ApiResponse({ status: 201, description: 'Shift updated',type: CreateShiftDto }) + // @ApiResponse({ status: 400, description: 'Shift not found' }) + // update(@Param('id', ParseIntPipe) id: number,@Body() dto: UpdateShiftsDto): Promise { + // return this.shiftsService.update(id, dto); + // } + + // @Delete(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Delete shift' }) + // @ApiResponse({ status: 201, description: 'Shift deleted',type: CreateShiftDto }) + // @ApiResponse({ status: 400, description: 'Shift not found' }) + // remove(@Param('id', ParseIntPipe) id: number): Promise { + // return this.shiftsService.remove(id); + // } } \ No newline at end of file diff --git a/src/modules/timesheets/controllers/timesheets.controller.ts b/src/modules/timesheets/controllers/timesheets.controller.ts index 2dff5b4..b5d2176 100644 --- a/src/modules/timesheets/controllers/timesheets.controller.ts +++ b/src/modules/timesheets/controllers/timesheets.controller.ts @@ -50,27 +50,34 @@ export class TimesheetsController { } - @Get(':id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Find timesheet' }) - @ApiResponse({ status: 201, description: 'Timesheet found', type: CreateTimesheetDto }) - @ApiResponse({ status: 400, description: 'Timesheet not found' }) - findOne(@Param('id', ParseIntPipe) id: number): Promise { - return this.timesheetsQuery.findOne(id); - } + + + //_____________________________________________________________________________________________ + // Deprecated or unused methods + //_____________________________________________________________________________________________ + + // @Patch('approval/:id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) + // async approve(@Param('id', ParseIntPipe) id: number, @Body('is_approved', ParseBoolPipe) isApproved: boolean) { + // return this.timesheetsCommand.updateApproval(id, isApproved); + // } - @Delete(':id') - // @RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) - @ApiOperation({ summary: 'Delete timesheet' }) - @ApiResponse({ status: 201, description: 'Timesheet deleted', type: CreateTimesheetDto }) - @ApiResponse({ status: 400, description: 'Timesheet not found' }) - remove(@Param('id', ParseIntPipe) id: number): Promise { - return this.timesheetsQuery.remove(id); - } + // @Get(':id') + // //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.EMPLOYEE, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Find timesheet' }) + // @ApiResponse({ status: 201, description: 'Timesheet found', type: CreateTimesheetDto }) + // @ApiResponse({ status: 400, description: 'Timesheet not found' }) + // findOne(@Param('id', ParseIntPipe) id: number): Promise { + // return this.timesheetsQuery.findOne(id); + // } + + // @Delete(':id') + // // @RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) + // @ApiOperation({ summary: 'Delete timesheet' }) + // @ApiResponse({ status: 201, description: 'Timesheet deleted', type: CreateTimesheetDto }) + // @ApiResponse({ status: 400, description: 'Timesheet not found' }) + // remove(@Param('id', ParseIntPipe) id: number): Promise { + // return this.timesheetsQuery.remove(id); + // } - @Patch('approval/:id') - //@RolesAllowed(RoleEnum.ACCOUNTING, RoleEnum.ADMIN, RoleEnum.HR, RoleEnum.SUPERVISOR) - async approve(@Param('id', ParseIntPipe) id: number, @Body('is_approved', ParseBoolPipe) isApproved: boolean) { - return this.timesheetsCommand.updateApproval(id, isApproved); - } }