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
This commit is contained in:
kimjaehyeon0101
2025-10-14 09:25:20 +00:00
parent a60c55aa5d
commit 2ea8ecb0ff

View File

@ -153,6 +153,33 @@ export const predictionBets = pgTable("prediction_bets", {
createdAt: timestamp("created_at").defaultNow(), 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 // Insert schemas
export const insertUserSchema = createInsertSchema(users).omit({ export const insertUserSchema = createInsertSchema(users).omit({
id: true, id: true,
@ -206,6 +233,18 @@ export const insertPredictionBetSchema = createInsertSchema(predictionBets).omit
createdAt: true, 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 // Types
export type UpsertUser = typeof users.$inferInsert; export type UpsertUser = typeof users.$inferInsert;
export type User = typeof users.$inferSelect; export type User = typeof users.$inferSelect;
@ -225,3 +264,7 @@ export type InsertComment = z.infer<typeof insertCommentSchema>;
export type Comment = typeof comments.$inferSelect; export type Comment = typeof comments.$inferSelect;
export type InsertPredictionBet = z.infer<typeof insertPredictionBetSchema>; export type InsertPredictionBet = z.infer<typeof insertPredictionBetSchema>;
export type PredictionBet = typeof predictionBets.$inferSelect; export type PredictionBet = typeof predictionBets.$inferSelect;
export type InsertCommunityPost = z.infer<typeof insertCommunityPostSchema>;
export type CommunityPost = typeof communityPosts.$inferSelect;
export type InsertCommunityReply = z.infer<typeof insertCommunityReplySchema>;
export type CommunityReply = typeof communityReplies.$inferSelect;