This commit is contained in:
2024-09-02 16:58:23 +02:00
parent c77503ed45
commit 1b0dc0f27d
52 changed files with 817 additions and 1379 deletions

13
types/auth.d.ts vendored
View File

@@ -18,18 +18,7 @@ declare module '#auth-utils' {
}
interface UserSession {
id: number
name: string
username: string
email: string
avatar: string | null
githubId?: number | null
googleId?: string | null
description: string
private: boolean
language: string
location: string
subscription: Subscription
}
}

View File

@@ -6,7 +6,7 @@ export const Subscription = ['free', 'paid'] as const
// Category
export const CreateCategorySchema = z.object({
name: z.string().min(4),
name: z.string().min(4).max(20),
icon: z.string(),
color: z.enum(COLORS).default('gray'),
nameVisible: z.boolean().optional().default(false),
@@ -14,7 +14,7 @@ export const CreateCategorySchema = z.object({
export const CreateCategorySchemaType = z.infer<typeof CreateCategorySchema>
export const UpdateCategorySchema = z.object({
name: z.string().min(4).optional(),
name: z.string().min(4).max(20).optional(),
icon: z.string().optional(),
color: z.string().optional(),
nameVisible: z.boolean().optional().default(false),
@@ -31,20 +31,20 @@ export interface CategoryType {
// Tab
export const CreateTabSchema = z.object({
name: z.string().min(4),
name: z.string().min(4).max(20),
icon: z.string(),
color: z.enum(COLORS).default('gray'),
primary: z.boolean().optional().default(false),
primary: z.boolean().default(false),
link: z.string(),
categoryId: z.number(),
})
export const CreateTabSchemaType = z.infer<typeof CreateTabSchema>
export const UpdateTabSchema = z.object({
name: z.string().min(4).optional(),
name: z.string().min(4).max(20).optional(),
icon: z.string().optional(),
color: z.enum(COLORS).default('gray').optional(),
primary: z.boolean().optional().default(false),
primary: z.boolean().optional(),
link: z.string().optional(),
categoryId: z.number(),
})
@@ -60,6 +60,17 @@ export interface TabType {
link: string
}
// User
export const UpdateUserSchema = z.object({
name: z.string().min(3).max(25).optional(),
username: z.string().optional(),
description: z.string().optional(),
location: z.string().optional(),
language: z.string().optional(),
private: z.boolean().optional().default(false),
})
export const UpdateUserSchemaType = z.infer<typeof UpdateUserSchema>
export interface OpenWeatherType {
weather: Array<{
description: string
@@ -78,3 +89,18 @@ export interface WeatherType {
}
temp: number
}
export const locales = [
{
locale: 'en-EN',
label: 'English',
},
{
locale: 'es-ES',
label: 'Spanish',
},
{
locale: 'fr-FR',
label: 'French',
},
]