WIP 4
This commit is contained in:
parent
f62c9f064d
commit
b8c6e893ff
43 changed files with 4721 additions and 1807 deletions
14
apps/metamigo-frontend/app/_lib/authentication.ts
Normal file
14
apps/metamigo-frontend/app/_lib/authentication.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import NextAuth from "next-auth"
|
||||
import GoogleProvider from "next-auth/providers/google"
|
||||
import { KyselyAdapter } from "@auth/kysely-adapter"
|
||||
import { db } from "./database";
|
||||
|
||||
export const authOptions = NextAuth({
|
||||
adapter: KyselyAdapter(db),
|
||||
providers: [
|
||||
GoogleProvider({
|
||||
clientId: process.env.GOOGLE_CLIENT_ID!,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
import { PostgresDialect } from "kysely";
|
||||
import { Pool } from "pg";
|
||||
import { KyselyAuth } from "@auth/kysely-adapter";
|
||||
import { CamelCasePlugin } from "kysely";
|
||||
import type { GeneratedAlways } from "kysely";
|
||||
|
||||
interface Database {
|
||||
User: {
|
||||
id: GeneratedAlways<string>;
|
||||
name: string | null;
|
||||
email: string;
|
||||
emailVerified: Date | null;
|
||||
image: string | null;
|
||||
};
|
||||
|
||||
Account: {
|
||||
id: GeneratedAlways<string>;
|
||||
userId: string;
|
||||
type: string;
|
||||
provider: string;
|
||||
providerAccountId: string;
|
||||
refresh_token: string | null;
|
||||
access_token: string | null;
|
||||
expires_at: number | null;
|
||||
token_type: string | null;
|
||||
scope: string | null;
|
||||
id_token: string | null;
|
||||
session_state: string | null;
|
||||
};
|
||||
|
||||
Session: {
|
||||
id: GeneratedAlways<string>;
|
||||
userId: string;
|
||||
sessionToken: string;
|
||||
expires: Date;
|
||||
};
|
||||
|
||||
VerificationToken: {
|
||||
identifier: string;
|
||||
token: string;
|
||||
expires: Date;
|
||||
};
|
||||
|
||||
WhatsAppBot: {
|
||||
id: GeneratedAlways<string>;
|
||||
userId: string;
|
||||
phone: string;
|
||||
password: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const db = new KyselyAuth<Database>({
|
||||
dialect: new PostgresDialect({
|
||||
pool: new Pool({
|
||||
host: process.env.DATABASE_HOST,
|
||||
database: process.env.DATABASE_NAME,
|
||||
user: process.env.DATABASE_USER,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
}),
|
||||
}),
|
||||
plugins: [new CamelCasePlugin()],
|
||||
});
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import NextAuth from "next-auth";
|
||||
import { authOptions } from "@/app/_lib/authentication";
|
||||
|
||||
const handler = NextAuth(authOptions);
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { GridColDef } from "@mui/x-data-grid-pro";
|
||||
import { List } from "@/app/_components/List";
|
||||
import { List } from "ui";
|
||||
|
||||
export default function Page() {
|
||||
const columns: GridColDef[] = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { GridColDef } from "@mui/x-data-grid-pro";
|
||||
import { List } from "@/app/_components/List";
|
||||
import { List } from "ui";
|
||||
|
||||
export default function Page() {
|
||||
const columns: GridColDef[] = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { GridColDef } from "@mui/x-data-grid-pro";
|
||||
import { List } from "@/app/_components/List";
|
||||
import { List } from "ui";
|
||||
|
||||
export default function Page() {
|
||||
const columns: GridColDef[] = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { GridColDef } from "@mui/x-data-grid-pro";
|
||||
import { List } from "@/app/_components/List";
|
||||
import { List } from "ui";
|
||||
|
||||
export default function Page() {
|
||||
const columns: GridColDef[] = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { GridColDef } from "@mui/x-data-grid-pro";
|
||||
import { List } from "@/app/_components/List";
|
||||
import { List } from "ui";
|
||||
|
||||
export default function Page() {
|
||||
const columns: GridColDef[] = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue