Add betting functionality to prediction markets for users
Integrates prediction market betting with new API endpoints, database schema, and client-side UI elements. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 069d4324-6c40-4355-955e-c714a50de1ea Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/069d4324-6c40-4355-955e-c714a50de1ea/6XTzcDL
This commit is contained in:
@ -136,6 +136,17 @@ export const comments = pgTable("comments", {
|
||||
updatedAt: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
// Prediction market bets
|
||||
export const predictionBets = pgTable("prediction_bets", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
marketId: varchar("market_id").notNull(),
|
||||
userId: varchar("user_id").notNull(),
|
||||
side: varchar("side", { enum: ["yes", "no"] }).notNull(),
|
||||
amount: decimal("amount", { precision: 12, scale: 2 }).notNull(),
|
||||
price: decimal("price", { precision: 5, scale: 4 }).notNull(), // Price at time of bet
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
});
|
||||
|
||||
// Insert schemas
|
||||
export const insertUserSchema = createInsertSchema(users).omit({
|
||||
id: true,
|
||||
@ -183,6 +194,11 @@ export const insertCommentSchema = createInsertSchema(comments).omit({
|
||||
updatedAt: true,
|
||||
});
|
||||
|
||||
export const insertPredictionBetSchema = createInsertSchema(predictionBets).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
|
||||
// Types
|
||||
export type UpsertUser = typeof users.$inferInsert;
|
||||
export type User = typeof users.$inferSelect;
|
||||
@ -200,3 +216,5 @@ export type InsertMediaOutletRequest = z.infer<typeof insertMediaOutletRequestSc
|
||||
export type MediaOutletRequest = typeof mediaOutletRequests.$inferSelect;
|
||||
export type InsertComment = z.infer<typeof insertCommentSchema>;
|
||||
export type Comment = typeof comments.$inferSelect;
|
||||
export type InsertPredictionBet = z.infer<typeof insertPredictionBetSchema>;
|
||||
export type PredictionBet = typeof predictionBets.$inferSelect;
|
||||
|
||||
Reference in New Issue
Block a user