UNPKG

@clipwhisperer/common

Version:

ClipWhisperer Common - Shared library providing core utilities, database schemas, authentication, bucket management, and common functionality across all ClipWhisperer microservices

90 lines (89 loc) 3.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.videoTagsSchema = exports.videosSchema = exports.getVideoByIdOutputSchema = exports.getVideoByIdInputSchema = exports.getVideoByTagsOutputSchema = exports.getVideoByTagsInputSchema = exports.getVideosOutputSchema = exports.getVideosInputSchema = exports.postVideoOutputSchema = exports.postVideoInputSchema = void 0; const zod_1 = require("zod"); const schema_1 = require("../db/schema"); exports.postVideoInputSchema = zod_1.z.object({ title: zod_1.z.string(), description: zod_1.z.string(), youtube_id: zod_1.z.string(), thumbnail: zod_1.z.string(), duration: zod_1.z.number(), size: zod_1.z.number(), likes: zod_1.z.number(), views: zod_1.z.number(), published_at: zod_1.z.string(), }); exports.postVideoOutputSchema = zod_1.z.object({ success: zod_1.z.boolean(), message: zod_1.z.string(), }); exports.getVideosInputSchema = zod_1.z.object({ limit: zod_1.z.number().optional().describe("Maximum number of videos to return"), offset: zod_1.z.number().optional().describe("Number of videos to skip"), sortBy: zod_1.z .string() .optional() .describe("Field to sort by (title, published_at, views, likes)"), sortOrder: zod_1.z.string().optional().describe("Sort order (asc, desc)"), }); exports.getVideosOutputSchema = zod_1.z.object({ success: zod_1.z.boolean(), message: zod_1.z.string(), videos: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), title: zod_1.z.string(), duration: zod_1.z.number(), description: zod_1.z.string(), thumbnail: zod_1.z.string(), size: zod_1.z.number(), likes: zod_1.z.number(), views: zod_1.z.number(), published_at: zod_1.z.string(), videoTags: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), name: zod_1.z.string(), })), })), pagination: zod_1.z.object({ total: zod_1.z.number(), limit: zod_1.z.number(), offset: zod_1.z.number(), hasMore: zod_1.z.boolean(), }), }); exports.getVideoByTagsInputSchema = zod_1.z.object({ tags: zod_1.z.array(zod_1.z.string()), }); exports.getVideoByTagsOutputSchema = zod_1.z.object({ success: zod_1.z.boolean(), message: zod_1.z.string(), videos: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), title: zod_1.z.string(), })), }); exports.getVideoByIdInputSchema = zod_1.z.object({ id: zod_1.z.string().min(1, "ID cannot be empty"), }); exports.getVideoByIdOutputSchema = zod_1.z.object({ success: zod_1.z.boolean(), message: zod_1.z.string(), video: zod_1.z.object({ id: zod_1.z.string(), title: zod_1.z.string(), duration: zod_1.z.number(), description: zod_1.z.string(), thumbnail: zod_1.z.string(), size: zod_1.z.number(), likes: zod_1.z.number(), views: zod_1.z.number(), published_at: zod_1.z.string(), videoTags: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), name: zod_1.z.string(), })), }), }); exports.videosSchema = schema_1.videos.$inferSelect; exports.videoTagsSchema = schema_1.video_tags.$inferSelect;