create-velox-app 0.6.55 → 0.6.56
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/templates/source/rsc/app/pages/users/[id]/posts/index.tsx +3 -1
- package/src/templates/source/rsc/app/pages/users.tsx +3 -1
- package/src/templates/source/rsc/src/api/database.ts +2 -2
- package/src/templates/source/rsc-auth/src/api/database.ts +2 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Demonstrates multi-level nested dynamic routes: /users/:id/posts
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type { Post } from '@prisma/client';
|
|
9
|
+
|
|
8
10
|
import { db } from '../../../../../src/api/database.js';
|
|
9
11
|
|
|
10
12
|
interface PageProps {
|
|
@@ -54,7 +56,7 @@ export default async function UserPostsPage({ params }: PageProps) {
|
|
|
54
56
|
<p className="empty-state">No posts yet. Create the first one!</p>
|
|
55
57
|
) : (
|
|
56
58
|
<ul className="posts-list">
|
|
57
|
-
{user.posts.map((post) => (
|
|
59
|
+
{user.posts.map((post: Post) => (
|
|
58
60
|
<li key={post.id} className="post-item">
|
|
59
61
|
<a href={`/users/${userId}/posts/${post.id}`}>
|
|
60
62
|
<h2>{post.title}</h2>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Demonstrates direct database access from RSC.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type { User } from '@prisma/client';
|
|
9
|
+
|
|
8
10
|
import { db } from '../../src/api/database.js';
|
|
9
11
|
|
|
10
12
|
export default async function UsersPage() {
|
|
@@ -23,7 +25,7 @@ export default async function UsersPage() {
|
|
|
23
25
|
</p>
|
|
24
26
|
) : (
|
|
25
27
|
<ul className="user-list">
|
|
26
|
-
{users.map((user) => (
|
|
28
|
+
{users.map((user: User) => (
|
|
27
29
|
<li key={user.id} className="user-card">
|
|
28
30
|
<a href={`/users/${user.id}`} className="user-link">
|
|
29
31
|
<span className="user-name">{user.name}</span>
|
|
@@ -51,7 +51,7 @@ dotenv.config({ path: resolve(projectRoot, '.env') });
|
|
|
51
51
|
declare global {
|
|
52
52
|
// Allow global `var` declarations for hot reload in development
|
|
53
53
|
// eslint-disable-next-line no-var
|
|
54
|
-
var __db:
|
|
54
|
+
var __db: PrismaClientType | undefined;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/* @if sqlite */
|
|
@@ -63,7 +63,7 @@ declare global {
|
|
|
63
63
|
* - Must use driver adapters for direct database connections
|
|
64
64
|
* - Validates that DATABASE_URL is set before creating the client
|
|
65
65
|
*/
|
|
66
|
-
function createPrismaClient():
|
|
66
|
+
function createPrismaClient(): PrismaClientType {
|
|
67
67
|
const databaseUrl = process.env.DATABASE_URL;
|
|
68
68
|
|
|
69
69
|
if (!databaseUrl) {
|
|
@@ -51,7 +51,7 @@ dotenv.config({ path: resolve(projectRoot, '.env') });
|
|
|
51
51
|
declare global {
|
|
52
52
|
// Allow global `var` declarations for hot reload in development
|
|
53
53
|
// eslint-disable-next-line no-var
|
|
54
|
-
var __db:
|
|
54
|
+
var __db: PrismaClientType | undefined;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/* @if sqlite */
|
|
@@ -63,7 +63,7 @@ declare global {
|
|
|
63
63
|
* - Must use driver adapters for direct database connections
|
|
64
64
|
* - Validates that DATABASE_URL is set before creating the client
|
|
65
65
|
*/
|
|
66
|
-
function createPrismaClient():
|
|
66
|
+
function createPrismaClient(): PrismaClientType {
|
|
67
67
|
const databaseUrl = process.env.DATABASE_URL;
|
|
68
68
|
|
|
69
69
|
if (!databaseUrl) {
|