create-apppaaaul 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -1
- package/dist/templates/nextjs-ts-clean/project/.editorconfig +9 -9
- package/dist/templates/nextjs-ts-clean/project/.vscode/launch.json +28 -28
- package/dist/templates/nextjs-ts-clean/project/.vscode/settings.json +8 -8
- package/dist/templates/nextjs-ts-clean/project/README.md +15 -15
- package/dist/templates/nextjs-ts-clean/project/next.config.mjs +13 -13
- package/dist/templates/nextjs-ts-clean/project/package.json +47 -47
- package/dist/templates/nextjs-ts-clean/project/pnpm-lock.yaml +5463 -5463
- package/dist/templates/nextjs-ts-clean/project/postcss.config.js +6 -6
- package/dist/templates/nextjs-ts-clean/project/src/app/globals.css +76 -76
- package/dist/templates/nextjs-ts-clean/project/src/app/layout.tsx +25 -25
- package/dist/templates/nextjs-ts-clean/project/src/app/page.tsx +5 -5
- package/dist/templates/nextjs-ts-clean/project/src/components/ui/button.tsx +49 -49
- package/dist/templates/nextjs-ts-clean/project/src/lib/utils.ts +6 -6
- package/dist/templates/nextjs-ts-clean/project/tailwind.config.ts +79 -79
- package/dist/templates/nextjs-ts-clean/project/tsconfig.json +26 -26
- package/dist/templates/nextjs-ts-landing/project/.editorconfig +9 -9
- package/dist/templates/nextjs-ts-landing/project/.vscode/launch.json +28 -28
- package/dist/templates/nextjs-ts-landing/project/.vscode/settings.json +8 -8
- package/dist/templates/nextjs-ts-landing-drizzle/project/.editorconfig +9 -9
- package/dist/templates/nextjs-ts-landing-drizzle/project/.vscode/launch.json +28 -28
- package/dist/templates/nextjs-ts-landing-drizzle/project/.vscode/settings.json +8 -8
- package/dist/templates/nextjs-ts-landing-drizzle/project/README.md +15 -15
- package/dist/templates/nextjs-ts-landing-drizzle/project/components.json +16 -16
- package/dist/templates/nextjs-ts-landing-drizzle/project/drizzle.config.ts +11 -11
- package/dist/templates/nextjs-ts-landing-drizzle/project/next.config.mjs +10 -10
- package/dist/templates/nextjs-ts-landing-drizzle/project/package.json +56 -56
- package/dist/templates/nextjs-ts-landing-drizzle/project/pnpm-lock.yaml +6248 -6248
- package/dist/templates/nextjs-ts-landing-drizzle/project/postcss.config.js +6 -6
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/app/api/auth/[...nextauth]/route.ts +3 -3
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/app/globals.css +47 -47
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/app/layout.tsx +20 -20
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/app/page.tsx +5 -5
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/auth.ts +79 -79
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/components/ui/button.tsx +49 -49
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/db/index.ts +25 -25
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/db/schema.ts +93 -93
- package/dist/templates/nextjs-ts-landing-drizzle/project/src/lib/utils.ts +6 -6
- package/dist/templates/nextjs-ts-landing-drizzle/project/tailwind.config.ts +80 -80
- package/dist/templates/nextjs-ts-landing-drizzle/project/tsconfig.json +27 -27
- package/dist/templates/nextjs-ts-landing-prisma/project/.editorconfig +9 -9
- package/dist/templates/nextjs-ts-landing-prisma/project/.vscode/launch.json +28 -28
- package/dist/templates/nextjs-ts-landing-prisma/project/.vscode/settings.json +8 -8
- package/dist/templates/nextjs-ts-landing-prisma/project/README.md +15 -15
- package/dist/templates/nextjs-ts-landing-prisma/project/components.json +16 -16
- package/dist/templates/nextjs-ts-landing-prisma/project/next.config.mjs +10 -10
- package/dist/templates/nextjs-ts-landing-prisma/project/package.json +57 -57
- package/dist/templates/nextjs-ts-landing-prisma/project/postcss.config.mjs +4 -4
- package/dist/templates/nextjs-ts-landing-prisma/project/src/app/api/auth/[...nextauth]/route.ts +3 -3
- package/dist/templates/nextjs-ts-landing-prisma/project/src/app/globals.css +116 -116
- package/dist/templates/nextjs-ts-landing-prisma/project/src/app/layout.tsx +20 -20
- package/dist/templates/nextjs-ts-landing-prisma/project/src/app/page.tsx +5 -5
- package/dist/templates/nextjs-ts-landing-prisma/project/src/auth.ts +79 -79
- package/dist/templates/nextjs-ts-landing-prisma/project/src/components/ui/button.tsx +49 -49
- package/dist/templates/nextjs-ts-landing-prisma/project/src/lib/db.ts +10 -10
- package/dist/templates/nextjs-ts-landing-prisma/project/src/lib/utils.ts +6 -6
- package/dist/templates/nextjs-ts-landing-prisma/project/tailwind.config.ts +80 -80
- package/dist/templates/nextjs-ts-landing-prisma/project/tsconfig.json +27 -27
- package/package.json +43 -43
- package/dist/templates/nextjs-ts-landing/project/.eslintrc.cjs +0 -101
- package/dist/templates/nextjs-ts-landing-prisma/project/pnpm-lock.yaml +0 -5854
- package/dist/templates/nextjs-ts-landing-prisma/project/pnpm-workspace.yaml +0 -6
- package/dist/templates/nextjs-ts-landing-prisma/project/prisma/migrations/20250329125127_init/migration.sql +0 -25
- package/dist/templates/nextjs-ts-landing-prisma/project/prisma/migrations/migration_lock.toml +0 -3
- package/dist/templates/nextjs-ts-landing-prisma/project/prisma/schema.prisma +0 -24
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
|
-
@plugin "tailwindcss-animate";
|
|
4
|
-
|
|
5
|
-
:root {
|
|
6
|
-
--background: hsl(0 0% 100%);
|
|
7
|
-
--foreground: hsl(240 10% 3.9%);
|
|
8
|
-
|
|
9
|
-
--card: hsl(0 0% 100%);
|
|
10
|
-
--card-foreground: hsl(240 10% 3.9%);
|
|
11
|
-
|
|
12
|
-
--popover: hsl(0 0% 100%);
|
|
13
|
-
--popover-foreground: hsl(240 10% 3.9%);
|
|
14
|
-
|
|
15
|
-
--primary: hsl(240 5.9% 10%);
|
|
16
|
-
--primary-foreground: hsl(0 0% 98%);
|
|
17
|
-
--secondary: hsl(240 4.8% 95.9%);
|
|
18
|
-
--secondary-foreground: hsl(240 5.9% 10%);
|
|
19
|
-
--muted: hsl(240 4.8% 95.9%);
|
|
20
|
-
--muted-foreground: hsl(240 3.8% 46.1%);
|
|
21
|
-
--accent: hsl(240 4.8% 95.9%);
|
|
22
|
-
--accent-foreground: hsl(240 5.9% 10%);
|
|
23
|
-
--destructive: hsl(0 84.2% 60.2%);
|
|
24
|
-
--destructive-foreground: hsl(0 0% 98%);
|
|
25
|
-
|
|
26
|
-
--border: hsl(240 5.9% 90%);
|
|
27
|
-
--input: hsl(240 5.9% 90%);
|
|
28
|
-
--ring: hsl(240 10% 3.9%);
|
|
29
|
-
|
|
30
|
-
--chart-1: hsl(12 76% 61%);
|
|
31
|
-
--chart-2: hsl(173 58% 39%);
|
|
32
|
-
--chart-3: hsl(197 37% 24%);
|
|
33
|
-
--chart-4: hsl(43 74% 66%);
|
|
34
|
-
--chart-5: hsl(27 87% 67%);
|
|
35
|
-
|
|
36
|
-
--radius: 0.6rem;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@media (prefers-color-scheme: dark) {
|
|
40
|
-
:root {
|
|
41
|
-
--background: hsl(240 10% 3.9%);
|
|
42
|
-
--foreground: hsl(0 0% 98%);
|
|
43
|
-
|
|
44
|
-
--card: hsl(240 10% 3.9%);
|
|
45
|
-
--card-foreground: hsl(0 0% 98%);
|
|
46
|
-
|
|
47
|
-
--popover: hsl(240 10% 3.9%);
|
|
48
|
-
--popover-foreground: hsl(0 0% 98%);
|
|
49
|
-
|
|
50
|
-
--primary: hsl(0 0% 98%);
|
|
51
|
-
--primary-foreground: hsl(240 5.9% 10%);
|
|
52
|
-
--secondary: hsl(240 3.7% 15.9%);
|
|
53
|
-
--secondary-foreground: hsl(0 0% 98%);
|
|
54
|
-
--muted: hsl(240 3.7% 15.9%);
|
|
55
|
-
--muted-foreground: hsl(240 5% 64.9%);
|
|
56
|
-
--accent: hsl(240 3.7% 15.9%);
|
|
57
|
-
--accent-foreground: hsl(0 0% 98%);
|
|
58
|
-
--destructive: hsl(0 62.8% 30.6%);
|
|
59
|
-
--destructive-foreground: hsl(0 0% 98%);
|
|
60
|
-
|
|
61
|
-
--border: hsl(240 3.7% 15.9%);
|
|
62
|
-
--input: hsl(240 3.7% 15.9%);
|
|
63
|
-
--ring: hsl(240 4.9% 83.9%);
|
|
64
|
-
|
|
65
|
-
--chart-1: hsl(220 70% 50%);
|
|
66
|
-
--chart-2: hsl(160 60% 45%);
|
|
67
|
-
--chart-3: hsl(30 80% 55%);
|
|
68
|
-
--chart-4: hsl(280 65% 60%);
|
|
69
|
-
--chart-5: hsl(340 75% 55%);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@theme inline {
|
|
74
|
-
--color-background: var(--background);
|
|
75
|
-
--color-foreground: var(--foreground);
|
|
76
|
-
|
|
77
|
-
--color-card: var(--card);
|
|
78
|
-
--color-card-foreground: var(--card-foreground);
|
|
79
|
-
|
|
80
|
-
--color-popover: var(--popover);
|
|
81
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
82
|
-
|
|
83
|
-
--color-primary: var(--primary);
|
|
84
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
85
|
-
--color-secondary: var(--secondary);
|
|
86
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
87
|
-
--color-muted: var(--muted);
|
|
88
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
89
|
-
--color-accent: var(--accent);
|
|
90
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
91
|
-
--color-destructive: var(--destructive);
|
|
92
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
93
|
-
|
|
94
|
-
--color-border: var(--border);
|
|
95
|
-
--color-input: var(--input);
|
|
96
|
-
--color-ring: var(--ring);
|
|
97
|
-
|
|
98
|
-
--color-chart-1: var(--chart-1);
|
|
99
|
-
--color-chart-2: var(--chart-2);
|
|
100
|
-
--color-chart-3: var(--chart-3);
|
|
101
|
-
--color-chart-4: var(--chart-4);
|
|
102
|
-
--color-chart-5: var(--chart-5);
|
|
103
|
-
|
|
104
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
105
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
106
|
-
--radius-lg: var(--radius);
|
|
107
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@layer base {
|
|
111
|
-
* {
|
|
112
|
-
@apply border-border outline-ring/50;
|
|
113
|
-
}
|
|
114
|
-
body {
|
|
115
|
-
@apply bg-background text-foreground;
|
|
116
|
-
}
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@plugin "tailwindcss-animate";
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--background: hsl(0 0% 100%);
|
|
7
|
+
--foreground: hsl(240 10% 3.9%);
|
|
8
|
+
|
|
9
|
+
--card: hsl(0 0% 100%);
|
|
10
|
+
--card-foreground: hsl(240 10% 3.9%);
|
|
11
|
+
|
|
12
|
+
--popover: hsl(0 0% 100%);
|
|
13
|
+
--popover-foreground: hsl(240 10% 3.9%);
|
|
14
|
+
|
|
15
|
+
--primary: hsl(240 5.9% 10%);
|
|
16
|
+
--primary-foreground: hsl(0 0% 98%);
|
|
17
|
+
--secondary: hsl(240 4.8% 95.9%);
|
|
18
|
+
--secondary-foreground: hsl(240 5.9% 10%);
|
|
19
|
+
--muted: hsl(240 4.8% 95.9%);
|
|
20
|
+
--muted-foreground: hsl(240 3.8% 46.1%);
|
|
21
|
+
--accent: hsl(240 4.8% 95.9%);
|
|
22
|
+
--accent-foreground: hsl(240 5.9% 10%);
|
|
23
|
+
--destructive: hsl(0 84.2% 60.2%);
|
|
24
|
+
--destructive-foreground: hsl(0 0% 98%);
|
|
25
|
+
|
|
26
|
+
--border: hsl(240 5.9% 90%);
|
|
27
|
+
--input: hsl(240 5.9% 90%);
|
|
28
|
+
--ring: hsl(240 10% 3.9%);
|
|
29
|
+
|
|
30
|
+
--chart-1: hsl(12 76% 61%);
|
|
31
|
+
--chart-2: hsl(173 58% 39%);
|
|
32
|
+
--chart-3: hsl(197 37% 24%);
|
|
33
|
+
--chart-4: hsl(43 74% 66%);
|
|
34
|
+
--chart-5: hsl(27 87% 67%);
|
|
35
|
+
|
|
36
|
+
--radius: 0.6rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (prefers-color-scheme: dark) {
|
|
40
|
+
:root {
|
|
41
|
+
--background: hsl(240 10% 3.9%);
|
|
42
|
+
--foreground: hsl(0 0% 98%);
|
|
43
|
+
|
|
44
|
+
--card: hsl(240 10% 3.9%);
|
|
45
|
+
--card-foreground: hsl(0 0% 98%);
|
|
46
|
+
|
|
47
|
+
--popover: hsl(240 10% 3.9%);
|
|
48
|
+
--popover-foreground: hsl(0 0% 98%);
|
|
49
|
+
|
|
50
|
+
--primary: hsl(0 0% 98%);
|
|
51
|
+
--primary-foreground: hsl(240 5.9% 10%);
|
|
52
|
+
--secondary: hsl(240 3.7% 15.9%);
|
|
53
|
+
--secondary-foreground: hsl(0 0% 98%);
|
|
54
|
+
--muted: hsl(240 3.7% 15.9%);
|
|
55
|
+
--muted-foreground: hsl(240 5% 64.9%);
|
|
56
|
+
--accent: hsl(240 3.7% 15.9%);
|
|
57
|
+
--accent-foreground: hsl(0 0% 98%);
|
|
58
|
+
--destructive: hsl(0 62.8% 30.6%);
|
|
59
|
+
--destructive-foreground: hsl(0 0% 98%);
|
|
60
|
+
|
|
61
|
+
--border: hsl(240 3.7% 15.9%);
|
|
62
|
+
--input: hsl(240 3.7% 15.9%);
|
|
63
|
+
--ring: hsl(240 4.9% 83.9%);
|
|
64
|
+
|
|
65
|
+
--chart-1: hsl(220 70% 50%);
|
|
66
|
+
--chart-2: hsl(160 60% 45%);
|
|
67
|
+
--chart-3: hsl(30 80% 55%);
|
|
68
|
+
--chart-4: hsl(280 65% 60%);
|
|
69
|
+
--chart-5: hsl(340 75% 55%);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@theme inline {
|
|
74
|
+
--color-background: var(--background);
|
|
75
|
+
--color-foreground: var(--foreground);
|
|
76
|
+
|
|
77
|
+
--color-card: var(--card);
|
|
78
|
+
--color-card-foreground: var(--card-foreground);
|
|
79
|
+
|
|
80
|
+
--color-popover: var(--popover);
|
|
81
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
82
|
+
|
|
83
|
+
--color-primary: var(--primary);
|
|
84
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
85
|
+
--color-secondary: var(--secondary);
|
|
86
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
87
|
+
--color-muted: var(--muted);
|
|
88
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
89
|
+
--color-accent: var(--accent);
|
|
90
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
91
|
+
--color-destructive: var(--destructive);
|
|
92
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
93
|
+
|
|
94
|
+
--color-border: var(--border);
|
|
95
|
+
--color-input: var(--input);
|
|
96
|
+
--color-ring: var(--ring);
|
|
97
|
+
|
|
98
|
+
--color-chart-1: var(--chart-1);
|
|
99
|
+
--color-chart-2: var(--chart-2);
|
|
100
|
+
--color-chart-3: var(--chart-3);
|
|
101
|
+
--color-chart-4: var(--chart-4);
|
|
102
|
+
--color-chart-5: var(--chart-5);
|
|
103
|
+
|
|
104
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
105
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
106
|
+
--radius-lg: var(--radius);
|
|
107
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@layer base {
|
|
111
|
+
* {
|
|
112
|
+
@apply border-border outline-ring/50;
|
|
113
|
+
}
|
|
114
|
+
body {
|
|
115
|
+
@apply bg-background text-foreground;
|
|
116
|
+
}
|
|
117
117
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { Metadata } from "next";
|
|
2
|
-
|
|
3
|
-
import { Nunito } from "next/font/google";
|
|
4
|
-
|
|
5
|
-
import "./globals.css";
|
|
6
|
-
|
|
7
|
-
const font = Nunito({ subsets: ["latin"] });
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
title: "{{name}}",
|
|
11
|
-
description: "A project by Paaauldev",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
15
|
-
return (
|
|
16
|
-
<html lang="en">
|
|
17
|
-
<body className={font.className}>{children}</body>
|
|
18
|
-
</html>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
|
|
3
|
+
import { Nunito } from "next/font/google";
|
|
4
|
+
|
|
5
|
+
import "./globals.css";
|
|
6
|
+
|
|
7
|
+
const font = Nunito({ subsets: ["latin"] });
|
|
8
|
+
|
|
9
|
+
export const metadata: Metadata = {
|
|
10
|
+
title: "{{name}}",
|
|
11
|
+
description: "A project by Paaauldev",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
15
|
+
return (
|
|
16
|
+
<html lang="en">
|
|
17
|
+
<body className={font.className}>{children}</body>
|
|
18
|
+
</html>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Button } from "@/components/ui/button";
|
|
2
|
-
|
|
3
|
-
export default function HomePage() {
|
|
4
|
-
return <Button>Holi</Button>;
|
|
5
|
-
}
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
|
|
3
|
+
export default function HomePage() {
|
|
4
|
+
return <Button>Holi</Button>;
|
|
5
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
5
|
-
import { DrizzleAdapter } from "@auth/drizzle-adapter";
|
|
6
|
-
import NextAuth, { type User } from "next-auth";
|
|
7
|
-
import Credentials from "next-auth/providers/credentials";
|
|
8
|
-
|
|
9
|
-
import { getUserFromDb } from "./actions/user-actions";
|
|
10
|
-
import { db } from "./db";
|
|
11
|
-
|
|
12
|
-
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
13
|
-
adapter: DrizzleAdapter(db),
|
|
14
|
-
providers: [
|
|
15
|
-
Credentials({
|
|
16
|
-
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
|
|
17
|
-
// e.g. domain, username, password, 2FA token, etc.
|
|
18
|
-
credentials: {
|
|
19
|
-
email: {},
|
|
20
|
-
password: {},
|
|
21
|
-
},
|
|
22
|
-
authorize: async (credentials) => {
|
|
23
|
-
let user = null;
|
|
24
|
-
|
|
25
|
-
// logic to salt and hash password
|
|
26
|
-
// const pwHash = saltAndHashPassword(credentials.password)
|
|
27
|
-
|
|
28
|
-
// logic to verify if user exists
|
|
29
|
-
user = await getUserFromDb(credentials.email as string, credentials.password as string);
|
|
30
|
-
|
|
31
|
-
if (!user) {
|
|
32
|
-
// No user found, so this is their first attempt to login
|
|
33
|
-
// meaning this is also the place you could do registration
|
|
34
|
-
throw new Error("User not found.");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!user.success) {
|
|
38
|
-
throw new Error(user.message);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// return user object with the their profile data
|
|
42
|
-
return user.data as unknown as User;
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
],
|
|
46
|
-
secret: process.env.AUTH_SECRET,
|
|
47
|
-
session: {
|
|
48
|
-
strategy: "jwt",
|
|
49
|
-
maxAge: 30 * 24 * 60 * 60, // 30 days
|
|
50
|
-
},
|
|
51
|
-
callbacks: {
|
|
52
|
-
jwt({ token, user }) {
|
|
53
|
-
if (user) {
|
|
54
|
-
token.role = user.role;
|
|
55
|
-
token.email = user.email;
|
|
56
|
-
token.name = user.name;
|
|
57
|
-
token.surname = user.surname;
|
|
58
|
-
token.dni = user.dni;
|
|
59
|
-
token.phone = user.phone;
|
|
60
|
-
token.id = user.id;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return token;
|
|
64
|
-
},
|
|
65
|
-
session({ session, token }) {
|
|
66
|
-
if (session.user) {
|
|
67
|
-
session.user.role = token.role as string;
|
|
68
|
-
session.user.email = token.email;
|
|
69
|
-
session.user.name = token.name;
|
|
70
|
-
session.user.surname = token.surname;
|
|
71
|
-
session.user.dni = token.dni;
|
|
72
|
-
session.user.phone = token.phone;
|
|
73
|
-
session.user.id = token.id;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return session;
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
});
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
5
|
+
import { DrizzleAdapter } from "@auth/drizzle-adapter";
|
|
6
|
+
import NextAuth, { type User } from "next-auth";
|
|
7
|
+
import Credentials from "next-auth/providers/credentials";
|
|
8
|
+
|
|
9
|
+
import { getUserFromDb } from "./actions/user-actions";
|
|
10
|
+
import { db } from "./db";
|
|
11
|
+
|
|
12
|
+
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
13
|
+
adapter: DrizzleAdapter(db),
|
|
14
|
+
providers: [
|
|
15
|
+
Credentials({
|
|
16
|
+
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
|
|
17
|
+
// e.g. domain, username, password, 2FA token, etc.
|
|
18
|
+
credentials: {
|
|
19
|
+
email: {},
|
|
20
|
+
password: {},
|
|
21
|
+
},
|
|
22
|
+
authorize: async (credentials) => {
|
|
23
|
+
let user = null;
|
|
24
|
+
|
|
25
|
+
// logic to salt and hash password
|
|
26
|
+
// const pwHash = saltAndHashPassword(credentials.password)
|
|
27
|
+
|
|
28
|
+
// logic to verify if user exists
|
|
29
|
+
user = await getUserFromDb(credentials.email as string, credentials.password as string);
|
|
30
|
+
|
|
31
|
+
if (!user) {
|
|
32
|
+
// No user found, so this is their first attempt to login
|
|
33
|
+
// meaning this is also the place you could do registration
|
|
34
|
+
throw new Error("User not found.");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!user.success) {
|
|
38
|
+
throw new Error(user.message);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// return user object with the their profile data
|
|
42
|
+
return user.data as unknown as User;
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
secret: process.env.AUTH_SECRET,
|
|
47
|
+
session: {
|
|
48
|
+
strategy: "jwt",
|
|
49
|
+
maxAge: 30 * 24 * 60 * 60, // 30 days
|
|
50
|
+
},
|
|
51
|
+
callbacks: {
|
|
52
|
+
jwt({ token, user }) {
|
|
53
|
+
if (user) {
|
|
54
|
+
token.role = user.role;
|
|
55
|
+
token.email = user.email;
|
|
56
|
+
token.name = user.name;
|
|
57
|
+
token.surname = user.surname;
|
|
58
|
+
token.dni = user.dni;
|
|
59
|
+
token.phone = user.phone;
|
|
60
|
+
token.id = user.id;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return token;
|
|
64
|
+
},
|
|
65
|
+
session({ session, token }) {
|
|
66
|
+
if (session.user) {
|
|
67
|
+
session.user.role = token.role as string;
|
|
68
|
+
session.user.email = token.email;
|
|
69
|
+
session.user.name = token.name;
|
|
70
|
+
session.user.surname = token.surname;
|
|
71
|
+
session.user.dni = token.dni;
|
|
72
|
+
session.user.phone = token.phone;
|
|
73
|
+
session.user.id = token.id;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return session;
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {Slot} from "@radix-ui/react-slot";
|
|
3
|
-
import {cva, type VariantProps} from "class-variance-authority";
|
|
4
|
-
|
|
5
|
-
import {cn} from "@/lib/utils";
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
15
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
16
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
17
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
18
|
-
},
|
|
19
|
-
size: {
|
|
20
|
-
default: "h-10 px-4 py-2",
|
|
21
|
-
sm: "h-9 rounded-md px-3",
|
|
22
|
-
lg: "h-11 rounded-md px-8",
|
|
23
|
-
icon: "h-10 w-10",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
variant: "default",
|
|
28
|
-
size: "default",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
export interface ButtonProps
|
|
34
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
35
|
-
VariantProps<typeof buttonVariants> {
|
|
36
|
-
asChild?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
-
({className, variant, size, asChild = false, ...props}, ref) => {
|
|
41
|
-
const Comp = asChild ? Slot : "button";
|
|
42
|
-
|
|
43
|
-
return <Comp ref={ref} className={cn(buttonVariants({variant, size, className}))} {...props} />;
|
|
44
|
-
},
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
Button.displayName = "Button";
|
|
48
|
-
|
|
49
|
-
export {Button, buttonVariants};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {Slot} from "@radix-ui/react-slot";
|
|
3
|
+
import {cva, type VariantProps} from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import {cn} from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
16
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
17
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
default: "h-10 px-4 py-2",
|
|
21
|
+
sm: "h-9 rounded-md px-3",
|
|
22
|
+
lg: "h-11 rounded-md px-8",
|
|
23
|
+
icon: "h-10 w-10",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default",
|
|
28
|
+
size: "default",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export interface ButtonProps
|
|
34
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
35
|
+
VariantProps<typeof buttonVariants> {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
+
({className, variant, size, asChild = false, ...props}, ref) => {
|
|
41
|
+
const Comp = asChild ? Slot : "button";
|
|
42
|
+
|
|
43
|
+
return <Comp ref={ref} className={cn(buttonVariants({variant, size, className}))} {...props} />;
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
Button.displayName = "Button";
|
|
48
|
+
|
|
49
|
+
export {Button, buttonVariants};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PrismaClient } from '@prisma/client'
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
var prisma: PrismaClient | undefined
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const db = globalThis.prisma || new PrismaClient()
|
|
8
|
-
|
|
9
|
-
if(process.env.NODE_ENV !== 'production') {
|
|
10
|
-
globalThis.prisma = db
|
|
1
|
+
import { PrismaClient } from '@prisma/client'
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
var prisma: PrismaClient | undefined
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const db = globalThis.prisma || new PrismaClient()
|
|
8
|
+
|
|
9
|
+
if(process.env.NODE_ENV !== 'production') {
|
|
10
|
+
globalThis.prisma = db
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {type ClassValue, clsx} from "clsx";
|
|
2
|
-
import {twMerge} from "tailwind-merge";
|
|
3
|
-
|
|
4
|
-
export function cn(...inputs: ClassValue[]) {
|
|
5
|
-
return twMerge(clsx(inputs));
|
|
6
|
-
}
|
|
1
|
+
import {type ClassValue, clsx} from "clsx";
|
|
2
|
+
import {twMerge} from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
export function cn(...inputs: ClassValue[]) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|