Refactored schema and added link model.

This commit is contained in:
Daniel
2023-02-14 03:39:13 +03:30
parent cefeb5e7a9
commit d19204f4c0
10 changed files with 101 additions and 79 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ export const authOptions: AuthOptions = {
credentials: {},
async authorize(credentials, req) {
const { email, password } = credentials as {
id: string;
id: number;
email: string;
password: string;
};
@@ -50,7 +50,7 @@ export const authOptions: AuthOptions = {
},
callbacks: {
session: async ({ session, token }) => {
session.user.id = token?.sub;
session.user.id = parseInt(token?.sub as any);
return session;
},
+3 -10
View File
@@ -38,16 +38,9 @@ export default async function handler(
email: body.email,
password: hashedPassword,
collections: {
create: [
{
role: "owner",
collection: {
create: {
name: "First Collection",
},
},
},
],
create: {
name: "First Collection",
},
},
},
});