folx-tv/shared/schema.ts
sebastjanartic 4a7639b15d Add new pages and improve blog content display functionality
Implement new routes for articles, categories, and individual articles. Update the UI to display articles with improved content rendering, including safe HTML and media embeds. Refactor storage to use a database and add image upload capabilities.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 413891e8-d784-4bea-b9f5-91a5a68316b4
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: b96b221e-0ed6-418f-80df-e4670bf5ba4b
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/413891e8-d784-4bea-b9f5-91a5a68316b4/cftwqyT
Replit-Helium-Checkpoint-Created: true
2026-02-28 16:38:38 +00:00

42 lines
1.5 KiB
TypeScript

import { sql } from "drizzle-orm";
import { pgTable, text, varchar, integer, boolean, timestamp, serial } from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
import { z } from "zod";
export const articles = pgTable("articles", {
id: serial("id").primaryKey(),
title: text("title").notNull(),
slug: varchar("slug", { length: 255 }).notNull().unique(),
excerpt: text("excerpt").notNull(),
content: text("content").notNull(),
coverImage: text("cover_image"),
category: varchar("category", { length: 100 }).notNull().default("News"),
author: varchar("author", { length: 255 }).notNull().default("Folx Music Television"),
featured: boolean("featured").notNull().default(false),
views: integer("views").notNull().default(0),
publishedAt: timestamp("published_at").notNull().defaultNow(),
});
export const insertArticleSchema = createInsertSchema(articles).omit({
id: true,
views: true,
publishedAt: true,
});
export type InsertArticle = z.infer<typeof insertArticleSchema>;
export type Article = typeof articles.$inferSelect;
export const users = pgTable("users", {
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
username: text("username").notNull().unique(),
password: text("password").notNull(),
});
export const insertUserSchema = createInsertSchema(users).pick({
username: true,
password: true,
});
export type InsertUser = z.infer<typeof insertUserSchema>;
export type User = typeof users.$inferSelect;