photoSubmissions: defineTable({
profileId: v.id("guestProfiles"),
orderId: v.id("orders"),
tableId: v.id("tables"),
imageUrl: v.string(),
caption: v.optional(v.string()),
likeCount: v.number(),
status: v.union(v.literal("ACTIVE"), v.literal("HIDDEN")),
winner: v.boolean(),
showDate: v.string(),
createdAt: v.number(),
})
.index("by_show_date", ["showDate"])
.index("by_profile", ["profileId"])
.index("by_status", ["status"])
.index("by_likes", ["likeCount", "status"]);
photoLikes: defineTable({
submissionId: v.id("photoSubmissions"),
profileId: v.id("guestProfiles"),
createdAt: v.number(),
})
.index("by_submission", ["submissionId"])
.index("by_profile_submission", ["profileId", "submissionId"]);