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:
parent
246ddc7160
commit
289c3c028a
@ -909,7 +909,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
app.patch('/api/admin/videos/:id', isAdmin, async (req, res) => {
|
app.patch('/api/admin/videos/:id', isAdmin, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const videoId = req.params.id;
|
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);
|
const updateData = updateVideoSchema.parse(req.body);
|
||||||
|
console.log(`Parsed update data:`, JSON.stringify(updateData, null, 2));
|
||||||
|
|
||||||
const updatedVideo = await storage.updateVideo(videoId, updateData);
|
const updatedVideo = await storage.updateVideo(videoId, updateData);
|
||||||
if (!updatedVideo) {
|
if (!updatedVideo) {
|
||||||
|
|||||||
@ -852,6 +852,7 @@ class BunnyStorage implements IStorage {
|
|||||||
// Try to update in database first
|
// Try to update in database first
|
||||||
let dbUpdateSuccessful = false;
|
let dbUpdateSuccessful = false;
|
||||||
try {
|
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));
|
await db.update(videos).set({...updates, updatedAt: new Date()}).where(eq(videos.id, id));
|
||||||
console.log(`Successfully updated video ${id} in database`);
|
console.log(`Successfully updated video ${id} in database`);
|
||||||
dbUpdateSuccessful = true;
|
dbUpdateSuccessful = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user