Add tagSchema
This commit is contained in:
parent
d4ed442a7e
commit
f48edfba45
2 changed files with 19 additions and 0 deletions
|
@ -8,6 +8,7 @@ export { groupRelationshipSchema, type GroupRelationship } from './group-relatio
|
||||||
export { groupTagSchema, type GroupTag } from './group-tag';
|
export { groupTagSchema, type GroupTag } from './group-tag';
|
||||||
export { pollSchema, type Poll, type PollOption } from './poll';
|
export { pollSchema, type Poll, type PollOption } from './poll';
|
||||||
export { relationshipSchema, type Relationship } from './relationship';
|
export { relationshipSchema, type Relationship } from './relationship';
|
||||||
|
export { tagSchema, type Tag } from './tag';
|
||||||
|
|
||||||
// Soapbox
|
// Soapbox
|
||||||
export { adSchema, type Ad } from './soapbox/ad';
|
export { adSchema, type Ad } from './soapbox/ad';
|
18
app/soapbox/schemas/tag.ts
Normal file
18
app/soapbox/schemas/tag.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
const historySchema = z.object({
|
||||||
|
accounts: z.coerce.number(),
|
||||||
|
uses: z.coerce.number(),
|
||||||
|
});
|
||||||
|
|
||||||
|
/** // https://docs.joinmastodon.org/entities/tag */
|
||||||
|
const tagSchema = z.object({
|
||||||
|
name: z.string().min(1),
|
||||||
|
url: z.string().url().catch(''),
|
||||||
|
history: z.array(historySchema).nullable().catch(null),
|
||||||
|
following: z.boolean().catch(false),
|
||||||
|
});
|
||||||
|
|
||||||
|
type Tag = z.infer<typeof tagSchema>;
|
||||||
|
|
||||||
|
export { tagSchema, type Tag };
|
Loading…
Reference in a new issue