Adding the first stubs of the magazine browser

This commit is contained in:
2025-12-18 13:10:58 +00:00
parent 279abac91a
commit a1a04a89cf
11 changed files with 632 additions and 228 deletions

View File

@@ -7,9 +7,10 @@ export const entries = mysqlTable("entries", {
isXrated: tinyint("is_xrated").notNull(),
machinetypeId: tinyint("machinetype_id"),
maxPlayers: tinyint("max_players").notNull().default(1),
// DB allows NULLs on many of these
languageId: char("language_id", { length: 2 }),
genretypeSpotId: tinyint("spot_genretype_id"),
genretypeId: tinyint("genretype_id"),
genretypeSpotId: tinyint("spot_genretype_id"),
availabletypeId: char("availabletype_id", { length: 1 }),
withoutLoadScreen: tinyint("without_load_screen").notNull(),
withoutInlay: tinyint("without_inlay").notNull(),
@@ -28,6 +29,14 @@ export type Entry = typeof entries.$inferSelect;
export const labels = mysqlTable("labels", {
id: int("id").notNull().primaryKey(),
name: varchar("name", { length: 100 }).notNull(),
countryId: char("country_id", { length: 2 }),
country2Id: char("country2_id", { length: 2 }),
fromId: int("from_id"),
ownerId: int("owner_id"),
wasRenamed: tinyint("was_renamed").notNull().default(0),
deceased: varchar("deceased", { length: 200 }),
linkWikipedia: varchar("link_wikipedia", { length: 200 }),
linkSite: varchar("link_site", { length: 200 }),
labeltypeId: char("labeltype_id", { length: 1 }),
});
@@ -54,6 +63,8 @@ export const authors = mysqlTable("authors", {
entryId: int("entry_id").notNull(),
labelId: int("label_id").notNull(),
teamId: int("team_id"),
// Present in schema; sequence of the author for a given entry
authorSeq: smallint("author_seq").notNull().default(1),
});
export const publishers = mysqlTable("publishers", {
@@ -143,6 +154,35 @@ export const hosts = mysqlTable("hosts", {
magazineId: smallint("magazine_id"),
});
// ---- Magazines and Issues (subset used by the app) ----
export const magazines = mysqlTable("magazines", {
id: smallint("id").notNull().primaryKey(),
// ZXDB column is `name`
name: varchar("name", { length: 100 }).notNull(),
countryId: char("country_id", { length: 2 }).notNull(),
languageId: char("language_id", { length: 2 }).notNull(),
linkSite: varchar("link_site", { length: 200 }),
magtypeId: char("magtype_id", { length: 1 }).notNull(),
topicId: int("topic_id"),
linkMask: varchar("link_mask", { length: 250 }),
archiveMask: varchar("archive_mask", { length: 250 }),
translationMask: varchar("translation_mask", { length: 250 }),
});
export const issues = mysqlTable("issues", {
id: int("id").notNull().primaryKey(),
magazineId: smallint("magazine_id").notNull(),
dateYear: smallint("date_year"),
dateMonth: smallint("date_month"),
dateDay: smallint("date_day"),
volume: smallint("volume"),
number: smallint("number"),
special: varchar("special", { length: 100 }),
supplement: varchar("supplement", { length: 100 }),
linkMask: varchar("link_mask", { length: 250 }),
archiveMask: varchar("archive_mask", { length: 250 }),
});
// ---- Aliases (alternative titles per entry/release/language)
export const aliases = mysqlTable("aliases", {
entryId: int("entry_id").notNull(),
@@ -214,3 +254,91 @@ export const roles = mysqlTable("roles", {
labelId: int("label_id").notNull(),
roletypeId: char("roletype_id", { length: 1 }).notNull(),
});
// ---- Additional ZXDB schema coverage (lookups and content) ----
export const articletypes = mysqlTable("articletypes", {
id: char("id", { length: 1 }).notNull().primaryKey(),
name: varchar("text", { length: 50 }).notNull(),
});
export const articles = mysqlTable("articles", {
labelId: int("label_id").notNull(),
link: varchar("link", { length: 200 }).notNull(),
articletypeId: char("articletype_id", { length: 1 }).notNull(),
title: varchar("title", { length: 200 }),
languageId: char("language_id", { length: 2 }).notNull(),
writer: varchar("writer", { length: 200 }),
dateYear: smallint("date_year"),
});
export const categories = mysqlTable("categories", {
id: smallint("id").notNull().primaryKey(),
// DB column `text`
name: varchar("text", { length: 50 }).notNull(),
});
export const contenttypes = mysqlTable("contenttypes", {
id: char("id", { length: 1 }).notNull().primaryKey(),
name: varchar("text", { length: 50 }).notNull(),
});
export const contents = mysqlTable("contents", {
// ZXDB contents table does not have its own `id`; natural key is (issue_id, page_from, page_to, label_id, entry_id)
entryId: int("entry_id").notNull(),
labelId: int("label_id"),
issueId: int("issue_id").notNull(),
contenttypeId: char("contenttype_id", { length: 1 }).notNull(),
pageFrom: smallint("page_from"),
pageTo: smallint("page_to"),
title: varchar("title", { length: 200 }),
dateYear: smallint("date_year"),
rating: tinyint("rating"),
comments: varchar("comments", { length: 250 }),
});
export const extensions = mysqlTable("extensions", {
ext: varchar("ext", { length: 15 }).notNull().primaryKey(),
name: varchar("text", { length: 50 }).notNull(),
});
export const features = mysqlTable("features", {
id: int("id").notNull().primaryKey(),
name: varchar("name", { length: 150 }).notNull(),
version: tinyint("version").notNull().default(0),
labelId: int("label_id"),
label2Id: int("label2_id"),
});
export const tooltypes = mysqlTable("tooltypes", {
id: char("id", { length: 1 }).notNull().primaryKey(),
name: varchar("text", { length: 50 }).notNull(),
});
export const tools = mysqlTable("tools", {
id: int("id").notNull().primaryKey(),
title: varchar("title", { length: 200 }).notNull(),
languageId: char("language_id", { length: 2 }),
tooltypeId: char("tooltype_id", { length: 1 }),
link: varchar("link", { length: 200 }),
});
// ---- Magazine references (per-issue references to entries/labels/topics) ----
export const referencetypes = mysqlTable("referencetypes", {
id: tinyint("id").notNull().primaryKey(),
name: varchar("text", { length: 50 }).notNull(),
});
export const magrefs = mysqlTable("magrefs", {
id: int("id").notNull().primaryKey(),
referencetypeId: tinyint("referencetype_id").notNull(),
entryId: int("entry_id"),
labelId: int("label_id"),
topicId: int("topic_id"),
issueId: int("issue_id").notNull(),
page: smallint("page").notNull().default(0),
isOriginal: tinyint("is_original").notNull().default(0),
scoreGroup: varchar("score_group", { length: 100 }).notNull().default(""),
reviewId: int("review_id"),
awardId: tinyint("award_id"),
});