lucia auth with user roles
just starting out with convex and while still learning about schemas and mutations with convex here.
how can i add another field in the numbers tables from the example on github, field would be simply
users_id
to attach user to numbers (which they created)
end goal: to create new table with user roles.
ref: https://stack.convex.dev/convex-with-lucia
import { defineSchema, defineTable } from "convex/server";
import { authTables } from "@convex-dev/convex-lucia-auth";
import { v } from "convex/values";
export default defineSchema(
{
...authTables({
user: {
email: v.string(),
},
session: {},
}),
numbers: defineTable({
user: v.id(authTables.users._id)
value: v.number(),
}),
},
{ schemaValidation: true },
);Custom Authentication (with Lucia)
Learn how to build a full stack app with authentication without any third-party auth providers, using Convex and the Lucia library.
1 Reply
Is the name of the table "user" in your dashboard? If so, you can have a reference with
v.id("user")