diff --git a/Dockerfile b/Dockerfile index 6918384..d0930a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,13 @@ ENV DATABASE_URL_PROD="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10 ENV DATABASE_URL_STAGING="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db_staging?schema=public" ENV DATABASE_URL_DEV="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db_dev?schema=public" +# this section is for the mariadb connection setup, DEV VARIABLES ****** +#ENV DATABASE_URL_MARIADB= "mysql://matthieu:targo123@10.100.80.100:3306/testgc?schema=public" +#ENV DATABASE_HOST="10.100.80.100" +#ENV DATABASE_USER="matthieu" +#ENV DATABASE_PASSWORD="targo123" +#ENV DATABASE_NAME="testgc" + ENV AUTHENTIK_ISSUER="https://auth.targo.ca/application/o/montargo/" ENV AUTHENTIK_CLIENT_ID="KUmSmvpu2aDDy4JfNwas7XriNFtPcj2Ka2PyLO5v" ENV AUTHENTIK_CLIENT_SECRET="N55BgX1mxT7eiY99LOo5zXr5cKz9FgTsaCA9MdC7D8ZuhOGqozvqtNXVGbpY1eCg2kkYwJeJLP89sQ8R4cYybIJI7EwKijb19bzZQpUPwBosWwG3irUwdTnZOyw8yW5i" diff --git a/package-lock.json b/package-lock.json index 275e2eb..3d97c19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2213,9 +2213,9 @@ } }, "node_modules/@isaacs/brace-expansion": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", - "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz", + "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3167,30 +3167,25 @@ } }, "node_modules/@nestjs/config": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@nestjs/config/-/config-4.0.2.tgz", - "integrity": "sha512-McMW6EXtpc8+CwTUwFdg6h7dYcBUpH5iUILCclAsa+MbCEvC9ZKu4dCHRlJqALuhjLw97pbQu62l4+wRwGeZqA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/config/-/config-4.0.3.tgz", + "integrity": "sha512-FQ3M3Ohqfl+nHAn5tp7++wUQw0f2nAk+SFKe8EpNRnIifPqvfJP6JQxPKtFLMOHbyer4X646prFG4zSRYEssQQ==", + "license": "MIT", "dependencies": { - "dotenv": "16.4.7", - "dotenv-expand": "12.0.1", - "lodash": "4.17.21" + "dotenv": "17.2.3", + "dotenv-expand": "12.0.3", + "lodash": "4.17.23" }, "peerDependencies": { "@nestjs/common": "^10.0.0 || ^11.0.0", "rxjs": "^7.1.0" } }, - "node_modules/@nestjs/config/node_modules/dotenv": { - "version": "16.4.7", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", - "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } + "node_modules/@nestjs/config/node_modules/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "license": "MIT" }, "node_modules/@nestjs/core": { "version": "11.1.7", @@ -3397,15 +3392,15 @@ } }, "node_modules/@nestjs/swagger": { - "version": "11.2.5", - "resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-11.2.5.tgz", - "integrity": "sha512-wCykbEybMqiYcvkyzPW4SbXKcwra9AGdajm0MvFgKR3W+gd1hfeKlo67g/s9QCRc/mqUU4KOE5Qtk7asMeFuiA==", + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-11.2.6.tgz", + "integrity": "sha512-oiXOxMQqDFyv1AKAqFzSo6JPvMEs4uA36Eyz/s2aloZLxUjcLfUMELSLSNQunr61xCPTpwEOShfmO7NIufKXdA==", "license": "MIT", "dependencies": { "@microsoft/tsdoc": "0.16.0", "@nestjs/mapped-types": "2.1.0", "js-yaml": "4.1.1", - "lodash": "4.17.21", + "lodash": "4.17.23", "path-to-regexp": "8.3.0", "swagger-ui-dist": "5.31.0" }, @@ -3429,6 +3424,12 @@ } } }, + "node_modules/@nestjs/swagger/node_modules/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "license": "MIT" + }, "node_modules/@nestjs/testing": { "version": "11.1.7", "resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-11.1.7.tgz", @@ -6996,7 +6997,6 @@ "version": "17.2.3", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -7006,9 +7006,10 @@ } }, "node_modules/dotenv-expand": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-12.0.1.tgz", - "integrity": "sha512-LaKRbou8gt0RNID/9RoI+J2rvXsBRPMV7p+ElHlPhcSARbCPDYcYG2s1TIzAfWv4YSgyY5taidWzzs31lNV3yQ==", + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-12.0.3.tgz", + "integrity": "sha512-uc47g4b+4k/M/SeaW1y4OApx+mtLWl92l5LMPP0GNXctZqELk+YGgOPIIC5elYmUH4OuoK3JLhuRUYegeySiFA==", + "license": "BSD-2-Clause", "dependencies": { "dotenv": "^16.4.5" }, @@ -9767,7 +9768,8 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "devOptional": true }, "node_modules/lodash.defaults": { "version": "4.2.0", diff --git a/src/common/mappers/bank-type-id.mapper.ts b/src/common/mappers/bank-type-id.mapper.ts index 60fc88a..1d757a7 100644 --- a/src/common/mappers/bank-type-id.mapper.ts +++ b/src/common/mappers/bank-type-id.mapper.ts @@ -1,5 +1,5 @@ -import { Injectable, NotFoundException } from "@nestjs/common"; -import { LeaveTypes, Prisma, PrismaClient } from "@prisma/client"; +import { Injectable } from "@nestjs/common"; +import { Prisma, PrismaClient } from "@prisma/client"; import { Result } from "src/common/errors/result-error.factory"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; @@ -10,9 +10,11 @@ export class BankCodesResolver { constructor(private readonly prisma: PrismaPostgresService) { } //find id and modifier by type - readonly findIdAndModifierByType = async (type: string, client?: Tx + readonly findIdAndModifierByType = async ( + type: string, + client?: Tx ): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const bank = await db.bankCodes.findFirst({ where: { type }, select: { id: true, modifier: true }, @@ -25,7 +27,7 @@ export class BankCodesResolver { //finds only id by type readonly findBankCodeIDByType = async (type: string, client?: Tx ): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const bank_code = await db.bankCodes.findFirst({ where: { type }, select: { id: true }, @@ -37,7 +39,7 @@ export class BankCodesResolver { readonly findTypeByBankCodeId = async (bank_code_id: number, client?: Tx ): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const bank_code = await db.bankCodes.findFirst({ where: { id: bank_code_id }, select: { type: true }, diff --git a/src/common/mappers/email-id.mapper.ts b/src/common/mappers/email-id.mapper.ts index 80551ab..a0ac7e7 100644 --- a/src/common/mappers/email-id.mapper.ts +++ b/src/common/mappers/email-id.mapper.ts @@ -13,7 +13,7 @@ export class EmailToIdResolver { // find employee_id using email readonly findIdByEmail = async (email: string, client?: Tx ): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const employee = await db.employees.findFirst({ where: { user: { email } }, select: { id: true }, @@ -25,7 +25,7 @@ export class EmailToIdResolver { // find user_id using email readonly resolveUserIdWithEmail = async (email: string, client?: Tx ): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const user = await db.users.findFirst({ where: { email }, select: { id: true }, diff --git a/src/common/mappers/full-name.mapper.ts b/src/common/mappers/full-name.mapper.ts index 3408592..4010f6e 100644 --- a/src/common/mappers/full-name.mapper.ts +++ b/src/common/mappers/full-name.mapper.ts @@ -7,17 +7,17 @@ type Tx = Prisma.TransactionClient | PrismaClient; @Injectable() export class FullNameResolver { - constructor(private readonly prisma: PrismaPostgresService){} + constructor(private readonly prisma: PrismaPostgresService) { } - readonly resolveFullName = async (employee_id: number, client?: Tx): Promise> =>{ - const db = client ?? this.prisma; + readonly resolveFullName = async (employee_id: number, client?: Tx): Promise> => { + const db = (client ?? this.prisma) as PrismaClient; const employee = await db.employees.findUnique({ where: { id: employee_id }, - select: { user: { select: {first_name: true, last_name: true} } }, + select: { user: { select: { first_name: true, last_name: true } } }, }); - if(!employee) return { success: false, error: `INVALID_EMPLOYEE`} + if (!employee) return { success: false, error: `INVALID_EMPLOYEE` } - const full_name = ( employee.user.first_name + " " + employee.user.last_name ) || " "; - return {success: true, data: full_name }; + const full_name = (employee.user.first_name + " " + employee.user.last_name) || " "; + return { success: true, data: full_name }; } } \ No newline at end of file diff --git a/src/common/mappers/module-access.mapper.ts b/src/common/mappers/module-access.mapper.ts index ffbfe1e..b2732af 100644 --- a/src/common/mappers/module-access.mapper.ts +++ b/src/common/mappers/module-access.mapper.ts @@ -1,5 +1,3 @@ - - export type Modules = | 'timesheets' | 'timesheets_approval' diff --git a/src/common/mappers/shifts-id.mapper.ts b/src/common/mappers/shifts-id.mapper.ts index a24d13a..2c8bf4a 100644 --- a/src/common/mappers/shifts-id.mapper.ts +++ b/src/common/mappers/shifts-id.mapper.ts @@ -19,7 +19,7 @@ export class ShiftIdResolver { readonly findShiftIdByData = async (key: ShiftKey, client?: Tx ): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const shift = await db.shifts.findFirst({ where: { timesheet_id: key.timesheet_id, diff --git a/src/common/mappers/timesheet.mapper.ts b/src/common/mappers/timesheet.mapper.ts index 2592aec..cb8e02d 100644 --- a/src/common/mappers/timesheet.mapper.ts +++ b/src/common/mappers/timesheet.mapper.ts @@ -1,4 +1,4 @@ -import { Injectable, NotFoundException } from "@nestjs/common"; +import { Injectable } from "@nestjs/common"; import { Prisma, PrismaClient } from "@prisma/client"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { EmailToIdResolver } from "./email-id.mapper"; @@ -16,7 +16,7 @@ export class EmployeeTimesheetResolver { ) { } readonly findTimesheetIdByEmail = async (email: string, date: Date, client?: Tx): Promise> => { - const db = client ?? this.prisma; + const db = (client ?? this.prisma) as PrismaClient; const employee_id = await this.emailResolver.findIdByEmail(email); if (!employee_id.success) return { success: false, error: employee_id.error } const start_date = weekStartSunday(date); diff --git a/src/time-and-attendance/domains/services/overtime.service.ts b/src/time-and-attendance/domains/services/overtime.service.ts index f9bf85b..d1fc68a 100644 --- a/src/time-and-attendance/domains/services/overtime.service.ts +++ b/src/time-and-attendance/domains/services/overtime.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { Prisma, PrismaClient } from '@prisma/client'; +import { Prisma, PrismaClient } from 'prisma/generated/postgres/client'; import { getWeekStart, getWeekEnd, computeHours } from 'src/common/utils/date-utils'; import { PrismaPostgresService } from 'prisma/postgres/prisma-postgres.service'; import { DAILY_LIMIT_HOURS, WEEKLY_LIMIT_HOURS } from 'src/common/utils/constants.utils'; @@ -32,7 +32,7 @@ export class OvertimeService { constructor(private prisma: PrismaPostgresService) { } async getWeekOvertimeSummary(timesheet_id: number, date: Date, tx?: Tx): Promise> { - const db = tx ?? this.prisma; + const db = (tx ?? this.prisma) as PrismaClient; const week_start = getWeekStart(date); const week_end = getWeekEnd(week_start); diff --git a/src/time-and-attendance/domains/services/sick-leave.service.ts b/src/time-and-attendance/domains/services/sick-leave.service.ts index c16dc28..6fda8de 100644 --- a/src/time-and-attendance/domains/services/sick-leave.service.ts +++ b/src/time-and-attendance/domains/services/sick-leave.service.ts @@ -1,8 +1,7 @@ -import { getYearStart, roundToQuarterHour } from "src/common/utils/date-utils"; -import { Injectable, Logger } from "@nestjs/common"; +import { Injectable } from "@nestjs/common"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { Result } from "src/common/errors/result-error.factory"; -import { Prisma } from "@prisma/client"; +import { Prisma } from "prisma/generated/postgres/client"; @Injectable() export class SickLeaveService { diff --git a/src/time-and-attendance/domains/services/vacation.service.ts b/src/time-and-attendance/domains/services/vacation.service.ts index dca9ec9..bf87b7c 100644 --- a/src/time-and-attendance/domains/services/vacation.service.ts +++ b/src/time-and-attendance/domains/services/vacation.service.ts @@ -1,4 +1,4 @@ -import { BadRequestException, Injectable, Logger, NotFoundException } from "@nestjs/common"; +import { Injectable } from "@nestjs/common"; import { Result } from "src/common/errors/result-error.factory"; import { EmailToIdResolver } from "src/common/mappers/email-id.mapper"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; diff --git a/src/time-and-attendance/expenses/services/expense-update.service.ts b/src/time-and-attendance/expenses/services/expense-update.service.ts index 0346bd3..727d0e3 100644 --- a/src/time-and-attendance/expenses/services/expense-update.service.ts +++ b/src/time-and-attendance/expenses/services/expense-update.service.ts @@ -6,7 +6,6 @@ import { Injectable } from "@nestjs/common"; import { Result } from "src/common/errors/result-error.factory"; import { BankCodesResolver } from "src/common/mappers/bank-type-id.mapper"; import { ExpenseDto } from "src/time-and-attendance/expenses/expense-create.dto"; -import { Prisma } from "@prisma/client"; import { normalizeAndParseExpenseDto } from "src/time-and-attendance/expenses/expense.utils"; import { PayPeriodEventService } from "src/time-and-attendance/pay-period/services/pay-period-event.service"; @@ -43,7 +42,7 @@ export class ExpenseUpdateService { if (!timesheet) return { success: false, error: `TIMESHEET_NOT_FOUND` } //checks for modifications - const data: Prisma.ExpensesUpdateInput = { + const data = { ...normed_expense.data, bank_code: { connect: { id: type.data } }, is_approved: dto.is_approved, diff --git a/src/time-and-attendance/exports/csv-exports.controller.ts b/src/time-and-attendance/exports/csv-exports.controller.ts index cb80e8f..b8eb151 100644 --- a/src/time-and-attendance/exports/csv-exports.controller.ts +++ b/src/time-and-attendance/exports/csv-exports.controller.ts @@ -1,7 +1,7 @@ import { Controller, Get, Param, Query, Res } from "@nestjs/common"; import { CsvExportService } from "./services/csv-exports.service"; import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators"; -import { Modules as ModulesEnum } from ".prisma/client"; +import { Modules as ModulesEnum } from "prisma/generated/postgres/client"; import { Response } from "express"; import { CsvGeneratorService } from "src/time-and-attendance/exports/services/csv-builder.service"; diff --git a/src/time-and-attendance/leave-requests/leave-request.dto.ts b/src/time-and-attendance/leave-requests/leave-request.dto.ts index 769a19d..2ae4e8d 100644 --- a/src/time-and-attendance/leave-requests/leave-request.dto.ts +++ b/src/time-and-attendance/leave-requests/leave-request.dto.ts @@ -1,5 +1,5 @@ import { IsEmail, IsArray, IsOptional, IsString, IsNumber, IsEnum, IsDateString } from "class-validator"; -import { LeaveApprovalStatus, LeaveTypes } from "@prisma/client"; +import { LeaveApprovalStatus, LeaveTypes } from "prisma/generated/postgres/client"; import { Type } from "class-transformer"; //sets wich types to use diff --git a/src/time-and-attendance/leave-requests/leave-requests-archive.mapper.ts b/src/time-and-attendance/leave-requests/leave-requests-archive.mapper.ts index 8d6f67c..fb19218 100644 --- a/src/time-and-attendance/leave-requests/leave-requests-archive.mapper.ts +++ b/src/time-and-attendance/leave-requests/leave-requests-archive.mapper.ts @@ -1,5 +1,5 @@ -import { Prisma } from "@prisma/client"; +import { Prisma } from "prisma/generated/postgres/client"; import { LeaveRequestViewDto } from "src/time-and-attendance/leave-requests/leave-request.dto"; import { LeaveRequestArchiveRow } from "src/time-and-attendance/leave-requests/utils/leave-requests-archive.select"; diff --git a/src/time-and-attendance/leave-requests/utils/leave-request.transform.ts b/src/time-and-attendance/leave-requests/utils/leave-request.transform.ts index daab612..e038e1c 100644 --- a/src/time-and-attendance/leave-requests/utils/leave-request.transform.ts +++ b/src/time-and-attendance/leave-requests/utils/leave-request.transform.ts @@ -1,4 +1,4 @@ -// import { Prisma } from "@prisma/client"; +// import { Prisma } from "prisma/generated/postgres/client"; // import { LeaveRequestViewDto } from "src/time-and-attendance/leave-requests/dtos/leave-request-view.dto"; // import { mapArchiveRowToView } from "src/time-and-attendance/leave-requests/mappers/leave-requests-archive.mapper"; // import { mapRowToView } from "src/time-and-attendance/leave-requests/mappers/leave-requests.mapper"; diff --git a/src/time-and-attendance/leave-requests/utils/leave-request.util.ts b/src/time-and-attendance/leave-requests/utils/leave-request.util.ts index 3f12023..86edeeb 100644 --- a/src/time-and-attendance/leave-requests/utils/leave-request.util.ts +++ b/src/time-and-attendance/leave-requests/utils/leave-request.util.ts @@ -1,7 +1,7 @@ import { BadRequestException, Injectable } from "@nestjs/common"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; -import { LeaveTypes } from "@prisma/client"; +import { LeaveTypes } from "prisma/generated/postgres/client"; import { toDateFromString, toStringFromDate } from "src/common/utils/date-utils"; @Injectable() export class LeaveRequestsUtils { diff --git a/src/time-and-attendance/leave-requests/utils/leave-requests-archive.select.ts b/src/time-and-attendance/leave-requests/utils/leave-requests-archive.select.ts index be06345..43d045e 100644 --- a/src/time-and-attendance/leave-requests/utils/leave-requests-archive.select.ts +++ b/src/time-and-attendance/leave-requests/utils/leave-requests-archive.select.ts @@ -1,4 +1,4 @@ -import { Prisma } from "@prisma/client"; +import { Prisma } from "prisma/generated/postgres/client"; export const leaveRequestsArchiveSelect = { id: true, diff --git a/src/time-and-attendance/pay-period/pay-periods.controller.ts b/src/time-and-attendance/pay-period/pay-periods.controller.ts index b8b7dab..8604c38 100644 --- a/src/time-and-attendance/pay-period/pay-periods.controller.ts +++ b/src/time-and-attendance/pay-period/pay-periods.controller.ts @@ -4,7 +4,7 @@ import { PayPeriodsQueryService } from "./services/pay-periods-query.service"; import { PayPeriodsCommandService } from "./services/pay-periods-command.service"; import { Result } from "src/common/errors/result-error.factory"; import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators"; -import { Modules as ModulesEnum } from ".prisma/client"; +import { Modules as ModulesEnum } from "prisma/generated/postgres/client"; import { GetOverviewService } from "src/time-and-attendance/pay-period/services/pay-periods-build-overview.service"; import { map, Observable } from "rxjs"; import { PayPeriodEventService } from "src/time-and-attendance/pay-period/services/pay-period-event.service"; diff --git a/src/time-and-attendance/pay-period/pay-periods.mapper.ts b/src/time-and-attendance/pay-period/pay-periods.mapper.ts index 4403ad1..035b924 100644 --- a/src/time-and-attendance/pay-period/pay-periods.mapper.ts +++ b/src/time-and-attendance/pay-period/pay-periods.mapper.ts @@ -1,4 +1,4 @@ -import { PayPeriods } from "@prisma/client"; +import { PayPeriods } from "prisma/generated/postgres/client"; import { PayPeriodDto } from "src/time-and-attendance/pay-period/dtos/overview-pay-period.dto"; const toDateString = (date: Date) => date.toISOString().slice(0, 10); // "YYYY-MM-DD" diff --git a/src/time-and-attendance/pay-period/services/pay-periods-build-overview.service.ts b/src/time-and-attendance/pay-period/services/pay-periods-build-overview.service.ts index e4bd5a5..dfd7f18 100644 --- a/src/time-and-attendance/pay-period/services/pay-periods-build-overview.service.ts +++ b/src/time-and-attendance/pay-period/services/pay-periods-build-overview.service.ts @@ -1,7 +1,6 @@ import { Injectable } from "@nestjs/common"; -import { Prisma } from "@prisma/client"; import { Result } from "src/common/errors/result-error.factory"; -import { computeHours, computePeriod, sevenDaysFrom, toDateFromString, toStringFromDate } from "src/common/utils/date-utils"; +import { computeHours, computePeriod, toDateFromString, toStringFromDate } from "src/common/utils/date-utils"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { EmployeePeriodOverviewDto, Overview, PayPeriodOverviewDto } from "src/time-and-attendance/pay-period/dtos/overview-pay-period.dto"; diff --git a/src/time-and-attendance/pay-period/services/pay-periods-command.service.ts b/src/time-and-attendance/pay-period/services/pay-periods-command.service.ts index ebdadb1..a849de6 100644 --- a/src/time-and-attendance/pay-period/services/pay-periods-command.service.ts +++ b/src/time-and-attendance/pay-period/services/pay-periods-command.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@nestjs/common"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { Result } from "src/common/errors/result-error.factory"; import { EmailToIdResolver } from "src/common/mappers/email-id.mapper"; -import { Prisma } from "@prisma/client"; +import { Prisma } from "prisma/generated/postgres/client"; //change promise to return result pattern diff --git a/src/time-and-attendance/schedule-presets/schedule-presets.controller.ts b/src/time-and-attendance/schedule-presets/schedule-presets.controller.ts index c699679..5cef351 100644 --- a/src/time-and-attendance/schedule-presets/schedule-presets.controller.ts +++ b/src/time-and-attendance/schedule-presets/schedule-presets.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Param, Body, Get, Post, ParseIntPipe, Delete, Patch } from "@nestjs/common"; +import { Controller, Param, Body, Get, Post, Delete, Patch } from "@nestjs/common"; import { SchedulePresetsCreateService } from "src/time-and-attendance/schedule-presets/services/schedule-presets-create.service"; import { SchedulePresetUpdateService } from "src/time-and-attendance/schedule-presets/services/schedule-presets-update.service"; @@ -7,7 +7,7 @@ import { SchedulePresetsGetService } from "src/time-and-attendance/schedule-pres import { SchedulePresetsDto } from "src/time-and-attendance/schedule-presets/schedule-presets.dto"; import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators"; -import { Modules as ModulesEnum } from ".prisma/client"; +import { Modules as ModulesEnum } from "prisma/generated/postgres/client"; import { Access } from "src/common/decorators/module-access.decorators"; import { SchedulePresetsApplyService } from "src/time-and-attendance/schedule-presets/services/schedule-presets-apply.service"; diff --git a/src/time-and-attendance/schedule-presets/schedule-presets.dto.ts b/src/time-and-attendance/schedule-presets/schedule-presets.dto.ts index 0f36838..cac6a4e 100644 --- a/src/time-and-attendance/schedule-presets/schedule-presets.dto.ts +++ b/src/time-and-attendance/schedule-presets/schedule-presets.dto.ts @@ -1,5 +1,5 @@ -import { Weekday } from "@prisma/client"; -import { ArrayMinSize, IsArray, IsBoolean, IsEnum, IsInt, IsOptional, IsString, Matches, Min } from "class-validator"; +import { Weekday } from "prisma/generated/postgres/client"; +import { ArrayMinSize, IsArray, IsBoolean, IsEnum, IsInt, IsOptional, IsString, Matches} from "class-validator"; import { HH_MM_REGEX } from "src/common/utils/constants.utils"; export class SchedulePresetsDto { diff --git a/src/time-and-attendance/schedule-presets/services/schedule-presets-apply.service.ts b/src/time-and-attendance/schedule-presets/services/schedule-presets-apply.service.ts index 3f9f0f1..0beacbb 100644 --- a/src/time-and-attendance/schedule-presets/services/schedule-presets-apply.service.ts +++ b/src/time-and-attendance/schedule-presets/services/schedule-presets-apply.service.ts @@ -1,7 +1,7 @@ import { Injectable } from "@nestjs/common"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; -import { is_same_week_day, sevenDaysFrom, toDateFromString, toStringFromDate, toStringFromHHmm } from "src/common/utils/date-utils"; +import { sevenDaysFrom, toDateFromString, toStringFromDate, toStringFromHHmm } from "src/common/utils/date-utils"; import { BankCodesResolver } from "src/common/mappers/bank-type-id.mapper"; import { EmailToIdResolver } from "src/common/mappers/email-id.mapper"; import { Result } from "src/common/errors/result-error.factory"; @@ -10,7 +10,7 @@ import { ShiftsCreateService } from "src/time-and-attendance/shifts/services/shi import { timesheet_select } from "src/time-and-attendance/utils/selects.utils"; import { ShiftDto } from "src/time-and-attendance/shifts/shift.dto"; import { WEEKDAY_MAP } from "src/time-and-attendance/schedule-presets/schedule-presets.dto"; -import { $Enums, Prisma, SchedulePresetShifts } from "@prisma/client"; +import { $Enums, SchedulePresetShifts } from "prisma/generated/postgres/client"; import { PayPeriodEventService } from "src/time-and-attendance/pay-period/services/pay-period-event.service"; diff --git a/src/time-and-attendance/shifts/services/shifts-create.service.ts b/src/time-and-attendance/shifts/services/shifts-create.service.ts index 5870cde..b35a460 100644 --- a/src/time-and-attendance/shifts/services/shifts-create.service.ts +++ b/src/time-and-attendance/shifts/services/shifts-create.service.ts @@ -12,7 +12,6 @@ import { BankedHoursService } from "src/time-and-attendance/domains/services/ban import { SickLeaveService } from "src/time-and-attendance/domains/services/sick-leave.service"; import { paid_time_off_types } from "src/time-and-attendance/paid-time-off/paid-time-off.dto"; import { PayPeriodEventService } from "src/time-and-attendance/pay-period/services/pay-period-event.service"; -import { Modules } from "@prisma/client"; @Injectable() export class ShiftsCreateService { diff --git a/src/time-and-attendance/shifts/services/shifts-delete.service.ts b/src/time-and-attendance/shifts/services/shifts-delete.service.ts index af21c28..bd2c568 100644 --- a/src/time-and-attendance/shifts/services/shifts-delete.service.ts +++ b/src/time-and-attendance/shifts/services/shifts-delete.service.ts @@ -1,7 +1,6 @@ import { Injectable } from "@nestjs/common"; import { Result } from "src/common/errors/result-error.factory"; import { EmailToIdResolver } from "src/common/mappers/email-id.mapper"; -import { computeHours } from "src/common/utils/date-utils"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { PaidTimeOFfBankHoursService } from "src/time-and-attendance/paid-time-off/paid-time-off.service"; import { PayPeriodEventService } from "src/time-and-attendance/pay-period/services/pay-period-event.service"; diff --git a/src/time-and-attendance/shifts/shift.controller.ts b/src/time-and-attendance/shifts/shift.controller.ts index dc0ff25..528128b 100644 --- a/src/time-and-attendance/shifts/shift.controller.ts +++ b/src/time-and-attendance/shifts/shift.controller.ts @@ -1,5 +1,5 @@ import { Body, Controller, Delete, Param, Patch, Post } from "@nestjs/common"; -import { Modules as ModulesEnum } from ".prisma/client"; +import { Modules as ModulesEnum } from "prisma/generated/postgres/client"; import { ShiftDto } from "src/time-and-attendance/shifts/shift.dto"; import { ShiftsCreateService } from "src/time-and-attendance/shifts/services/shifts-create.service"; diff --git a/src/time-and-attendance/timesheets/services/timesheet-approval.service.ts b/src/time-and-attendance/timesheets/services/timesheet-approval.service.ts index 5170b5e..cd8b8cd 100644 --- a/src/time-and-attendance/timesheets/services/timesheet-approval.service.ts +++ b/src/time-and-attendance/timesheets/services/timesheet-approval.service.ts @@ -1,8 +1,8 @@ import { BaseApprovalService } from "src/common/shared/base-approval.service"; -import { Prisma, Timesheets } from "@prisma/client"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { Injectable, NotFoundException } from "@nestjs/common"; import { timesheet_select } from "src/time-and-attendance/utils/selects.utils"; +import { Prisma, Timesheets } from "prisma/generated/postgres/client"; @Injectable() export class TimesheetApprovalService extends BaseApprovalService{ diff --git a/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts b/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts index 746d2cf..8d958ac 100644 --- a/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts +++ b/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts @@ -3,10 +3,9 @@ import { NUMBER_OF_TIMESHEETS_TO_RETURN } from "src/common/utils/constants.utils import { Injectable } from "@nestjs/common"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; import { EmailToIdResolver } from "src/common/mappers/email-id.mapper"; -import { Timesheet, Timesheets } from "src/time-and-attendance/timesheets/timesheet.dto"; +import { Timesheets } from "src/time-and-attendance/timesheets/timesheet.dto"; import { Result } from "src/common/errors/result-error.factory"; -import { Prisma } from "@prisma/client"; -import { toDateFromString, sevenDaysFrom, toStringFromDate, toHHmmFromDate } from "src/common/utils/date-utils"; +import { toDateFromString } from "src/common/utils/date-utils"; import { mapOneTimesheet } from "src/time-and-attendance/timesheets/timesheet.mapper"; @Injectable() diff --git a/src/time-and-attendance/timesheets/timesheet.controller.ts b/src/time-and-attendance/timesheets/timesheet.controller.ts index 9496775..6d6ebb3 100644 --- a/src/time-and-attendance/timesheets/timesheet.controller.ts +++ b/src/time-and-attendance/timesheets/timesheet.controller.ts @@ -1,8 +1,8 @@ -import { Body, Controller, Get, Param, ParseBoolPipe, ParseIntPipe, Patch, Query, Req, UnauthorizedException } from "@nestjs/common"; +import { Body, Controller, Get, Param, ParseBoolPipe, ParseIntPipe, Patch, Query } from "@nestjs/common"; import { GetTimesheetsOverviewService } from "src/time-and-attendance/timesheets/services/timesheet-employee-overview.service"; import { TimesheetApprovalService } from "src/time-and-attendance/timesheets/services/timesheet-approval.service"; import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators"; -import { Modules as ModulesEnum } from ".prisma/client"; +import { Modules as ModulesEnum } from "prisma/generated/postgres/client"; import { Access } from "src/common/decorators/module-access.decorators"; diff --git a/src/time-and-attendance/timesheets/timesheet.mapper.ts b/src/time-and-attendance/timesheets/timesheet.mapper.ts index 217aa57..b2463e3 100644 --- a/src/time-and-attendance/timesheets/timesheet.mapper.ts +++ b/src/time-and-attendance/timesheets/timesheet.mapper.ts @@ -1,4 +1,4 @@ -import { Prisma } from "@prisma/client"; +import { Prisma } from "prisma/generated/postgres/client"; import { toDateFromString, sevenDaysFrom, toStringFromDate, toHHmmFromDate } from "src/common/utils/date-utils"; import { Timesheet } from "src/time-and-attendance/timesheets/timesheet.dto"; diff --git a/src/time-and-attendance/utils/selects.utils.ts b/src/time-and-attendance/utils/selects.utils.ts index eec4c0b..054204f 100644 --- a/src/time-and-attendance/utils/selects.utils.ts +++ b/src/time-and-attendance/utils/selects.utils.ts @@ -1,4 +1,4 @@ -import { Prisma } from "@prisma/client"; +import { Prisma } from "prisma/generated/postgres/client"; export const expense_select = { id: true, diff --git a/src/time-and-attendance/utils/type.utils.ts b/src/time-and-attendance/utils/type.utils.ts index f801018..32fad32 100644 --- a/src/time-and-attendance/utils/type.utils.ts +++ b/src/time-and-attendance/utils/type.utils.ts @@ -1,4 +1,4 @@ -import { LeaveTypes, Prisma } from "@prisma/client"; +import { LeaveTypes, Prisma } from "prisma/generated/postgres/client"; export type Normalized = { date: Date; diff --git a/tsconfig.json b/tsconfig.json index e387bd3..d75f161 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,6 @@ "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "strictBindCallApply": false, - "noFallthroughCasesInSwitch": false + "noFallthroughCasesInSwitch": false, } -} +} \ No newline at end of file