diff --git a/prisma/migrations/20251203192130_added_the_option_of_null_to_is_dark_mode/migration.sql b/prisma/migrations/20251203192130_added_the_option_of_null_to_is_dark_mode/migration.sql new file mode 100644 index 0000000..6bc061e --- /dev/null +++ b/prisma/migrations/20251203192130_added_the_option_of_null_to_is_dark_mode/migration.sql @@ -0,0 +1,5 @@ +-- CreateEnum +CREATE TYPE "modules" AS ENUM ('timesheets', 'timesheets_approval', 'employee_list', 'employee_management', 'personal_profile', 'dashboard'); + +-- AlterTable +ALTER TABLE "preferences" ALTER COLUMN "is_dark_mode" DROP NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 5dc2348..39d9148 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -53,7 +53,7 @@ model Employees { supervisor Employees? @relation("EmployeeSupervisor", fields: [supervisor_id], references: [id]) supervisor_id Int? - external_payroll_id Int @default(autoincrement()) + external_payroll_id Int @default(autoincrement()) company_code Int first_work_day DateTime @db.Date last_work_day DateTime? @db.Date @@ -347,12 +347,12 @@ model Preferences { user Users @relation("UserPreferences", fields: [user_id], references: [id]) user_id String @unique @db.Uuid - notifications Boolean @default(true) + notifications Boolean @default(true) is_dark_mode Boolean? @default(false) - display_language String @default("fr-FR") //'fr-FR' | 'en-CA'; - is_lefty_mode Boolean @default(false) - is_employee_list_grid Boolean @default(true) - is_timesheet_approval_grid Boolean @default(true) + display_language String @default("fr-FR") //'fr-FR' | 'en-CA'; + is_lefty_mode Boolean @default(false) + is_employee_list_grid Boolean @default(true) + is_timesheet_approval_grid Boolean @default(true) @@map("preferences") } diff --git a/src/identity-and-account/preferences/dtos/preferences.dto.ts b/src/identity-and-account/preferences/dtos/preferences.dto.ts index 81a8dd6..e470dad 100644 --- a/src/identity-and-account/preferences/dtos/preferences.dto.ts +++ b/src/identity-and-account/preferences/dtos/preferences.dto.ts @@ -8,7 +8,7 @@ export enum DisplayLanguage { export class PreferencesDto { @IsInt() id: number; @IsBoolean() notifications: boolean; - @IsOptional() @IsBoolean() is_dark_mode?: boolean; + @IsOptional() @IsBoolean() is_dark_mode?: boolean | null; @IsEnum(DisplayLanguage) display_language: string; @IsBoolean() is_lefty_mode: boolean; @IsBoolean() is_employee_list_grid: boolean;