Introduce functionality to edit video metadata including title, description, category, tags, and public status, along with a new modal for editing and a backend endpoint for updating video information. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 11420304-80a9-4ef2-adff-cbdaa418ffa8 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/11420304-80a9-4ef2-adff-cbdaa418ffa8/vOcB2tQ
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { sql } from "drizzle-orm";
|
|
import { pgTable, text, varchar, integer, timestamp, boolean } from "drizzle-orm/pg-core";
|
|
import { createInsertSchema } from "drizzle-zod";
|
|
import { z } from "zod";
|
|
|
|
export const videos = pgTable("videos", {
|
|
id: varchar("id").primaryKey(),
|
|
title: text("title").notNull(),
|
|
description: text("description").default("").notNull(),
|
|
thumbnailUrl: text("thumbnail_url").notNull(),
|
|
customThumbnailUrl: text("custom_thumbnail_url"),
|
|
videoUrl: text("video_url").notNull(),
|
|
videoUrlMp4: text("video_url_mp4"),
|
|
videoUrlIframe: text("video_url_iframe"),
|
|
duration: integer("duration").notNull(), // in seconds
|
|
views: integer("views").notNull().default(0),
|
|
category: text("category").default("").notNull(),
|
|
tags: text("tags").array().default([]).notNull(),
|
|
isPublic: boolean("is_public").default(true).notNull(),
|
|
createdAt: timestamp("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
|
updatedAt: timestamp("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
|
});
|
|
|
|
export const insertVideoSchema = createInsertSchema(videos).omit({
|
|
id: true,
|
|
createdAt: true,
|
|
updatedAt: true,
|
|
});
|
|
|
|
export const updateVideoSchema = createInsertSchema(videos).omit({
|
|
id: true,
|
|
createdAt: true,
|
|
updatedAt: true,
|
|
}).partial();
|
|
|
|
export type InsertVideo = z.infer<typeof insertVideoSchema>;
|
|
export type UpdateVideo = z.infer<typeof updateVideoSchema>;
|
|
export type Video = typeof videos.$inferSelect;
|