abdellah0l-stack 1.0.2 → 1.0.3
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/package.json
CHANGED
package/template/.env.example
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# Database (Neon PostgreSQL)
|
|
2
2
|
DATABASE_URL=
|
|
3
3
|
|
|
4
|
-
# Node Environment
|
|
5
|
-
NODE_ENV="development"
|
|
6
|
-
|
|
7
4
|
# Better Auth
|
|
8
5
|
BETTER_AUTH_SECRET=
|
|
9
6
|
BETTER_AUTH_URL=http://localhost:3000
|
|
@@ -25,6 +22,3 @@ AI_GATEWAY_API_KEY=
|
|
|
25
22
|
|
|
26
23
|
# UploadThing (File Uploads)
|
|
27
24
|
UPLOADTHING_TOKEN=
|
|
28
|
-
|
|
29
|
-
# App URL
|
|
30
|
-
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
package/template/package.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"db:migrate": "drizzle-kit migrate",
|
|
12
12
|
"db:studio": "drizzle-kit studio",
|
|
13
13
|
"db:push": "drizzle-kit push",
|
|
14
|
+
"auth:generate": "npx @better-auth/cli@latest generate --config ./src/lib/auth.ts --output ./src/drizzle/schema/new-auth-schema.ts --yes",
|
|
14
15
|
"lint": "eslint"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
@@ -59,4 +60,4 @@
|
|
|
59
60
|
"tsx": "^4.20.6",
|
|
60
61
|
"typescript": "^5"
|
|
61
62
|
}
|
|
62
|
-
}
|
|
63
|
+
}
|
|
@@ -37,7 +37,7 @@ export const postsRouter = router({
|
|
|
37
37
|
.values({
|
|
38
38
|
title: input.title,
|
|
39
39
|
content: input.content,
|
|
40
|
-
userId: ctx.user.id,
|
|
40
|
+
userId: ctx.session.user.id,
|
|
41
41
|
})
|
|
42
42
|
.returning();
|
|
43
43
|
return post;
|
|
@@ -58,7 +58,7 @@ export const postsRouter = router({
|
|
|
58
58
|
.from(posts)
|
|
59
59
|
.where(eq(posts.id, input.id));
|
|
60
60
|
|
|
61
|
-
if (!existing || existing.userId !== ctx.user.id) {
|
|
61
|
+
if (!existing || existing.userId !== ctx.session.user.id) {
|
|
62
62
|
throw new Error("Not authorized");
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -83,7 +83,7 @@ export const postsRouter = router({
|
|
|
83
83
|
.from(posts)
|
|
84
84
|
.where(eq(posts.id, input.id));
|
|
85
85
|
|
|
86
|
-
if (!existing || existing.userId !== ctx.user.id) {
|
|
86
|
+
if (!existing || existing.userId !== ctx.session.user.id) {
|
|
87
87
|
throw new Error("Not authorized");
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -3,7 +3,6 @@ import { router, publicProcedure, protectedProcedure } from "../trpc";
|
|
|
3
3
|
import { db } from "@/drizzle/db";
|
|
4
4
|
import { user } from "@/drizzle/schema/auth-schema";
|
|
5
5
|
import { eq } from "drizzle-orm";
|
|
6
|
-
import { session } from '../../drizzle/schema/auth-schema';
|
|
7
6
|
|
|
8
7
|
// this is an example router file for managing users
|
|
9
8
|
// the ctx in protectedProcedure contains the authenticated user's session info
|