Update post creation to support multiple media items and carousels

Refactor post creation logic in `server/routes.ts` to handle an array of media items (`mediaIds`) for posts, supporting both single media and carousel formats. Implement validation for a maximum of 10 media items and ensure stories have at least one media. Modify `server/storage.ts` to order media by `displayOrder` when retrieving post media.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/WzkpF6q
This commit is contained in:
michaelschal committed 2025-10-08 20:07:12 +00:00
1 parent b2df4ee031
commit 3d4ceaa5d8
3 files changed
+44 -10

No files matched your search

+2 -2
View File
@@ -30,7 +30,7 @@ import {
type InsertUserPagePermission,
} from "@shared/schema";
import { db } from "./db";
import { eq, and, gte, lte, desc, isNull } from "drizzle-orm";
import { eq, and, gte, lte, desc, asc, isNull } from "drizzle-orm";
export interface IStorage {
// Users
@@ -168,7 +168,7 @@ export class DatabaseStorage implements IStorage {
}
async getPostMedia(postId: string): Promise<PostMedia[]> {
return await db.select().from(postMedia).where(eq(postMedia.postId, postId));
return await db.select().from(postMedia).where(eq(postMedia.postId, postId)).orderBy(asc(postMedia.displayOrder));
}
// Posts