groupSchema: refine --> transform, fix type of members_count
This commit is contained in:
parent
6be8d4d46e
commit
5e8c92ed4d
|
@ -24,13 +24,13 @@ const groupSchema = z.object({
|
||||||
id: z.string().catch(''),
|
id: z.string().catch(''),
|
||||||
locked: z.boolean().catch(false),
|
locked: z.boolean().catch(false),
|
||||||
membership_required: z.boolean().catch(false),
|
membership_required: z.boolean().catch(false),
|
||||||
members_count: z.number().optional().catch(undefined),
|
members_count: z.number().catch(0),
|
||||||
note: z.string().catch('').refine(note => note === '<p></p>' ? '' : note),
|
note: z.string().catch('').refine(note => note === '<p></p>' ? '' : note),
|
||||||
relationship: groupRelationshipSchema.optional().catch(undefined), // Dummy field to be overwritten later
|
relationship: groupRelationshipSchema.nullable().catch(null), // Dummy field to be overwritten later
|
||||||
statuses_visibility: z.string().catch('public'),
|
statuses_visibility: z.string().catch('public'),
|
||||||
uri: z.string().catch(''),
|
uri: z.string().catch(''),
|
||||||
url: z.string().catch(''),
|
url: z.string().catch(''),
|
||||||
}).refine(group => {
|
}).transform(group => {
|
||||||
group.avatar_static = group.avatar_static || group.avatar;
|
group.avatar_static = group.avatar_static || group.avatar;
|
||||||
group.header_static = group.header_static || group.header;
|
group.header_static = group.header_static || group.header;
|
||||||
group.locked = group.locked || group.group_visibility === 'members_only'; // TruthSocial
|
group.locked = group.locked || group.group_visibility === 'members_only'; // TruthSocial
|
||||||
|
|
Loading…
Reference in New Issue