From 2ea8ecb0ff169fd2360cc3028558f6b2fb23299d Mon Sep 17 00:00:00 2001 From: kimjaehyeon0101 <47347352-kimjaehyeon0101@users.noreply.replit.com> Date: Tue, 14 Oct 2025 09:25:20 +0000 Subject: [PATCH] Add community features for media outlets and their users Implement database schemas for community posts and replies, mimicking DC Inside functionality. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9a264234-c5d7-4dcc-adf3-a954b149b30d Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/9a264234-c5d7-4dcc-adf3-a954b149b30d/6ZMblp5 --- shared/schema.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/shared/schema.ts b/shared/schema.ts index 90bb8db..7b1851a 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -153,6 +153,33 @@ export const predictionBets = pgTable("prediction_bets", { createdAt: timestamp("created_at").defaultNow(), }); +// Community posts (DC Inside-style gallery posts) +export const communityPosts = pgTable("community_posts", { + id: varchar("id").primaryKey().default(sql`gen_random_uuid()`), + mediaOutletId: varchar("media_outlet_id").notNull(), + authorId: varchar("author_id").notNull(), + title: varchar("title").notNull(), + content: text("content").notNull(), + imageUrl: varchar("image_url"), + viewCount: integer("view_count").default(0), + likeCount: integer("like_count").default(0), + replyCount: integer("reply_count").default(0), + isPinned: boolean("is_pinned").default(false), + isNotice: boolean("is_notice").default(false), + createdAt: timestamp("created_at").defaultNow(), + updatedAt: timestamp("updated_at").defaultNow(), +}); + +// Community post replies +export const communityReplies = pgTable("community_replies", { + id: varchar("id").primaryKey().default(sql`gen_random_uuid()`), + postId: varchar("post_id").notNull(), + authorId: varchar("author_id").notNull(), + content: text("content").notNull(), + createdAt: timestamp("created_at").defaultNow(), + updatedAt: timestamp("updated_at").defaultNow(), +}); + // Insert schemas export const insertUserSchema = createInsertSchema(users).omit({ id: true, @@ -206,6 +233,18 @@ export const insertPredictionBetSchema = createInsertSchema(predictionBets).omit createdAt: true, }); +export const insertCommunityPostSchema = createInsertSchema(communityPosts).omit({ + id: true, + createdAt: true, + updatedAt: true, +}); + +export const insertCommunityReplySchema = createInsertSchema(communityReplies).omit({ + id: true, + createdAt: true, + updatedAt: true, +}); + // Types export type UpsertUser = typeof users.$inferInsert; export type User = typeof users.$inferSelect; @@ -225,3 +264,7 @@ export type InsertComment = z.infer; export type Comment = typeof comments.$inferSelect; export type InsertPredictionBet = z.infer; export type PredictionBet = typeof predictionBets.$inferSelect; +export type InsertCommunityPost = z.infer; +export type CommunityPost = typeof communityPosts.$inferSelect; +export type InsertCommunityReply = z.infer; +export type CommunityReply = typeof communityReplies.$inferSelect;