Add "Woofer Exploration" and improve drafting

This commit is contained in:
Bad Manners 2024-06-23 18:24:59 -03:00
parent a9d5a88d0e
commit 405ad38f5d
25 changed files with 300 additions and 189 deletions

View file

@ -28,9 +28,14 @@ const mastodonPost = z.object({
user: z.string(),
postId: z.string(),
});
const copyrightedCharacters = z
.record(z.string(), reference("users"))
.default({})
.refine(refineCopyrightedCharacters, `"copyrightedCharacters" cannot mix empty catch-all key with other keys`);
export type Lang = z.output<typeof lang>;
export type Website = z.infer<typeof website>;
export type CopyrightedCharacters = z.infer<typeof copyrightedCharacters>;
const storiesCollection = defineCollection({
type: "content",
@ -38,8 +43,8 @@ const storiesCollection = defineCollection({
z.object({
// Required
title: z.string(),
pubDate: z.date().transform(adjustDateForUTCOffset),
wordCount: z.number().int(),
pubDate: z.date().transform(adjustDateForUTCOffset).optional(),
wordCount: z.number().int().optional(),
contentWarning: z.string(),
description: z.string(),
tags: z.array(z.string()),
@ -58,16 +63,17 @@ const storiesCollection = defineCollection({
series: reference("series").optional(),
commissioner: reference("users").optional(),
requester: reference("users").optional(),
copyrightedCharacters: z
.record(z.string(), reference("users"))
.default({})
.refine(refineCopyrightedCharacters, `"copyrightedCharacters" cannot mix empty catch-all key with other keys`),
copyrightedCharacters: copyrightedCharacters,
lang,
prev: reference("stories").nullish(),
next: reference("stories").nullish(),
relatedStories: z.array(reference("stories")).default([]),
relatedGames: z.array(reference("games")).default([]),
mastodonPost: mastodonPost.optional(),
posts: z
.object({
mastodon: mastodonPost.optional(),
})
.default({}),
}),
});
@ -77,7 +83,7 @@ const gamesCollection = defineCollection({
z.object({
// Required
title: z.string(),
pubDate: z.date().transform(adjustDateForUTCOffset),
pubDate: z.date().transform(adjustDateForUTCOffset).optional(),
contentWarning: z.string(),
description: z.string(),
tags: z.array(z.string()),
@ -93,14 +99,15 @@ const gamesCollection = defineCollection({
thumbnailHeight: z.number().int().optional(),
series: reference("series").optional(),
platforms: z.array(platform).refine((platforms) => platforms.length > 0, `"platforms" cannot be empty`),
copyrightedCharacters: z
.record(z.string(), reference("users"))
.default({})
.refine(refineCopyrightedCharacters, `"copyrightedCharacters" cannot mix empty catch-all key with other keys`),
copyrightedCharacters: copyrightedCharacters,
lang,
relatedStories: z.array(reference("stories")).default([]),
relatedGames: z.array(reference("games")).default([]),
mastodonPost: mastodonPost.optional(),
posts: z
.object({
mastodon: mastodonPost.optional(),
})
.default({}),
}),
});