This commit is contained in:
Bryan1029384756
2026-04-18 15:41:51 -05:00
parent 938df217f4
commit 593eaba82e
47 changed files with 3539 additions and 212 deletions

View File

@@ -18,6 +18,7 @@ export default defineSchema({
customStatus: v.optional(v.string()),
joinSoundStorageId: v.optional(v.id("_storage")),
accentColor: v.optional(v.string()),
bannerStorageId: v.optional(v.id("_storage")),
}).index("by_username", ["username"]),
categories: defineTable({
@@ -191,6 +192,31 @@ export default defineSchema({
.index("by_poll_user_emoji", ["pollId", "userId", "emoji"])
.index("by_user", ["userId"]),
// Banned users — presence of a row = login + send blocked for that
// user. Unique by `userId` (enforced by the only caller path —
// `bans.ban` does an upsert, not raw insert).
bans: defineTable({
userId: v.id("userProfiles"),
bannedBy: v.id("userProfiles"),
reason: v.optional(v.string()),
createdAt: v.number(),
}).index("by_user", ["userId"]),
// Append-only log of admin-ish actions: channel / role edits, bans,
// server settings changes. Target fields are stringly-typed so
// entries can point at any table without a discriminated union.
auditLog: defineTable({
actorId: v.id("userProfiles"),
action: v.string(),
targetType: v.optional(v.string()),
targetId: v.optional(v.string()),
targetName: v.optional(v.string()),
metadata: v.optional(v.any()),
createdAt: v.number(),
})
.index("by_created_at", ["createdAt"])
.index("by_actor", ["actorId"]),
savedMedia: defineTable({
userId: v.id("userProfiles"),
// Convex storage URL — also the dedupe key for a single user.