@webdevarif/dashui 0.4.0 → 0.6.0

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.
@@ -0,0 +1,165 @@
1
+ // This is your Prisma schema file.
2
+ // Learn more about it in the docs: https://pris.ly/d/prisma-schema
3
+
4
+ datasource db {
5
+ provider = "postgresql"
6
+ url = env("DATABASE_URL")
7
+ }
8
+
9
+ generator client {
10
+ provider = "prisma-client-js"
11
+ }
12
+
13
+ // ─── NextAuth Models ────────────────────────────────────────────────────────
14
+ // Auto-generated by NextAuth + Prisma Adapter
15
+
16
+ model Account {
17
+ id String @id @default(cuid())
18
+ userId String
19
+ type String
20
+ provider String
21
+ providerAccountId String
22
+ refresh_token String? @db.Text
23
+ access_token String? @db.Text
24
+ expires_at Int?
25
+ token_type String?
26
+ scope String?
27
+ id_token String? @db.Text
28
+ session_state String?
29
+
30
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
31
+
32
+ @@unique([provider, providerAccountId])
33
+ }
34
+
35
+ model Session {
36
+ id String @id @default(cuid())
37
+ sessionToken String @unique
38
+ userId String
39
+ expires DateTime
40
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
41
+ }
42
+
43
+ model VerificationToken {
44
+ identifier String
45
+ token String @unique
46
+ expires DateTime
47
+
48
+ @@unique([identifier, token])
49
+ }
50
+
51
+ // ─── User & Auth ────────────────────────────────────────────────────────────
52
+
53
+ model User {
54
+ id String @id @default(cuid())
55
+ name String?
56
+ email String @unique
57
+ emailVerified DateTime?
58
+ password String? // Only for credentials provider
59
+ image String?
60
+ role String @default("user") // "admin", "user", "moderator"
61
+ createdAt DateTime @default(now())
62
+ updatedAt DateTime @updatedAt
63
+
64
+ // Relations
65
+ accounts Account[]
66
+ sessions Session[]
67
+ stores Store[] @relation("storeOwner")
68
+ members StoreMember[]
69
+ posts Post[]
70
+ }
71
+
72
+ // ─── Multi-Tenant: Store/Organization ──────────────────────────────────────
73
+
74
+ model Store {
75
+ id String @id @default(cuid())
76
+ name String
77
+ slug String @unique
78
+ ownerId String
79
+ owner User @relation("storeOwner", fields: [ownerId], references: [id], onDelete: Cascade)
80
+ description String?
81
+ logo String?
82
+ settings Json? // Store-specific settings
83
+ createdAt DateTime @default(now())
84
+ updatedAt DateTime @updatedAt
85
+
86
+ // Relations
87
+ members StoreMember[]
88
+ posts Post[]
89
+ products Product[]
90
+ }
91
+
92
+ model StoreMember {
93
+ id String @id @default(cuid())
94
+ storeId String
95
+ userId String
96
+ role String @default("member") // "admin", "editor", "member", "viewer"
97
+
98
+ store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
99
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
100
+
101
+ @@unique([storeId, userId])
102
+ }
103
+
104
+ // ─── Content: Posts/Pages ──────────────────────────────────────────────────
105
+
106
+ model Post {
107
+ id String @id @default(cuid())
108
+ storeId String
109
+ title String
110
+ slug String
111
+ content String @db.Text
112
+ status String @default("draft") // "draft", "published", "scheduled", "archived"
113
+ type String @default("post") // "post", "page", "custom"
114
+ excerpt String?
115
+ image String?
116
+ authorId String
117
+ createdAt DateTime @default(now())
118
+ updatedAt DateTime @updatedAt
119
+
120
+ store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
121
+ author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
122
+
123
+ @@unique([storeId, slug])
124
+ @@index([storeId])
125
+ @@index([authorId])
126
+ }
127
+
128
+ // ─── E-Commerce: Products ────────────────────────────────────────────────
129
+
130
+ model Product {
131
+ id String @id @default(cuid())
132
+ storeId String
133
+ name String
134
+ description String? @db.Text
135
+ price Decimal @db.Decimal(10, 2)
136
+ image String?
137
+ published Boolean @default(false)
138
+ createdAt DateTime @default(now())
139
+ updatedAt DateTime @updatedAt
140
+
141
+ store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
142
+
143
+ @@index([storeId])
144
+ }
145
+
146
+ // ─── Extend with your own models ────────────────────────────────────────────
147
+
148
+ // Example: E-commerce orders
149
+ // model Order {
150
+ // id String @id @default(cuid())
151
+ // storeId String
152
+ // userId String
153
+ // total Decimal
154
+ // status String @default("pending")
155
+ // createdAt DateTime @default(now())
156
+ // }
157
+
158
+ // Example: Blog comments
159
+ // model Comment {
160
+ // id String @id @default(cuid())
161
+ // postId String
162
+ // userId String
163
+ // content String @db.Text
164
+ // createdAt DateTime @default(now())
165
+ // }