mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-19 13:08:12 +02:00
Update post scheduling to correctly handle date conversions
Correctly parse the `scheduledFor` date string into a Date object to resolve a Zod validation error when creating posts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/sjuGm8z
This commit is contained in:
1 parent
a987b53de9
commit
02892686a1
3 files changed
+187
No files matched your search
@@ -445,6 +445,11 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
const userId = user.id;
|
||||
const { pageIds, postType, mediaId, ...postFields } = req.body;
|
||||
|
||||
// Convert scheduledFor string to Date if provided
|
||||
if (postFields.scheduledFor && typeof postFields.scheduledFor === 'string') {
|
||||
postFields.scheduledFor = new Date(postFields.scheduledFor);
|
||||
}
|
||||
|
||||
// Create the post
|
||||
const postData = insertPostSchema.parse({ ...postFields, userId });
|
||||
const post = await storage.createPost(postData);
|
||||
|
||||
Reference in new issue
Block a user