bigbuffet-rw/app/soapbox/schemas/group-relationship.ts

18 lines
574 B
TypeScript
Raw Normal View History

2023-03-10 10:42:49 -08:00
import z from 'zod';
2023-03-28 08:52:41 -07:00
import { GroupRoles } from './group-member';
2023-03-10 10:42:49 -08:00
const groupRelationshipSchema = z.object({
2023-06-08 06:00:49 -07:00
blocked_by: z.boolean().catch(false),
2023-03-10 10:42:49 -08:00
id: z.string(),
member: z.boolean().catch(false),
2023-06-08 06:00:49 -07:00
muting: z.boolean().nullable().catch(false),
notifying: z.boolean().nullable().catch(null),
pending_requests: z.boolean().catch(false),
2023-06-08 06:00:49 -07:00
requested: z.boolean().catch(false),
role: z.nativeEnum(GroupRoles).catch(GroupRoles.USER),
2023-03-10 10:42:49 -08:00
});
type GroupRelationship = z.infer<typeof groupRelationshipSchema>;
2023-05-04 10:20:39 -07:00
export { groupRelationshipSchema, type GroupRelationship };