Add admin dashboard and Replit authentication integration
Integrates Replit authentication using OpenID Connect, adds an admin dashboard route with video management and thumbnail upload capabilities, and updates dependencies. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 890577b1-c154-40a4-a177-a0c6d55320c3 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/890577b1-c154-40a4-a177-a0c6d55320c3/1jMBtLj
This commit is contained in:
+17
-1
@@ -1,8 +1,12 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { pgTable, text, varchar, integer, timestamp, boolean, real } from "drizzle-orm/pg-core";
|
||||
import { pgTable, text, varchar, integer, timestamp, boolean, real, pgEnum, jsonb, index } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
// Enums for better type safety
|
||||
export const contentTypeEnum = pgEnum('content_type', ['video', 'oddaja', 'music_video', 'documentary', 'live']);
|
||||
export const genreEnum = pgEnum('genre', ['volksmusik', 'schlager', 'pop', 'rock', 'country', 'instrumental', 'dance', 'other']);
|
||||
|
||||
export const videos = pgTable("videos", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
title: text("title").notNull(),
|
||||
@@ -18,6 +22,8 @@ export const videos = pgTable("videos", {
|
||||
duration: integer("duration").notNull(), // in seconds
|
||||
views: integer("views").notNull().default(0),
|
||||
category: text("category").default("").notNull(),
|
||||
contentType: contentTypeEnum("content_type").default('video').notNull(),
|
||||
genre: genreEnum("genre").default('other').notNull(),
|
||||
tags: text("tags").array().default([]).notNull(),
|
||||
isPublic: boolean("is_public").default(true).notNull(),
|
||||
uploadStatus: text("upload_status").default("pending").notNull(), // pending, processing, completed, failed
|
||||
@@ -41,6 +47,7 @@ export const users = pgTable("users", {
|
||||
lastName: varchar("last_name", { length: 100 }),
|
||||
profileImageUrl: text("profile_image_url"),
|
||||
isAdmin: boolean("is_admin").default(false).notNull(),
|
||||
isSuperAdmin: boolean("is_super_admin").default(false).notNull(),
|
||||
createdAt: timestamp("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
||||
updatedAt: timestamp("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
||||
});
|
||||
@@ -84,6 +91,15 @@ export const videoTags = pgTable("video_tags", {
|
||||
tagId: varchar("tag_id").notNull().references(() => tags.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
// Session storage table for Replit Auth
|
||||
export const sessions = pgTable("sessions", {
|
||||
sid: varchar("sid").primaryKey(),
|
||||
sess: jsonb("sess").notNull(),
|
||||
expire: timestamp("expire").notNull(),
|
||||
}, (table) => [
|
||||
index("IDX_session_expire").on(table.expire)
|
||||
]);
|
||||
|
||||
// Video ads/spots table for storing advertisement metadata
|
||||
export const videoAds = pgTable("video_ads", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
|
||||
Reference in New Issue
Block a user