chore: update pnpm workspace with TypeScript and Zod versions; enhance turbo.json task formatting

This commit is contained in:
2025-07-28 21:16:50 -03:00
parent fad2331aae
commit 5ab5cfda9c
16 changed files with 1720 additions and 24 deletions

33
packages/db/src/schema.ts Normal file
View File

@@ -0,0 +1,33 @@
import { pgTable, serial, varchar, integer, pgEnum, primaryKey } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';
//#region Enums
export const BookTypeEnum = pgEnum("book_type", ["novel", "fanfic"]);
export const LeadingGenderEnum = pgEnum("leading_gender", ["male", "female"]);
//#endregion Enums
//#region Genre
export const Genre = pgTable("genres", {
id: serial("id").primaryKey(),
name: varchar("name").notNull(),
description: varchar("description").notNull(),
});
export const GenreTranslation = pgTable("genre_translations", {
id: integer("id"),
locale: varchar("locale").notNull(),
name: varchar("name").notNull(),
description: varchar("description"),
}, (t) => ([
primaryKey({ columns: [t.id, t.locale] }),
]));
// Relations
export const GenreRelations = relations(Genre, ({ many }) => ({
translations: many(GenreTranslation)
}));
export const GenreTranslationRelations = relations(GenreTranslation, ({ one }) => ({
genre: one(Genre, {
fields: [GenreTranslation.id],
references: [Genre.id],
}),
}));
//#endregion Genre