Files
gunshiz b3bc4c3bb4
CI / verify (push) Successful in 59s
CI / build-and-deploy (push) Successful in 1m38s
feat : add import from buzz guide
2026-09-20 00:41:02 +07:00

53 lines
2.5 KiB
TypeScript

import { boolean, integer, jsonb, numeric, pgSchema, text, timestamp, uuid, varchar } from "drizzle-orm/pg-core";
import type { CatalogBaseStat } from "@/lib/translator/types";
export const catalogSchema = pgSchema("catalog");
export const guidesSchema = pgSchema("guides");
export const catalogCharacters = catalogSchema.table("character", {
key: varchar("key", { length: 64 }).primaryKey(), name: text("name").notNull(), element: varchar("element", { length: 48 }), rarity: integer("rarity"), weaponType: varchar("weapon_type", { length: 64 }), imageKey: text("image_key").notNull(), baseStats: jsonb("base_stats").$type<CatalogBaseStat[]>().default([]).notNull(),
});
export const catalogWeapons = catalogSchema.table("weapon", {
key: varchar("key", { length: 64 }).primaryKey(), name: text("name").notNull(), rarity: integer("rarity"), weaponType: varchar("weapon_type", { length: 64 }), imageKey: text("image_key").notNull(),
});
export const catalogArtifacts = catalogSchema.table("artifact", {
key: varchar("key", { length: 64 }).primaryKey(), name: text("name").notNull(), rarity: integer("rarity"), imageKey: text("image_key").notNull(),
});
export const guides = guidesSchema.table("guide", {
id: uuid("id").primaryKey(),
characterKey: varchar("character_key", { length: 64 }).notNull(),
name: text("name").notNull(),
sortOrder: integer("sort_order").notNull(),
isPublic: boolean("is_public").notNull(),
trashedAt: timestamp("trashed_at", { withTimezone: true }),
});
export const teamConditions = guidesSchema.table("team_condition", {
id: uuid("id").primaryKey(),
guideId: uuid("guide_id").notNull(),
name: varchar("name", { length: 255 }),
sortOrder: integer("sort_order").notNull(),
});
export const teamCompositions = guidesSchema.table("team_composition", {
id: uuid("id").primaryKey(),
guideId: uuid("guide_id").notNull(),
title: text("title").notNull(),
combo: text("combo").notNull(),
sortOrder: integer("sort_order").notNull(),
conditionId: uuid("condition_id"),
rotationSeconds: numeric("rotation_seconds").notNull(),
});
export const teamMembers = guidesSchema.table("team_member", {
teamId: uuid("team_id").notNull(),
position: integer("position").notNull(),
characterKey: varchar("character_key", { length: 64 }).notNull(),
weaponKey: varchar("weapon_key", { length: 64 }).notNull(),
artifactKey: varchar("artifact_key", { length: 64 }).notNull(),
secondArtifactKey: varchar("second_artifact_key", { length: 64 }),
constellation: integer("constellation").notNull(),
refinement: integer("refinement").notNull(),
});