feat(guides): organize schemas and export teams
CI / Verify (push) Successful in 1m6s
CI / Build immutable images and deploy (push) Successful in 2m19s

This commit is contained in:
2026-08-29 18:52:01 +00:00 Unverified
parent ac9a733370
commit 17214a3625
13 changed files with 3751 additions and 46 deletions
+40
View File
@@ -125,4 +125,44 @@ export async function getLatestCatalogSyncJob() {
return job ?? null;
}
export async function getPublicTeamExport(teamId: string) {
const [row] = await getDb()
.select({ team: teamCompositions, guide: guides })
.from(teamCompositions)
.innerJoin(guides, eq(guides.id, teamCompositions.guideId))
.innerJoin(
guideSections,
and(
eq(guideSections.guideId, guides.id),
eq(guideSections.slug, "team"),
eq(guideSections.enabled, true),
),
)
.where(and(eq(teamCompositions.id, teamId), isNull(guides.trashedAt)))
.limit(1);
if (!row) return null;
const members = await getDb()
.select({ member: teamMembers, character: catalogCharacters })
.from(teamMembers)
.innerJoin(
catalogCharacters,
and(
eq(catalogCharacters.version, teamMembers.catalogVersion),
eq(catalogCharacters.key, teamMembers.characterKey),
),
)
.where(eq(teamMembers.teamId, teamId))
.orderBy(asc(teamMembers.position));
return {
...row.team,
guideName: row.guide.name,
members: members.map(({ member, character }) => ({
...member,
character: catalogCharacterWithUrls(character),
})),
};
}
export type PublicGuide = NonNullable<Awaited<ReturnType<typeof getPublicGuide>>>;