style: format code
All checks were successful
container-scan / Container Scan (pull_request) Successful in 3m10s
docker-build / docker (pull_request) Successful in 7m25s

This commit is contained in:
Dominik 2025-06-23 10:45:56 +02:00
parent 4cf5ce26ff
commit 29f2a01ac6
Signed by: dominik
GPG key ID: 06A4003FC5049644
5 changed files with 28 additions and 18 deletions

View file

@ -65,7 +65,10 @@ export const PATCH = auth(async function PATCH(req) {
{ status: 400 }, { status: 400 },
); );
if (dbUser.accounts.length === 0 || dbUser.accounts[0].provider !== 'credentials') if (
dbUser.accounts.length === 0 ||
dbUser.accounts[0].provider !== 'credentials'
)
return returnZodTypeCheckedResponse( return returnZodTypeCheckedResponse(
ErrorResponseSchema, ErrorResponseSchema,
{ {

View file

@ -22,10 +22,12 @@ export const updateUserServerSchema = zod.object({
timezone: timezoneSchema.optional(), timezone: timezoneSchema.optional(),
}); });
export const updateUserPasswordServerSchema = zod.object({ export const updateUserPasswordServerSchema = zod
current_password: zod.string().min(1, 'Current password is required'), .object({
new_password: passwordSchema, current_password: zod.string().min(1, 'Current password is required'),
confirm_new_password: passwordSchema, new_password: passwordSchema,
}).refine((data) => data.new_password === data.confirm_new_password, { confirm_new_password: passwordSchema,
message: 'New password and confirm new password must match', })
}); .refine((data) => data.new_password === data.confirm_new_password, {
message: 'New password and confirm new password must match',
});

View file

@ -113,11 +113,9 @@ export const passwordSchema = zod
// Timezone Validation // Timezone Validation
// //
// ---------------------------------------- // ----------------------------------------
export const timezoneSchema = zod export const timezoneSchema = zod.enum(allTimeZones).openapi('Timezone', {
.enum(allTimeZones) description: 'Valid timezone from the list of supported timezones',
.openapi('Timezone', { });
description: 'Valid timezone from the list of supported timezones',
});
// ---------------------------------------- // ----------------------------------------
// //
@ -132,7 +130,10 @@ export const FullUserSchema = zod
last_name: zod.string().nullish(), last_name: zod.string().nullish(),
email: zod.email(), email: zod.email(),
image: zod.url().nullish(), image: zod.url().nullish(),
timezone: zod.string().refine((i) => (allTimeZones as string[]).includes(i)).nullish(), timezone: zod
.string()
.refine((i) => (allTimeZones as string[]).includes(i))
.nullish(),
created_at: zod.date(), created_at: zod.date(),
updated_at: zod.date(), updated_at: zod.date(),
}) })

View file

@ -3708,6 +3708,10 @@ type TimeZoneIds = (typeof timezoneData)['zones'][number]['id'];
type TimeZoneAlias = (typeof timezoneData)['zones'][number]['aliases'][number]; type TimeZoneAlias = (typeof timezoneData)['zones'][number]['aliases'][number];
export type TimeZones = TimeZoneIds | TimeZoneAlias; export type TimeZones = TimeZoneIds | TimeZoneAlias;
export const timeZoneIds = timezoneData.zones.map((zone) => zone.id) as TimeZoneIds[]; export const timeZoneIds = timezoneData.zones.map(
export const timeZoneAliases = timezoneData.zones.flatMap((zone) => zone.aliases) as TimeZoneAlias[]; (zone) => zone.id,
) as TimeZoneIds[];
export const timeZoneAliases = timezoneData.zones.flatMap(
(zone) => zone.aliases,
) as TimeZoneAlias[];
export const allTimeZones = [...timeZoneIds, ...timeZoneAliases] as const; export const allTimeZones = [...timeZoneIds, ...timeZoneAliases] as const;