This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/modelSchema/userSettings.ts

29 lines
828 B
TypeScript

import { type TypeOf, boolean, string, undefined, nativeEnum } from 'zod'
import { IdSchema } from './common/id'
import { AbstractSchema } from './abstract'
const WEEKDAYS = {
MONDAY: 0,
TUESDAY: 1,
WEDNESDAY: 2,
THURSDAY: 3,
FRIDAY: 4,
SATURDAY: 5,
SUNDAY: 6,
} as const
export const UserSettingsSchema = AbstractSchema.extend({
name: string().default(''),
emailRemindersEnabled: boolean().default(true),
discoverableByName: boolean().default(false),
discoverableByEmail: boolean().default(false),
overdueTasksRemindersEnabled: boolean().default(true),
defaultListId: IdSchema.or(undefined()), // iListSchema['id'] // FIXME: shouldn't this be `null`?
weekStart: nativeEnum(WEEKDAYS).default(WEEKDAYS.MONDAY),
timezone: string().default(''),
})
export type IUserSettings = TypeOf<typeof UserSettingsSchema>