From bba6c84b6fa0e9ef4f5b62816c856bc98372fb24 Mon Sep 17 00:00:00 2001 From: Matthieu Haineault Date: Mon, 20 Oct 2025 08:55:21 -0400 Subject: [PATCH] Merge branch 'main' of git.targo.ca:Targo/targo_backend into dev/matthieu/refactor --- .../shifts/controllers/shift.controller.ts | 13 +++++++++++ src/modules/shifts/dtos/create-shift.dto.ts | 22 +++++++++++++++++++ src/modules/shifts/dtos/get-shift.dto.ts | 14 ++++++++++++ src/modules/shifts/dtos/update-shift.dto.ts | 9 ++++++++ src/modules/shifts/services/shift.service.ts | 9 ++++++++ 5 files changed, 67 insertions(+) create mode 100644 src/modules/shifts/controllers/shift.controller.ts create mode 100644 src/modules/shifts/dtos/create-shift.dto.ts create mode 100644 src/modules/shifts/dtos/get-shift.dto.ts create mode 100644 src/modules/shifts/dtos/update-shift.dto.ts create mode 100644 src/modules/shifts/services/shift.service.ts diff --git a/src/modules/shifts/controllers/shift.controller.ts b/src/modules/shifts/controllers/shift.controller.ts new file mode 100644 index 0000000..c9b1b96 --- /dev/null +++ b/src/modules/shifts/controllers/shift.controller.ts @@ -0,0 +1,13 @@ +//newer version that uses Express session data + +import { Controller } from "@nestjs/common"; +import { ShiftService } from "../services/shift.service"; + + + +@Controller('shifts') +export class ShiftController { + constructor(private readonly service: ShiftService){} + + +} \ No newline at end of file diff --git a/src/modules/shifts/dtos/create-shift.dto.ts b/src/modules/shifts/dtos/create-shift.dto.ts new file mode 100644 index 0000000..ae393c7 --- /dev/null +++ b/src/modules/shifts/dtos/create-shift.dto.ts @@ -0,0 +1,22 @@ +//newer version that uses Express session data + +import { IsBoolean, IsOptional, IsString, MaxLength } from "class-validator"; + +export class createShift { + timesheet_id: number; + bank_code_id: number; + date: string; + start_time: string; + end_time: string; + + @IsBoolean() + is_remote: boolean; + + @IsBoolean() + is_approved: boolean; + + @IsOptional() + @IsString() + @MaxLength(280) + comment?: string; +} \ No newline at end of file diff --git a/src/modules/shifts/dtos/get-shift.dto.ts b/src/modules/shifts/dtos/get-shift.dto.ts new file mode 100644 index 0000000..4e4b17d --- /dev/null +++ b/src/modules/shifts/dtos/get-shift.dto.ts @@ -0,0 +1,14 @@ +//newer version that uses Express session data + +export class getShift { + shift_id?: number; + timesheet_id?: number; + bank_code_id?: number; + date?: string; + start_time?: string; + end_time?: string; + is_remote?: boolean; + is_approved?: boolean; + comment?: string; + +} \ No newline at end of file diff --git a/src/modules/shifts/dtos/update-shift.dto.ts b/src/modules/shifts/dtos/update-shift.dto.ts new file mode 100644 index 0000000..db3e934 --- /dev/null +++ b/src/modules/shifts/dtos/update-shift.dto.ts @@ -0,0 +1,9 @@ +//newer version that uses Express session data + +export class updateShift { + + date!: string; + start_time!: string; + end_time!: string; + +} \ No newline at end of file diff --git a/src/modules/shifts/services/shift.service.ts b/src/modules/shifts/services/shift.service.ts new file mode 100644 index 0000000..3c82b88 --- /dev/null +++ b/src/modules/shifts/services/shift.service.ts @@ -0,0 +1,9 @@ +//newer version that uses Express session data + +import { Injectable } from "@nestjs/common"; +import { PrismaService } from "src/prisma/prisma.service"; + +@Injectable() +export class ShiftService { + constructor(private readonly prisma: PrismaService){} +} \ No newline at end of file