Update video details in the administration panel

Add logging to the /api/admin/videos/:id PATCH endpoint and the BunnyStorage updateVideo method in server/storage.ts to capture video update requests and parsed data.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/n7jzC7R
This commit is contained in:
sebastjanartic 2025-09-02 14:19:26 +00:00
parent 246ddc7160
commit 289c3c028a
2 changed files with 3 additions and 0 deletions

View File

@ -909,7 +909,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
app.patch('/api/admin/videos/:id', isAdmin, async (req, res) => {
try {
const videoId = req.params.id;
console.log(`PATCH request for video ${videoId} with body:`, JSON.stringify(req.body, null, 2));
const updateData = updateVideoSchema.parse(req.body);
console.log(`Parsed update data:`, JSON.stringify(updateData, null, 2));
const updatedVideo = await storage.updateVideo(videoId, updateData);
if (!updatedVideo) {

View File

@ -852,6 +852,7 @@ class BunnyStorage implements IStorage {
// Try to update in database first
let dbUpdateSuccessful = false;
try {
console.log(`Updating video ${id} with data:`, JSON.stringify(updates, null, 2));
await db.update(videos).set({...updates, updatedAt: new Date()}).where(eq(videos.id, id));
console.log(`Successfully updated video ${id} in database`);
dbUpdateSuccessful = true;