Login
-
)
diff --git a/saraia/auth/auth.ts b/saraia/auth/auth.ts
index f331728..2966298 100644
--- a/saraia/auth/auth.ts
+++ b/saraia/auth/auth.ts
@@ -6,52 +6,32 @@ import { User } from "next-auth";
import { DrizzleAdapter } from "@auth/drizzle-adapter";
import NextAuth from "next-auth";
import * as tables from "@/lib/schema"
+import { table } from "console";
+import Resend from "next-auth/providers/resend"
+import {loadEnvConfig} from "@next/env";
+import { config } from "process";
+const projectDir = process.cwd();
+loadEnvConfig(projectDir);
+
-declare module "next-auth" {
- interface AdapterUser extends User {userID:number}
-}
export const { auth, handlers, signIn, signOut } = NextAuth({
- adapter: DrizzleAdapter(db, {
- usersTable: tables.users,
- accountsTable: tables.account,
- sessionsTable: tables.sessions,
- }),
- providers: [CredentialsProvider({
- credentials: {
- email: { type: 'text' },
- password: { type: 'password' },
- },
- async authorize(credentials, req) {
- try {
- if (!credentials || !credentials.email || !credentials.password) {
- throw new Error("Missing credentials");
- }
-
- const response = await db.execute(sql`SELECT * FROM users WHERE email=${credentials.email}`);
- const user = response.rows[0];
- if (!user) {
- throw new Error("No user found with this email");
- }
-
- const password = user.password as string;
- const passwordCorrect = await compare(credentials.password, password);
-
- if (passwordCorrect) {
- return {
- email: user.email as string,
- name: user.username as string,
- userID: user.id_user as number,
- } as User;
- } else {
- throw new Error("Incorrect password");
+ adapter: DrizzleAdapter(db),
+ providers:[Resend({
+ apiKey: process.env.AUTH_RESEND_KEY,
+ id:'email',
+ name:'email',
+ server: {
+ host: process.env.EMAIL_SERVER_HOST,
+ port: process.env.EMAIL_SERVER_PORT,
+ auth: {
+ user: process.env.EMAIL_SERVER_USER,
+ pass: process.env.EMAIL_SERVER_PASSWORD
}
- } catch (error) {
- console.error("Authorization error:", error);
- return null; // Return null in case of any errors during authorization
- }
- },
-}),],
+ },
+ from:process.env.EMAIL_FROM,
+ }
+)],
})
\ No newline at end of file
diff --git a/saraia/drizzle/0000_skinny_shape.sql b/saraia/drizzle/0000_skinny_shape.sql
new file mode 100644
index 0000000..c0f74dc
--- /dev/null
+++ b/saraia/drizzle/0000_skinny_shape.sql
@@ -0,0 +1,112 @@
+-- Current sql file was generated after introspecting the database
+-- If you want to run this migration please uncomment this code before executing migrations
+/*
+CREATE TABLE IF NOT EXISTS "admins" (
+ "id_admin" serial PRIMARY KEY NOT NULL,
+ "id_user" integer
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "jobtitles" (
+ "id_jobtitle" serial PRIMARY KEY NOT NULL,
+ "title" varchar(50) NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "users" (
+ "id_user" serial PRIMARY KEY NOT NULL,
+ "username" varchar(50) NOT NULL,
+ "password" varchar(73) NOT NULL,
+ "datecreated" timestamp DEFAULT now(),
+ "creatoradminid" integer,
+ "email" varchar(320),
+ "emailverified" timestamp,
+ "image" text
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "team" (
+ "id_team" serial PRIMARY KEY NOT NULL,
+ "team_name" varchar(50) NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "userteamposition" (
+ "id_ustepo" serial PRIMARY KEY NOT NULL,
+ "id_user" integer,
+ "id_team" integer,
+ "id_jobtitle" integer
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "feedback" (
+ "id_feedback" serial PRIMARY KEY NOT NULL,
+ "Performance" integer,
+ "well_being" integer,
+ "flow" integer,
+ "communication" integer,
+ "activity" integer,
+ "collaboration" integer,
+ "efficiency" integer,
+ "satisfaction" integer,
+ "thread_id" varchar(64),
+ "id_user" integer,
+ "id_team" integer,
+ "feedback_time" timestamp
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "messages" (
+ "id_message" serial PRIMARY KEY NOT NULL,
+ "message" varchar(9999),
+ "messagedate" timestamp with time zone DEFAULT now(),
+ "id_user" integer,
+ "id_team" integer,
+ "email" varchar(320),
+ "thread_id" varchar(64)
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "user_messages" (
+ "id_usermessage" serial PRIMARY KEY NOT NULL,
+ "message" varchar(9999),
+ "messagedate" timestamp with time zone DEFAULT now(),
+ "id_user" integer,
+ "id_team" integer,
+ "email" varchar(320),
+ "thread_id" varchar(64)
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "session" (
+ "sessionToken" text PRIMARY KEY NOT NULL,
+ "userid" integer,
+ "expires" timestamp
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "account" (
+ "compoundkey" integer PRIMARY KEY NOT NULL,
+ "userid" integer,
+ "type" text,
+ "provider" text,
+ "provideraccountid" text,
+ "refresh_token" text,
+ "access_tokken" text,
+ "expires_at" integer,
+ "token_type" text,
+ "scope" text,
+ "id_tokken" text,
+ "session_state" text
+);
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "userteamposition" ADD CONSTRAINT "userteamposition_id_jobtitle_jobtitles_id_jobtitle_fk" FOREIGN KEY ("id_jobtitle") REFERENCES "public"."jobtitles"("id_jobtitle") ON DELETE no action ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "session" ADD CONSTRAINT "fk_id_puserid" FOREIGN KEY ("userid") REFERENCES "public"."users"("id_user") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "account" ADD CONSTRAINT "fk_id_auserid" FOREIGN KEY ("userid") REFERENCES "public"."users"("id_user") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+
+*/
\ No newline at end of file
diff --git a/saraia/drizzle/meta/0000_snapshot.json b/saraia/drizzle/meta/0000_snapshot.json
new file mode 100644
index 0000000..1e87fa6
--- /dev/null
+++ b/saraia/drizzle/meta/0000_snapshot.json
@@ -0,0 +1,523 @@
+{
+ "id": "00000000-0000-0000-0000-000000000000",
+ "prevId": "",
+ "version": "5",
+ "dialect": "pg",
+ "tables": {
+ "admins": {
+ "name": "admins",
+ "schema": "",
+ "columns": {
+ "id_admin": {
+ "name": "id_admin",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "id_user": {
+ "name": "id_user",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "jobtitles": {
+ "name": "jobtitles",
+ "schema": "",
+ "columns": {
+ "id_jobtitle": {
+ "name": "id_jobtitle",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "users": {
+ "name": "users",
+ "schema": "",
+ "columns": {
+ "id_user": {
+ "name": "id_user",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "password": {
+ "name": "password",
+ "type": "varchar(73)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "datecreated": {
+ "name": "datecreated",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "creatoradminid": {
+ "name": "creatoradminid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(320)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "emailverified": {
+ "name": "emailverified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id_team": {
+ "name": "id_team",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_name": {
+ "name": "team_name",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "userteamposition": {
+ "name": "userteamposition",
+ "schema": "",
+ "columns": {
+ "id_ustepo": {
+ "name": "id_ustepo",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "id_user": {
+ "name": "id_user",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_team": {
+ "name": "id_team",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_jobtitle": {
+ "name": "id_jobtitle",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "userteamposition_id_jobtitle_jobtitles_id_jobtitle_fk": {
+ "name": "userteamposition_id_jobtitle_jobtitles_id_jobtitle_fk",
+ "tableFrom": "userteamposition",
+ "tableTo": "jobtitles",
+ "schemaTo": "public",
+ "columnsFrom": [
+ "id_jobtitle"
+ ],
+ "columnsTo": [
+ "id_jobtitle"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "feedback": {
+ "name": "feedback",
+ "schema": "",
+ "columns": {
+ "id_feedback": {
+ "name": "id_feedback",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "Performance": {
+ "name": "Performance",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "well_being": {
+ "name": "well_being",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "flow": {
+ "name": "flow",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "communication": {
+ "name": "communication",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activity": {
+ "name": "activity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "collaboration": {
+ "name": "collaboration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "efficiency": {
+ "name": "efficiency",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "satisfaction": {
+ "name": "satisfaction",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_user": {
+ "name": "id_user",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_team": {
+ "name": "id_team",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feedback_time": {
+ "name": "feedback_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "messages": {
+ "name": "messages",
+ "schema": "",
+ "columns": {
+ "id_message": {
+ "name": "id_message",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "varchar(9999)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "messagedate": {
+ "name": "messagedate",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "id_user": {
+ "name": "id_user",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_team": {
+ "name": "id_team",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(320)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "user_messages": {
+ "name": "user_messages",
+ "schema": "",
+ "columns": {
+ "id_usermessage": {
+ "name": "id_usermessage",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "varchar(9999)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "messagedate": {
+ "name": "messagedate",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "id_user": {
+ "name": "id_user",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_team": {
+ "name": "id_team",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(320)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userid": {
+ "name": "userid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "fk_id_puserid": {
+ "name": "fk_id_puserid",
+ "tableFrom": "session",
+ "tableTo": "users",
+ "schemaTo": "public",
+ "columnsFrom": [
+ "userid"
+ ],
+ "columnsTo": [
+ "id_user"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "compoundkey": {
+ "name": "compoundkey",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userid": {
+ "name": "userid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provideraccountid": {
+ "name": "provideraccountid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_tokken": {
+ "name": "access_tokken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_tokken": {
+ "name": "id_tokken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "fk_id_auserid": {
+ "name": "fk_id_auserid",
+ "tableFrom": "account",
+ "tableTo": "users",
+ "schemaTo": "public",
+ "columnsFrom": [
+ "userid"
+ ],
+ "columnsTo": [
+ "id_user"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ }
+}
\ No newline at end of file
diff --git a/saraia/drizzle/meta/_journal.json b/saraia/drizzle/meta/_journal.json
new file mode 100644
index 0000000..daf5ad1
--- /dev/null
+++ b/saraia/drizzle/meta/_journal.json
@@ -0,0 +1,13 @@
+{
+ "version": "5",
+ "dialect": "pg",
+ "entries": [
+ {
+ "idx": 0,
+ "version": "5",
+ "when": 1718251828874,
+ "tag": "0000_skinny_shape",
+ "breakpoints": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/saraia/lib/schema.ts b/saraia/lib/schema.ts
index 09778bb..b445fba 100644
--- a/saraia/lib/schema.ts
+++ b/saraia/lib/schema.ts
@@ -1,6 +1,16 @@
-import { pgTable, serial, integer, varchar, timestamp, text, foreignKey } from "drizzle-orm/pg-core"
- import { sql } from "drizzle-orm"
-
+import {
+ boolean,
+ timestamp,
+ pgTable,
+ text,
+ primaryKey,
+ integer,
+ serial,
+ varchar
+ } from "drizzle-orm/pg-core"
+ import postgres from "postgres"
+ import { drizzle } from "drizzle-orm/postgres-js"
+ import type { AdapterAccountType } from "next-auth/adapters"
export const admins = pgTable("admins", {
@@ -13,16 +23,85 @@ export const jobtitles = pgTable("jobtitles", {
title: varchar("title", { length: 50 }).notNull(),
});
-export const users = pgTable("users", {
- idUser: serial("id_user").primaryKey().notNull(),
- username: varchar("username", { length: 50 }).notNull(),
- password: varchar("password", { length: 73 }).notNull(),
- datecreated: timestamp("datecreated", { mode: 'string' }).defaultNow(),
- creatoradminid: integer("creatoradminid"),
- email: varchar("email", { length: 320 }),
- emailverified: timestamp("emailverified", { mode: 'string' }),
+export const users = pgTable("user", {
+ id: text("id")
+ .primaryKey()
+ .$defaultFn(() => crypto.randomUUID()),
+ name: text("name"),
+ email: text("email").notNull(),
+ emailVerified: timestamp("emailVerified", { mode: "date" }),
image: text("image"),
-});
+ })
+ export const accounts = pgTable(
+ "account",
+ {
+ userId: text("userId")
+ .notNull()
+ .references(() => users.id, { onDelete: "cascade" }),
+ type: text("type").$type
().notNull(),
+ provider: text("provider").notNull(),
+ providerAccountId: text("providerAccountId").notNull(),
+ refresh_token: text("refresh_token"),
+ access_token: text("access_token"),
+ expires_at: integer("expires_at"),
+ token_type: text("token_type"),
+ scope: text("scope"),
+ id_token: text("id_token"),
+ session_state: text("session_state"),
+ },
+ (account) => ({
+ compoundKey: primaryKey({
+ columns: [account.provider, account.providerAccountId],
+ }),
+ })
+ )
+
+ export const sessions = pgTable("session", {
+ id: text("id")
+ .primaryKey()
+ .$defaultFn(() => crypto.randomUUID()),
+ sessionToken: text("sessionToken").primaryKey(),
+ userId: text("userId")
+ .notNull()
+ .references(() => users.id, { onDelete: "cascade" }),
+ expires: timestamp("expires", { mode: "date" }).notNull(),
+ })
+
+ export const verificationTokens = pgTable(
+ "verificationToken",
+ {
+ identifier: text("identifier").notNull(),
+ token: text("token").notNull(),
+ expires: timestamp("expires", { mode: "date" }).notNull(),
+ },
+ (verificationToken) => ({
+ compositePk: primaryKey({
+ columns: [verificationToken.identifier, verificationToken.token],
+ }),
+ })
+ )
+
+ export const authenticators = pgTable(
+ "authenticator",
+ {
+ credentialID: text("credentialID").notNull().unique(),
+ userId: text("userId")
+ .notNull()
+ .references(() => users.id, { onDelete: "cascade" }),
+ providerAccountId: text("providerAccountId").notNull(),
+ credentialPublicKey: text("credentialPublicKey").notNull(),
+ counter: integer("counter").notNull(),
+ credentialDeviceType: text("credentialDeviceType").notNull(),
+ credentialBackedUp: boolean("credentialBackedUp").notNull(),
+ transports: text("transports"),
+ },
+ (authenticator) => ({
+ compositePK: primaryKey({
+ columns: [authenticator.userId, authenticator.credentialID],
+ }),
+ })
+ )
+
export const team = pgTable("team", {
idTeam: serial("id_team").primaryKey().notNull(),
@@ -71,26 +150,3 @@ export const userMessages = pgTable("user_messages", {
email: varchar("email", { length: 320 }),
threadId: varchar("thread_id", { length: 64 }),
});
-
-export const sessions = pgTable("session", {
- sessionToken: text("sessionToken").primaryKey(),
- userId: text("userId")
- .notNull()
- .references(() => users.idUser, { onDelete: "cascade" }),
- expires: timestamp("expires", { mode: "date" }).notNull(),
- })
-
-export const account = pgTable("account", {
- compoundkey: integer("compoundkey").primaryKey().notNull(),
- userid: integer("userid").references(() => users.idUser, { onDelete: "cascade" } ),
- type: text("type"),
- provider: text("provider"),
- provideraccountid: text("provideraccountid"),
- refreshToken: text("refresh_token"),
- accessTokken: text("access_tokken"),
- expiresAt: integer("expires_at"),
- tokenType: text("token_type"),
- scope: text("scope"),
- idTokken: text("id_tokken"),
- sessionState: text("session_state"),
-});
\ No newline at end of file
diff --git a/saraia/package-lock.json b/saraia/package-lock.json
index 177eb7b..7452a86 100644
--- a/saraia/package-lock.json
+++ b/saraia/package-lock.json
@@ -29,6 +29,7 @@
"next-auth": "^5.0.0-beta.19",
"pg": "^8.11.5",
"pnpm": "^9.0.5",
+ "postgres": "^3.4.4",
"radix-ui": "^1.0.1",
"react": "^18",
"react-chartjs-2": "^5.2.0",
@@ -7267,6 +7268,18 @@
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
},
+ "node_modules/postgres": {
+ "version": "3.4.4",
+ "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.4.4.tgz",
+ "integrity": "sha512-IbyN+9KslkqcXa8AO9fxpk97PA4pzewvpi2B3Dwy9u4zpV32QicaEdgmF3eSQUzdRk7ttDHQejNgAEr4XoeH4A==",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/porsager"
+ }
+ },
"node_modules/postgres-array": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
diff --git a/saraia/package.json b/saraia/package.json
index 61b2152..adda6ed 100644
--- a/saraia/package.json
+++ b/saraia/package.json
@@ -30,6 +30,7 @@
"next-auth": "^5.0.0-beta.19",
"pg": "^8.11.5",
"pnpm": "^9.0.5",
+ "postgres": "^3.4.4",
"radix-ui": "^1.0.1",
"react": "^18",
"react-chartjs-2": "^5.2.0",