- Introduced user status management with the ability to update online, busy, offline, and away statuses. - Added metadata fields for user preferences, including phrase preferences and friends list. - Updated API and database schema to accommodate new user fields. - Enhanced the authentication component to handle additional user data effectively. - Implemented hooks for socket management and OLM setup to improve user experience.
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
// This file is auto-generated. Do not edit this file manually.
|
|
// To regenerate the schema, run:
|
|
// `npx @better-auth/cli generate --output undefined -y`
|
|
|
|
import { defineSchema, defineTable } from "convex/server";
|
|
import { v } from "convex/values";
|
|
|
|
export const tables = {
|
|
user: defineTable({
|
|
name: v.string(),
|
|
email: v.string(),
|
|
emailVerified: v.boolean(),
|
|
image: v.optional(v.union(v.null(), v.string())),
|
|
createdAt: v.number(),
|
|
updatedAt: v.number(),
|
|
userId: v.optional(v.union(v.null(), v.string())),
|
|
username: v.optional(v.union(v.null(), v.string())),
|
|
displayUsername: v.optional(v.union(v.null(), v.string())),
|
|
metadata: v.optional(v.object({
|
|
phrasePreference: v.union(v.literal("comforting"), v.literal("mocking"), v.literal("both")),
|
|
})),
|
|
status: v.optional(v.object({
|
|
status: v.union(v.literal("online"), v.literal("busy"), v.literal("offline"), v.literal("away")),
|
|
isUserSet: v.boolean(),
|
|
})),
|
|
friends: v.optional(v.array(v.string())),
|
|
})
|
|
.index("email_name", ["email", "name"])
|
|
.index("name", ["name"])
|
|
.index("userId", ["userId"])
|
|
.index("username", ["username"])
|
|
.index("status", ["status"])
|
|
.index("friends", ["friends"]),
|
|
session: defineTable({
|
|
expiresAt: v.number(),
|
|
token: v.string(),
|
|
createdAt: v.number(),
|
|
updatedAt: v.number(),
|
|
ipAddress: v.optional(v.union(v.null(), v.string())),
|
|
userAgent: v.optional(v.union(v.null(), v.string())),
|
|
userId: v.string(),
|
|
})
|
|
.index("expiresAt", ["expiresAt"])
|
|
.index("expiresAt_userId", ["expiresAt", "userId"])
|
|
.index("token", ["token"])
|
|
.index("userId", ["userId"]),
|
|
account: defineTable({
|
|
accountId: v.string(),
|
|
providerId: v.string(),
|
|
userId: v.string(),
|
|
accessToken: v.optional(v.union(v.null(), v.string())),
|
|
refreshToken: v.optional(v.union(v.null(), v.string())),
|
|
idToken: v.optional(v.union(v.null(), v.string())),
|
|
accessTokenExpiresAt: v.optional(v.union(v.null(), v.number())),
|
|
refreshTokenExpiresAt: v.optional(v.union(v.null(), v.number())),
|
|
scope: v.optional(v.union(v.null(), v.string())),
|
|
password: v.optional(v.union(v.null(), v.string())),
|
|
createdAt: v.number(),
|
|
updatedAt: v.number(),
|
|
})
|
|
.index("accountId", ["accountId"])
|
|
.index("accountId_providerId", ["accountId", "providerId"])
|
|
.index("providerId_userId", ["providerId", "userId"])
|
|
.index("userId", ["userId"]),
|
|
verification: defineTable({
|
|
identifier: v.string(),
|
|
value: v.string(),
|
|
expiresAt: v.number(),
|
|
createdAt: v.number(),
|
|
updatedAt: v.number(),
|
|
})
|
|
.index("expiresAt", ["expiresAt"])
|
|
.index("identifier", ["identifier"]),
|
|
jwks: defineTable({
|
|
publicKey: v.string(),
|
|
privateKey: v.string(),
|
|
createdAt: v.number(),
|
|
}),
|
|
olmAccount: defineTable({
|
|
userId: v.string(),
|
|
identityKey: v.object({
|
|
curve25519: v.string(),
|
|
ed25519: v.string(),
|
|
}),
|
|
oneTimeKeys: v.array(v.object({
|
|
keyId: v.string(),
|
|
publicKey: v.string(),
|
|
})),
|
|
})
|
|
.index("userId", ["userId"]),
|
|
};
|
|
|
|
const schema = defineSchema(tables);
|
|
|
|
export default schema;
|