diff --git a/docs/swagger/swagger-spec.json b/docs/swagger/swagger-spec.json index 21ed5df..4033b53 100644 --- a/docs/swagger/swagger-spec.json +++ b/docs/swagger/swagger-spec.json @@ -1,20 +1,6 @@ { "openapi": "3.0.0", "paths": { - "/health": { - "get": { - "operationId": "HealthController_check", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Health" - ] - } - }, "/auth/v1/login": { "get": { "operationId": "AuthController_login", diff --git a/src/app.module.ts b/src/app.module.ts index f2b98e5..b953e41 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -1,8 +1,7 @@ import { BadRequestException, Module, ValidationPipe } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service'; -import { HealthController } from './health/health.controller'; -import { NotificationsModule } from './modules/notifications/notifications.module'; +import { NotificationsModule } from './shared/notifications/notifications.module'; import { PrismaModule } from './prisma/prisma.module'; import { ScheduleModule } from '@nestjs/schedule'; import { ConfigModule } from '@nestjs/config'; @@ -25,7 +24,7 @@ import { PrismaLegacyModule } from 'src/prisma-legacy/prisma.module'; TimeAndAttendanceModule, IdentityAndAccountModule, ], - controllers: [AppController, HealthController], + controllers: [AppController], providers: [ AppService, { diff --git a/src/health/health.controller.spec.ts b/src/health/health.controller.spec.ts deleted file mode 100644 index 0ab9987..0000000 --- a/src/health/health.controller.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { HealthController } from './health.controller'; - -describe('HealthController', () => { - let controller: HealthController; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [HealthController], - }).compile(); - - controller = module.get(HealthController); - }); - - it('should be defined', () => { - expect(controller).toBeDefined(); - }); -}); diff --git a/src/health/health.controller.ts b/src/health/health.controller.ts deleted file mode 100644 index 0718382..0000000 --- a/src/health/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; -import { PrismaService } from '../prisma/prisma.service'; - -@Controller('health') -export class HealthController { - constructor(private readonly prisma: PrismaService) {} - - @Get() - async check(): Promise<{ status: string }> { - await this.prisma.$queryRaw`SELECT 1`; - return { status: 'ok' }; - } -} diff --git a/src/health/health.module.ts b/src/health/health.module.ts deleted file mode 100644 index 3f7f985..0000000 --- a/src/health/health.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from '@nestjs/common'; -import { HealthController } from './health.controller'; -import { PrismaModule } from '../prisma/prisma.module'; - -@Module({ - imports: [PrismaModule], - controllers: [HealthController], -}) -export class HealthModule {} diff --git a/src/identity-and-account/employees/services/employees-get.service.ts b/src/identity-and-account/employees/services/employees-get.service.ts index 43bf924..d1fe056 100644 --- a/src/identity-and-account/employees/services/employees-get.service.ts +++ b/src/identity-and-account/employees/services/employees-get.service.ts @@ -181,7 +181,7 @@ export class EmployeesGetService { employee_full_name: `${employee.user.first_name} ${employee.user.last_name}`, first_work_day: toStringFromDate(employee.first_work_day), last_work_day: employee.last_work_day ? toStringFromDate(employee.last_work_day) : undefined, - supervisor_full_name: employee.supervisor ? `${employee.supervisor?.user.first_name}, ${employee.supervisor?.user.last_name}` : '', + supervisor_full_name: employee.supervisor ? `${employee.supervisor?.user.first_name} ${employee.supervisor?.user.last_name}` : '', user_module_access: module_access_array }, }; diff --git a/src/main.ts b/src/main.ts index 08c7c78..f00dffd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,9 +3,9 @@ import * as nodeCrypto from 'crypto'; if (!(globalThis as any).crypto) { (globalThis as any).crypto = nodeCrypto; } -import { ensureAttachmentsTmpDir } from './config/attachment.fs'; -import { resolveAttachmentsRoot } from './config/attachment.config';// log to be removed post dev -import { ATT_TMP_DIR } from './config/attachment.config'; // log to be removed post dev +import { ensureAttachmentsTmpDir } from './time-and-attendance/attachments/config/attachment.fs'; +import { resolveAttachmentsRoot } from './time-and-attendance/attachments/config/attachment.config';// log to be removed post dev +import { ATT_TMP_DIR } from './time-and-attendance/attachments/config/attachment.config'; // log to be removed post dev import { NestFactory, Reflector } from '@nestjs/core'; import { AppModule } from './app.module'; // import { JwtAuthGuard } from './modules/authentication/guards/jwt-auth.guard'; diff --git a/src/modules/archival/services/archival.service.ts b/src/modules/archival/archival.service.ts similarity index 100% rename from src/modules/archival/services/archival.service.ts rename to src/modules/archival/archival.service.ts diff --git a/src/modules/notifications/constants/notification.constants.ts b/src/shared/notifications/notification.constants.ts similarity index 100% rename from src/modules/notifications/constants/notification.constants.ts rename to src/shared/notifications/notification.constants.ts diff --git a/src/modules/notifications/dtos/notification.types.ts b/src/shared/notifications/notification.types.ts similarity index 100% rename from src/modules/notifications/dtos/notification.types.ts rename to src/shared/notifications/notification.types.ts diff --git a/src/modules/notifications/controllers/notifications.controller.ts b/src/shared/notifications/notifications.controller.ts similarity index 100% rename from src/modules/notifications/controllers/notifications.controller.ts rename to src/shared/notifications/notifications.controller.ts diff --git a/src/modules/notifications/notifications.module.ts b/src/shared/notifications/notifications.module.ts similarity index 79% rename from src/modules/notifications/notifications.module.ts rename to src/shared/notifications/notifications.module.ts index 787a023..a45eb11 100644 --- a/src/modules/notifications/notifications.module.ts +++ b/src/shared/notifications/notifications.module.ts @@ -1,6 +1,6 @@ import { Module } from "@nestjs/common"; import { NotificationsController } from "./controllers/notifications.controller"; -import { NotificationsService } from "./services/notifications.service"; +import { NotificationsService } from "./notifications.service"; @Module({ providers: [NotificationsService], controllers: [NotificationsController], diff --git a/src/modules/notifications/services/notifications.service.ts b/src/shared/notifications/notifications.service.ts similarity index 96% rename from src/modules/notifications/services/notifications.service.ts rename to src/shared/notifications/notifications.service.ts index 8677766..f45cf34 100644 --- a/src/modules/notifications/services/notifications.service.ts +++ b/src/shared/notifications/notifications.service.ts @@ -1,6 +1,6 @@ import { Injectable, Logger } from "@nestjs/common"; import { Subject } from "rxjs"; -import { NotificationCard } from "../dtos/notification.types"; +import { NotificationCard } from "./notification.types"; @Injectable() export class NotificationsService { diff --git a/src/modules/attachments/controllers/attachments.controller.ts b/src/time-and-attendance/attachments/attachments.controller.ts similarity index 70% rename from src/modules/attachments/controllers/attachments.controller.ts rename to src/time-and-attendance/attachments/attachments.controller.ts index 70d97b7..6e89e85 100644 --- a/src/modules/attachments/controllers/attachments.controller.ts +++ b/src/time-and-attendance/attachments/attachments.controller.ts @@ -1,13 +1,14 @@ import { Controller, UseInterceptors, Post, Get, Param, Res, UploadedFile, Body, Delete, Query } from "@nestjs/common"; import { FileInterceptor } from "@nestjs/platform-express"; -import { AttachmentDeleteService } from "src/modules/attachments/services/attachment-delete.service"; -import { AttachmentUploadService } from "src/modules/attachments/services/attachment-upload.service"; -import { AttachmentGetService } from "src/modules/attachments/services/attachment-get.service"; -import { UploadMetaAttachmentsDto } from "../dtos/upload-meta-attachments.dto"; -import { AdminSearchDto } from "../dtos/search-filters.dto"; -import { maxUploadBytes } from "../config/upload.config"; + import { memoryStorage } from 'multer'; import { Response } from 'express'; +import { AdminSearchDto } from "src/time-and-attendance/attachments/dtos/search-filters.dto"; +import { UploadMetaAttachmentsDto } from "src/time-and-attendance/attachments/dtos/upload-meta-attachments.dto"; +import { maxUploadBytes } from "src/time-and-attendance/attachments/upload.config"; +import { AttachmentDeleteService } from "src/time-and-attendance/attachments/services/attachment-delete.service"; +import { AttachmentGetService } from "src/time-and-attendance/attachments/services/attachment-get.service"; +import { AttachmentUploadService } from "src/time-and-attendance/attachments/services/attachment-upload.service"; @Controller('attachments') export class AttachmentsController { diff --git a/src/modules/attachments/attachments.module.ts b/src/time-and-attendance/attachments/attachments.module.ts similarity index 100% rename from src/modules/attachments/attachments.module.ts rename to src/time-and-attendance/attachments/attachments.module.ts diff --git a/src/modules/attachments/utils/cas.util.ts b/src/time-and-attendance/attachments/cas.util.ts similarity index 100% rename from src/modules/attachments/utils/cas.util.ts rename to src/time-and-attendance/attachments/cas.util.ts diff --git a/src/config/attachment.config.ts b/src/time-and-attendance/attachments/config/attachment.config.ts similarity index 100% rename from src/config/attachment.config.ts rename to src/time-and-attendance/attachments/config/attachment.config.ts diff --git a/src/config/attachment.fs.ts b/src/time-and-attendance/attachments/config/attachment.fs.ts similarity index 100% rename from src/config/attachment.fs.ts rename to src/time-and-attendance/attachments/config/attachment.fs.ts diff --git a/src/config/attachment.provider.ts b/src/time-and-attendance/attachments/config/attachment.provider.ts similarity index 100% rename from src/config/attachment.provider.ts rename to src/time-and-attendance/attachments/config/attachment.provider.ts diff --git a/src/config/config.module.ts b/src/time-and-attendance/attachments/config/config.module.ts similarity index 100% rename from src/config/config.module.ts rename to src/time-and-attendance/attachments/config/config.module.ts diff --git a/src/modules/attachments/dtos/search-filters.dto.ts b/src/time-and-attendance/attachments/dtos/search-filters.dto.ts similarity index 100% rename from src/modules/attachments/dtos/search-filters.dto.ts rename to src/time-and-attendance/attachments/dtos/search-filters.dto.ts diff --git a/src/modules/attachments/dtos/upload-meta-attachments.dto.ts b/src/time-and-attendance/attachments/dtos/upload-meta-attachments.dto.ts similarity index 100% rename from src/modules/attachments/dtos/upload-meta-attachments.dto.ts rename to src/time-and-attendance/attachments/dtos/upload-meta-attachments.dto.ts diff --git a/src/modules/attachments/services/attachment-archival.service.ts b/src/time-and-attendance/attachments/services/attachment-archival.service.ts similarity index 96% rename from src/modules/attachments/services/attachment-archival.service.ts rename to src/time-and-attendance/attachments/services/attachment-archival.service.ts index 4f3f3fb..83bc099 100644 --- a/src/modules/attachments/services/attachment-archival.service.ts +++ b/src/time-and-attendance/attachments/services/attachment-archival.service.ts @@ -1,6 +1,6 @@ import { Injectable } from "@nestjs/common"; import { Cron } from "@nestjs/schedule"; -import { startOfYear } from "src/modules/attachments/utils/cas.util"; +import { startOfYear } from "src/time-and-attendance/attachments/cas.util"; import { PrismaService } from "src/prisma/prisma.service"; @Injectable() diff --git a/src/modules/attachments/services/attachment-delete.service.ts b/src/time-and-attendance/attachments/services/attachment-delete.service.ts similarity index 100% rename from src/modules/attachments/services/attachment-delete.service.ts rename to src/time-and-attendance/attachments/services/attachment-delete.service.ts diff --git a/src/modules/attachments/services/attachment-get.service.ts b/src/time-and-attendance/attachments/services/attachment-get.service.ts similarity index 95% rename from src/modules/attachments/services/attachment-get.service.ts rename to src/time-and-attendance/attachments/services/attachment-get.service.ts index 7b5efb1..2815a57 100644 --- a/src/modules/attachments/services/attachment-get.service.ts +++ b/src/time-and-attendance/attachments/services/attachment-get.service.ts @@ -1,8 +1,8 @@ import { Injectable } from "@nestjs/common"; import { Response } from "express"; -import { AdminSearchDto } from "src/modules/attachments/dtos/search-filters.dto"; +import { AdminSearchDto } from "src/time-and-attendance/attachments/dtos/search-filters.dto"; import { PrismaService } from "src/prisma/prisma.service"; -import { resolveAttachmentsRoot } from "src/config/attachment.config"; +import { resolveAttachmentsRoot } from "src/time-and-attendance/attachments/config/attachment.config"; import * as path from 'node:path'; import { promises as fsp } from 'node:fs'; import { createReadStream } from "node:fs"; diff --git a/src/modules/attachments/services/attachment-upload.service.ts b/src/time-and-attendance/attachments/services/attachment-upload.service.ts similarity index 88% rename from src/modules/attachments/services/attachment-upload.service.ts rename to src/time-and-attendance/attachments/services/attachment-upload.service.ts index fe08ba7..b06b2ad 100644 --- a/src/modules/attachments/services/attachment-upload.service.ts +++ b/src/time-and-attendance/attachments/services/attachment-upload.service.ts @@ -1,12 +1,12 @@ import { Injectable } from "@nestjs/common"; -import { allowedMimes } from "src/modules/attachments/config/upload.config"; -import { UploadMetaAttachmentsDto } from "src/modules/attachments/dtos/upload-meta-attachments.dto"; +import { allowedMimes } from "src/time-and-attendance/attachments/upload.config"; +import { UploadMetaAttachmentsDto } from "src/time-and-attendance/attachments/dtos/upload-meta-attachments.dto"; import { Readable } from "node:stream"; import { PrismaService } from "src/prisma/prisma.service"; import { fileTypeFromBuffer } from "file-type"; -import { DiskStorageService } from "src/modules/attachments/services/disk-storage.service"; -import { VariantsQueue } from "src/modules/attachments/services/variants.queue"; import { Result } from "src/common/errors/result-error.factory"; +import { DiskStorageService } from "src/time-and-attendance/attachments/services/disk-storage.service"; +import { VariantsQueue } from "src/time-and-attendance/attachments/services/variants.queue"; @Injectable() export class AttachmentUploadService { diff --git a/src/modules/attachments/services/disk-storage.service.ts b/src/time-and-attendance/attachments/services/disk-storage.service.ts similarity index 92% rename from src/modules/attachments/services/disk-storage.service.ts rename to src/time-and-attendance/attachments/services/disk-storage.service.ts index 7c05da8..5e8a4cd 100644 --- a/src/modules/attachments/services/disk-storage.service.ts +++ b/src/time-and-attendance/attachments/services/disk-storage.service.ts @@ -4,8 +4,8 @@ import { promises as fsp } from 'node:fs'; import { createWriteStream, statSync, existsSync } from 'node:fs'; import { join, dirname } from 'node:path'; import { pipeline } from 'node:stream/promises'; -import { ATT_TMP_DIR } from 'src/config/attachment.config'; -import { casPathFor, getAbsolutePath } from 'src/modules/attachments/utils/cas.util'; +import { ATT_TMP_DIR } from 'src/time-and-attendance/attachments/config/attachment.config'; +import { casPathFor, getAbsolutePath } from 'src/time-and-attendance/attachments/cas.util'; export type SaveResult = { sha256: string, storage_path: string, size: number }; diff --git a/src/modules/attachments/services/garbage-collector.service.ts b/src/time-and-attendance/attachments/services/garbage-collector.service.ts similarity index 96% rename from src/modules/attachments/services/garbage-collector.service.ts rename to src/time-and-attendance/attachments/services/garbage-collector.service.ts index f019f12..0c814fb 100644 --- a/src/modules/attachments/services/garbage-collector.service.ts +++ b/src/time-and-attendance/attachments/services/garbage-collector.service.ts @@ -3,7 +3,7 @@ import { Cron } from "@nestjs/schedule"; import { PrismaService } from 'src/prisma/prisma.service'; import * as path from 'node:path'; import { promises as fsp } from 'node:fs'; -import { resolveAttachmentsRoot } from "src/config/attachment.config"; +import { resolveAttachmentsRoot } from "src/time-and-attendance/attachments/config/attachment.config"; @Injectable() export class GarbargeCollectorService { diff --git a/src/modules/attachments/services/variants.queue.ts b/src/time-and-attendance/attachments/services/variants.queue.ts similarity index 100% rename from src/modules/attachments/services/variants.queue.ts rename to src/time-and-attendance/attachments/services/variants.queue.ts diff --git a/src/modules/attachments/config/upload.config.ts b/src/time-and-attendance/attachments/upload.config.ts similarity index 100% rename from src/modules/attachments/config/upload.config.ts rename to src/time-and-attendance/attachments/upload.config.ts diff --git a/src/modules/attachments/workers/variants.worker.ts b/src/time-and-attendance/attachments/variants.worker.ts similarity index 95% rename from src/modules/attachments/workers/variants.worker.ts rename to src/time-and-attendance/attachments/variants.worker.ts index de3ceb3..7e8e1ec 100644 --- a/src/modules/attachments/workers/variants.worker.ts +++ b/src/time-and-attendance/attachments/variants.worker.ts @@ -4,7 +4,7 @@ import sharp from 'sharp'; import { PrismaClient } from '@prisma/client'; import * as path from 'node:path'; import { promises as fsp } from 'node:fs'; -import { resolveAttachmentsRoot } from 'src/config/attachment.config'; +import { resolveAttachmentsRoot } from 'src/time-and-attendance/attachments/config/attachment.config'; const prisma = new PrismaClient(); const q_name = `${process.env.BULL_PREFIX || 'attachments'}:variants`; diff --git a/src/modules/bank-codes/dtos/bank-code.dto.ts b/src/time-and-attendance/bank-codes/bank-code.dto.ts similarity index 100% rename from src/modules/bank-codes/dtos/bank-code.dto.ts rename to src/time-and-attendance/bank-codes/bank-code.dto.ts diff --git a/src/modules/bank-codes/controllers/bank-codes.controller.ts b/src/time-and-attendance/bank-codes/bank-codes.controller.ts similarity index 96% rename from src/modules/bank-codes/controllers/bank-codes.controller.ts rename to src/time-and-attendance/bank-codes/bank-codes.controller.ts index 8e0a515..b6d05fd 100644 --- a/src/modules/bank-codes/controllers/bank-codes.controller.ts +++ b/src/time-and-attendance/bank-codes/bank-codes.controller.ts @@ -1,6 +1,6 @@ import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post } from "@nestjs/common"; import { BankCodesService } from "../services/bank-codes.service"; -import { BankCodeDto } from "../dtos/bank-code.dto"; +import { BankCodeDto } from "../bank-code.dto"; import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators"; import { Modules as ModulesEnum } from ".prisma/client"; diff --git a/src/modules/bank-codes/bank-codes.module.ts b/src/time-and-attendance/bank-codes/bank-codes.module.ts similarity index 100% rename from src/modules/bank-codes/bank-codes.module.ts rename to src/time-and-attendance/bank-codes/bank-codes.module.ts diff --git a/src/modules/bank-codes/services/bank-codes.service.ts b/src/time-and-attendance/bank-codes/bank-codes.service.ts similarity index 94% rename from src/modules/bank-codes/services/bank-codes.service.ts rename to src/time-and-attendance/bank-codes/bank-codes.service.ts index b45211d..907fc0a 100644 --- a/src/modules/bank-codes/services/bank-codes.service.ts +++ b/src/time-and-attendance/bank-codes/bank-codes.service.ts @@ -1,7 +1,7 @@ import { Injectable, NotFoundException } from "@nestjs/common"; import { PrismaService } from "src/prisma/prisma.service"; -import { BankCodeDto } from "../dtos/bank-code.dto"; import { BankCodes } from "@prisma/client"; +import { BankCodeDto } from "src/time-and-attendance/bank-codes/bank-code.dto"; @Injectable() export class BankCodesService { diff --git a/src/modules/exports/controllers/csv-exports.controller.ts b/src/time-and-attendance/exports/csv-exports.controller.ts similarity index 90% rename from src/modules/exports/controllers/csv-exports.controller.ts rename to src/time-and-attendance/exports/csv-exports.controller.ts index d39d084..d9a9b0b 100644 --- a/src/modules/exports/controllers/csv-exports.controller.ts +++ b/src/time-and-attendance/exports/csv-exports.controller.ts @@ -1,6 +1,6 @@ import { Controller, Get, Header, Query} from "@nestjs/common"; -import { CsvExportService } from "../services/csv-exports.service"; -import { ExportCsvOptionsDto } from "../dtos/export-csv-options.dto"; +import { CsvExportService } from "./csv-exports.service"; +import { ExportCsvOptionsDto } from "./export-csv-options.dto"; import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators"; import { Modules as ModulesEnum } from ".prisma/client"; diff --git a/src/modules/exports/csv-exports.module.ts b/src/time-and-attendance/exports/csv-exports.module.ts similarity index 53% rename from src/modules/exports/csv-exports.module.ts rename to src/time-and-attendance/exports/csv-exports.module.ts index 92a5a96..51f86c3 100644 --- a/src/modules/exports/csv-exports.module.ts +++ b/src/time-and-attendance/exports/csv-exports.module.ts @@ -1,6 +1,6 @@ import { Module } from "@nestjs/common"; -import { CsvExportController } from "./controllers/csv-exports.controller"; -import { CsvExportService } from "./services/csv-exports.service"; +import { CsvExportController } from "./csv-exports.controller"; +import { CsvExportService } from "./csv-exports.service"; @Module({ providers:[CsvExportService], diff --git a/src/modules/exports/services/csv-exports.service.ts b/src/time-and-attendance/exports/csv-exports.service.ts similarity index 100% rename from src/modules/exports/services/csv-exports.service.ts rename to src/time-and-attendance/exports/csv-exports.service.ts diff --git a/src/modules/exports/dtos/export-csv-options.dto.ts b/src/time-and-attendance/exports/export-csv-options.dto.ts similarity index 100% rename from src/modules/exports/dtos/export-csv-options.dto.ts rename to src/time-and-attendance/exports/export-csv-options.dto.ts diff --git a/src/time-and-attendance/time-and-attendance.module.ts b/src/time-and-attendance/time-and-attendance.module.ts index b3ca9e4..3783142 100644 --- a/src/time-and-attendance/time-and-attendance.module.ts +++ b/src/time-and-attendance/time-and-attendance.module.ts @@ -20,9 +20,9 @@ import { PayPeriodsController } from "src/time-and-attendance/pay-period/pay-per import { PayPeriodsQueryService } from "src/time-and-attendance/pay-period/services/pay-periods-query.service"; import { PayPeriodsCommandService } from "src/time-and-attendance/pay-period/services/pay-periods-command.service"; -import { CsvExportModule } from "src/modules/exports/csv-exports.module"; -import { CsvExportService } from "src/modules/exports/services/csv-exports.service"; -import { CsvExportController } from "src/modules/exports/controllers/csv-exports.controller"; +import { CsvExportModule } from "src/time-and-attendance/exports/csv-exports.module"; +import { CsvExportService } from "src/time-and-attendance/exports/csv-exports.service"; +import { CsvExportController } from "src/time-and-attendance/exports/csv-exports.controller"; import { ShiftController } from "src/time-and-attendance/shifts/shift.controller"; import { ShiftsCreateService } from "src/time-and-attendance/shifts/services/shifts-create.service";