fix(preferences): ajusted schema so is_dark_mode accepts null
This commit is contained in:
parent
4b0189ed48
commit
e4a4e317bc
|
|
@ -348,7 +348,7 @@ model Preferences {
|
|||
user_id String @unique @db.Uuid
|
||||
|
||||
notifications Boolean @default(true)
|
||||
is_dark_mode Boolean @default(false)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export class PreferencesService {
|
|||
where: { user_id: user_id.data },
|
||||
data: {
|
||||
notifications: dto.notifications,
|
||||
is_dark_mode: dto.is_dark_mode ?? undefined,
|
||||
is_dark_mode: dto.is_dark_mode,
|
||||
display_language: dto.display_language,
|
||||
is_lefty_mode: dto.is_lefty_mode,
|
||||
is_employee_list_grid: dto.is_employee_list_grid,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Transform } from "class-transformer";
|
||||
import { IsBoolean, IsInt, IsOptional, Max, Min } from "class-validator";
|
||||
|
||||
function toBoolean(v: any) {
|
||||
const toBoolean = (v: any) => {
|
||||
if(typeof v === 'boolean') return v;
|
||||
if(typeof v === 'string') return ['true', '1', 'on','yes'].includes(v.toLowerCase());
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user