Status schema improvements See merge request soapbox-pub/soapbox!2521environments/review-develop-3zknud/deployments/3404
commit
917b45bdc5
@ -0,0 +1,20 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { attachmentSchema } from './attachment';
|
||||
import { locationSchema } from './location';
|
||||
|
||||
const eventSchema = z.object({
|
||||
name: z.string().catch(''),
|
||||
start_time: z.string().datetime().nullable().catch(null),
|
||||
end_time: z.string().datetime().nullable().catch(null),
|
||||
join_mode: z.enum(['free', 'restricted', 'invite']).nullable().catch(null),
|
||||
participants_count: z.number().catch(0),
|
||||
location: locationSchema.nullable().catch(null),
|
||||
join_state: z.enum(['pending', 'reject', 'accept']).nullable().catch(null),
|
||||
banner: attachmentSchema.nullable().catch(null),
|
||||
links: z.array(attachmentSchema).nullable().catch(null),
|
||||
});
|
||||
|
||||
type Event = z.infer<typeof eventSchema>;
|
||||
|
||||
export { eventSchema, type Event };
|
@ -0,0 +1,23 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const locationSchema = z.object({
|
||||
url: z.string().url().catch(''),
|
||||
description: z.string().catch(''),
|
||||
country: z.string().catch(''),
|
||||
locality: z.string().catch(''),
|
||||
region: z.string().catch(''),
|
||||
postal_code: z.string().catch(''),
|
||||
street: z.string().catch(''),
|
||||
origin_id: z.string().catch(''),
|
||||
origin_provider: z.string().catch(''),
|
||||
type: z.string().catch(''),
|
||||
timezone: z.string().catch(''),
|
||||
geom: z.object({
|
||||
coordinates: z.tuple([z.number(), z.number()]).nullable().catch(null),
|
||||
srid: z.string().catch(''),
|
||||
}).nullable().catch(null),
|
||||
});
|
||||
|
||||
type Location = z.infer<typeof locationSchema>;
|
||||
|
||||
export { locationSchema, type Location };
|
Loading…
Reference in new issue