beeeeg update
Some checks failed
Test and deploy staging / staging (push) Has been cancelled

This commit is contained in:
2026-09-23 04:15:10 +00:00
parent 487eff5bb2
commit d0c7b6548b
135 changed files with 9531 additions and 1777 deletions

View File

@@ -2,6 +2,27 @@ import { defineRelations } from 'drizzle-orm';
import * as schema from './schema';
export const relations = defineRelations(schema, (r) => ({
// ── Auth ──────────────────────────────────────
user: {
sessions: r.many.session(),
accounts: r.many.account(),
entries: r.many.userEntries(),
games: r.many.userGames(),
listCompletions: r.many.listItemCompletions()
},
session: {
user: r.one.user({
from: r.session.userId,
to: r.user.id
})
},
account: {
user: r.one.user({
from: r.account.userId,
to: r.user.id
})
},
// ── Progress ──────────────────────────────────
tasks: {
tasksToTopics: r.many.tasksToTopics()
@@ -21,61 +42,41 @@ export const relations = defineRelations(schema, (r) => ({
},
// ── CatchEmAll ────────────────────────────────
game: {
entries: r.many.pokemonGameEntry()
games: {
entries: r.many.pokemonGameEntries()
},
pokemon: {
entry: r.many.pokemonGameEntry()
entry: r.many.pokemonGameEntries()
},
pokemonGameEntry: {
game: r.one.game({
from: r.pokemonGameEntry.gameId,
to: r.game.id
pokemonGameEntries: {
game: r.one.games({
from: r.pokemonGameEntries.gameId,
to: r.games.id
}),
pokemon: r.one.pokemon({
from: r.pokemonGameEntry.pokemonId,
from: r.pokemonGameEntries.pokemonId,
to: r.pokemon.id
}),
userEntries: r.many.userEntry()
userEntries: r.many.userEntries()
},
userEntry: {
pokemonGameEntry: r.one.pokemonGameEntry({
from: r.userEntry.pokemonGameEntryId,
to: r.pokemonGameEntry.id
userEntries: {
pokemonGameEntry: r.one.pokemonGameEntries({
from: r.userEntries.pokemonGameEntryId,
to: r.pokemonGameEntries.id
}),
user: r.one.user({
from: r.userEntry.userId,
from: r.userEntries.userId,
to: r.user.id
})
},
userGame: {
userGames: {
user: r.one.user({
from: r.userGame.userId,
from: r.userGames.userId,
to: r.user.id
}),
game: r.one.game({
from: r.userGame.gameId,
to: r.game.id
})
},
// ── Auth ──────────────────────────────────────
user: {
sessions: r.many.session(),
accounts: r.many.account(),
entries: r.many.userEntry(),
games: r.many.userGame()
},
session: {
user: r.one.user({
from: r.session.userId,
to: r.user.id
})
},
account: {
user: r.one.user({
from: r.account.userId,
to: r.user.id
game: r.one.games({
from: r.userGames.gameId,
to: r.games.id
})
},
@@ -95,5 +96,27 @@ export const relations = defineRelations(schema, (r) => ({
from: r.photos.sightingId,
to: r.sightings.id
})
},
// ── Lists ─────────────────────────────────────
lists: {
items: r.many.listItems()
},
listItems: {
list: r.one.lists({
from: r.listItems.listId,
to: r.lists.id
}),
completions: r.many.listItemCompletions()
},
listItemCompletions: {
item: r.one.listItems({
from: r.listItemCompletions.itemId,
to: r.listItems.id
}),
user: r.one.user({
from: r.listItemCompletions.userId,
to: r.user.id
})
}
}));