feat: add search and data tables

This commit is contained in:
2026-03-27 19:16:53 +01:00
parent ae4a77f5dd
commit 8d71480e9a
54 changed files with 2577 additions and 1577 deletions

View File

@@ -13,6 +13,7 @@ import {
import { relations } from 'drizzle-orm';
export * from './auth.schema';
import { user } from './auth.schema';
// ── Teams ───────────────────────────────────────────────────────────────
export const team = pgTable('team', {
@@ -581,6 +582,30 @@ export const tournamentGroupEntryRelations = relations(tournamentGroupEntry, ({
team: one(team, { fields: [tournamentGroupEntry.teamId], references: [team.id] })
}));
// ── Profile Comments ────────────────────────────────────────────────────
export const profileComment = pgTable(
'profile_comment',
{
id: uuid('id').primaryKey().defaultRandom(),
// 'user' or 'team'
targetType: text('target_type').notNull(),
targetId: text('target_id').notNull(),
authorId: text('author_id')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
content: text('content').notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull()
},
(t) => [
index('idx_profile_comment_target').on(t.targetType, t.targetId),
index('idx_profile_comment_author').on(t.authorId)
]
);
export const profileCommentRelations = relations(profileComment, ({ one }) => ({
author: one(user, { fields: [profileComment.authorId], references: [user.id] })
}));
export const tournamentQualifierScoreRelations = relations(tournamentQualifierScore, ({ one }) => ({
tournament: one(tournament, {
fields: [tournamentQualifierScore.tournamentId],