mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
feat(reels): add real-time generation progress tracking on dashboard (desktop & mobile)
This commit is contained in:
1 parent
11b5ef0ad2
commit
e1c6b51e0a
7 files changed
+209
-6
No files matched your search
@@ -68,6 +68,7 @@ export interface IStorage {
|
||||
getPostWithMedia(id: string): Promise<{ post: Post; media: Media[] } | undefined>;
|
||||
createPost(post: InsertPost): Promise<Post>;
|
||||
updatePost(id: string, post: Partial<InsertPost>): Promise<Post>;
|
||||
updatePostGenerationStatus(id: string, status: string, progress: number, error?: string): Promise<Post>;
|
||||
deletePost(id: string): Promise<void>;
|
||||
updatePostMedia(postId: string, mediaIds: string[]): Promise<void>;
|
||||
|
||||
@@ -257,6 +258,28 @@ export class DatabaseStorage implements IStorage {
|
||||
await db.delete(posts).where(eq(posts.id, id));
|
||||
}
|
||||
|
||||
async updatePostGenerationStatus(
|
||||
id: string,
|
||||
status: string,
|
||||
progress: number,
|
||||
error?: string
|
||||
): Promise<Post> {
|
||||
const updateData: Record<string, unknown> = {
|
||||
generationStatus: status,
|
||||
generationProgress: progress,
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
if (error !== undefined) {
|
||||
updateData.generationError = error;
|
||||
}
|
||||
const [updated] = await db
|
||||
.update(posts)
|
||||
.set(updateData)
|
||||
.where(eq(posts.id, id))
|
||||
.returning();
|
||||
return updated;
|
||||
}
|
||||
|
||||
async updatePostMedia(postId: string, mediaIds: string[]): Promise<void> {
|
||||
await db.delete(postMedia).where(eq(postMedia.postId, postId));
|
||||
|
||||
|
||||
Reference in new issue
Block a user