lapeh 2.0.4 → 2.0.6
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 +3 -2
- package/prisma/schema.prisma +61 -61
- package/readme.md +27 -2
- package/scripts/config-clear.js +45 -0
- package/scripts/init-project.js +9 -15
- package/src/models/core.prisma +56 -56
- package/src/models/pets.prisma +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lapeh",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Framework API Express yang siap pakai (Standardized)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"generate:jwt": "node scripts/generate-jwt-secret.js",
|
|
24
24
|
"make:module": "node scripts/make-module.js",
|
|
25
25
|
"make:model": "node scripts/make-model.js",
|
|
26
|
-
"make:controller": "node scripts/make-controller.js"
|
|
26
|
+
"make:controller": "node scripts/make-controller.js",
|
|
27
|
+
"config:clear": "node scripts/config-clear.js"
|
|
27
28
|
},
|
|
28
29
|
"keywords": [
|
|
29
30
|
"express",
|
package/prisma/schema.prisma
CHANGED
|
@@ -9,35 +9,35 @@ datasource db {
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
model cache {
|
|
12
|
-
key String @id
|
|
13
|
-
value String
|
|
12
|
+
key String @id
|
|
13
|
+
value String
|
|
14
14
|
expiration Int
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
model cache_locks {
|
|
18
|
-
key String @id
|
|
19
|
-
owner String
|
|
18
|
+
key String @id
|
|
19
|
+
owner String
|
|
20
20
|
expiration Int
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
model failed_jobs {
|
|
24
24
|
id BigInt @id @default(autoincrement())
|
|
25
|
-
uuid String @unique
|
|
26
|
-
connection String
|
|
27
|
-
queue String
|
|
28
|
-
payload String
|
|
29
|
-
exception String
|
|
30
|
-
failed_at DateTime @default(now())
|
|
25
|
+
uuid String @unique
|
|
26
|
+
connection String
|
|
27
|
+
queue String
|
|
28
|
+
payload String
|
|
29
|
+
exception String
|
|
30
|
+
failed_at DateTime @default(now())
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
model job_batches {
|
|
34
|
-
id String @id
|
|
35
|
-
name String
|
|
34
|
+
id String @id
|
|
35
|
+
name String
|
|
36
36
|
total_jobs Int
|
|
37
37
|
pending_jobs Int
|
|
38
38
|
failed_jobs Int
|
|
39
|
-
failed_job_ids String
|
|
40
|
-
options String?
|
|
39
|
+
failed_job_ids String
|
|
40
|
+
options String?
|
|
41
41
|
cancelled_at Int?
|
|
42
42
|
created_at Int
|
|
43
43
|
finished_at Int?
|
|
@@ -45,9 +45,9 @@ model job_batches {
|
|
|
45
45
|
|
|
46
46
|
model jobs {
|
|
47
47
|
id BigInt @id @default(autoincrement())
|
|
48
|
-
queue String
|
|
49
|
-
payload String
|
|
50
|
-
attempts Int
|
|
48
|
+
queue String
|
|
49
|
+
payload String
|
|
50
|
+
attempts Int
|
|
51
51
|
reserved_at Int?
|
|
52
52
|
available_at Int
|
|
53
53
|
created_at Int
|
|
@@ -57,38 +57,38 @@ model jobs {
|
|
|
57
57
|
|
|
58
58
|
model migrations {
|
|
59
59
|
id Int @id @default(autoincrement())
|
|
60
|
-
migration String
|
|
60
|
+
migration String
|
|
61
61
|
batch Int
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
model password_reset_tokens {
|
|
65
|
-
email String @id
|
|
66
|
-
token String
|
|
67
|
-
created_at DateTime?
|
|
65
|
+
email String @id
|
|
66
|
+
token String
|
|
67
|
+
created_at DateTime?
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
model personal_access_tokens {
|
|
71
71
|
id BigInt @id @default(autoincrement())
|
|
72
|
-
tokenable_type String
|
|
72
|
+
tokenable_type String
|
|
73
73
|
tokenable_id BigInt
|
|
74
|
-
name String
|
|
75
|
-
token String @unique
|
|
76
|
-
abilities String?
|
|
77
|
-
last_used_at DateTime?
|
|
78
|
-
expires_at DateTime?
|
|
79
|
-
created_at DateTime?
|
|
80
|
-
updated_at DateTime?
|
|
74
|
+
name String
|
|
75
|
+
token String @unique
|
|
76
|
+
abilities String?
|
|
77
|
+
last_used_at DateTime?
|
|
78
|
+
expires_at DateTime?
|
|
79
|
+
created_at DateTime?
|
|
80
|
+
updated_at DateTime?
|
|
81
81
|
|
|
82
82
|
@@index([expires_at])
|
|
83
83
|
@@index([tokenable_type, tokenable_id])
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
model sessions {
|
|
87
|
-
id String @id
|
|
87
|
+
id String @id
|
|
88
88
|
user_id BigInt?
|
|
89
|
-
ip_address String?
|
|
90
|
-
user_agent String?
|
|
91
|
-
payload String
|
|
89
|
+
ip_address String?
|
|
90
|
+
user_agent String?
|
|
91
|
+
payload String
|
|
92
92
|
last_activity Int
|
|
93
93
|
|
|
94
94
|
@@index([last_activity])
|
|
@@ -97,16 +97,16 @@ model sessions {
|
|
|
97
97
|
|
|
98
98
|
model users {
|
|
99
99
|
id BigInt @id @default(autoincrement())
|
|
100
|
-
uuid String @unique
|
|
101
|
-
name String
|
|
102
|
-
email String @unique
|
|
103
|
-
avatar String?
|
|
104
|
-
avatar_url String?
|
|
105
|
-
email_verified_at DateTime?
|
|
106
|
-
password String
|
|
107
|
-
remember_token String?
|
|
108
|
-
created_at DateTime?
|
|
109
|
-
updated_at DateTime?
|
|
100
|
+
uuid String @unique
|
|
101
|
+
name String
|
|
102
|
+
email String @unique
|
|
103
|
+
avatar String?
|
|
104
|
+
avatar_url String?
|
|
105
|
+
email_verified_at DateTime?
|
|
106
|
+
password String
|
|
107
|
+
remember_token String?
|
|
108
|
+
created_at DateTime?
|
|
109
|
+
updated_at DateTime?
|
|
110
110
|
|
|
111
111
|
user_roles user_roles[]
|
|
112
112
|
user_permissions user_permissions[]
|
|
@@ -114,11 +114,11 @@ model users {
|
|
|
114
114
|
|
|
115
115
|
model roles {
|
|
116
116
|
id BigInt @id @default(autoincrement())
|
|
117
|
-
name String
|
|
118
|
-
slug String @unique
|
|
119
|
-
description String?
|
|
120
|
-
created_at DateTime?
|
|
121
|
-
updated_at DateTime?
|
|
117
|
+
name String
|
|
118
|
+
slug String @unique
|
|
119
|
+
description String?
|
|
120
|
+
created_at DateTime?
|
|
121
|
+
updated_at DateTime?
|
|
122
122
|
|
|
123
123
|
user_roles user_roles[]
|
|
124
124
|
role_permissions role_permissions[]
|
|
@@ -126,11 +126,11 @@ model roles {
|
|
|
126
126
|
|
|
127
127
|
model permissions {
|
|
128
128
|
id BigInt @id @default(autoincrement())
|
|
129
|
-
name String
|
|
130
|
-
slug String @unique
|
|
131
|
-
description String?
|
|
132
|
-
created_at DateTime?
|
|
133
|
-
updated_at DateTime?
|
|
129
|
+
name String
|
|
130
|
+
slug String @unique
|
|
131
|
+
description String?
|
|
132
|
+
created_at DateTime?
|
|
133
|
+
updated_at DateTime?
|
|
134
134
|
|
|
135
135
|
role_permissions role_permissions[]
|
|
136
136
|
user_permissions user_permissions[]
|
|
@@ -140,7 +140,7 @@ model user_roles {
|
|
|
140
140
|
id BigInt @id @default(autoincrement())
|
|
141
141
|
user_id BigInt
|
|
142
142
|
role_id BigInt
|
|
143
|
-
created_at DateTime?
|
|
143
|
+
created_at DateTime?
|
|
144
144
|
|
|
145
145
|
user users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
146
146
|
role roles @relation(fields: [role_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
@@ -152,7 +152,7 @@ model role_permissions {
|
|
|
152
152
|
id BigInt @id @default(autoincrement())
|
|
153
153
|
role_id BigInt
|
|
154
154
|
permission_id BigInt
|
|
155
|
-
created_at DateTime?
|
|
155
|
+
created_at DateTime?
|
|
156
156
|
|
|
157
157
|
role roles @relation(fields: [role_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
158
158
|
permission permissions @relation(fields: [permission_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
@@ -164,7 +164,7 @@ model user_permissions {
|
|
|
164
164
|
id BigInt @id @default(autoincrement())
|
|
165
165
|
user_id BigInt
|
|
166
166
|
permission_id BigInt
|
|
167
|
-
created_at DateTime?
|
|
167
|
+
created_at DateTime?
|
|
168
168
|
|
|
169
169
|
user users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
170
170
|
permission permissions @relation(fields: [permission_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
@@ -176,9 +176,9 @@ model user_permissions {
|
|
|
176
176
|
|
|
177
177
|
model pets {
|
|
178
178
|
id BigInt @id @default(autoincrement())
|
|
179
|
-
name String
|
|
180
|
-
species String
|
|
181
|
-
age Int
|
|
182
|
-
created_at DateTime?
|
|
183
|
-
updated_at DateTime?
|
|
179
|
+
name String
|
|
180
|
+
species String
|
|
181
|
+
age Int
|
|
182
|
+
created_at DateTime?
|
|
183
|
+
updated_at DateTime?
|
|
184
184
|
}
|
package/readme.md
CHANGED
|
@@ -162,7 +162,19 @@ npm run make:model NamaModel
|
|
|
162
162
|
|
|
163
163
|
Ini akan membuat file `src/models/User.prisma`.
|
|
164
164
|
|
|
165
|
-
### 3.
|
|
165
|
+
### 3. Membuat Controller
|
|
166
|
+
|
|
167
|
+
Membuat file Controller baru. Gunakan flag `-r` untuk membuat controller lengkap dengan method CRUD (index, show, store, update, destroy).
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm run make:controller NamaController
|
|
171
|
+
# Contoh Basic: npm run make:controller PaymentController
|
|
172
|
+
|
|
173
|
+
# Contoh Resource (CRUD Lengkap):
|
|
174
|
+
npm run make:controller PaymentController -r
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 4. Workflow Database (Prisma)
|
|
166
178
|
|
|
167
179
|
Karena framework ini menggunakan **Schema Terpisah** (split schema), Anda **TIDAK BOLEH** mengedit `prisma/schema.prisma` secara manual.
|
|
168
180
|
|
|
@@ -188,7 +200,7 @@ npm run prisma:deploy
|
|
|
188
200
|
|
|
189
201
|
> **Catatan:** Script `compile-schema.js` akan otomatis berjalan sebelum perintah prisma di atas dieksekusi.
|
|
190
202
|
|
|
191
|
-
###
|
|
203
|
+
### 5. Generate JWT Secret
|
|
192
204
|
|
|
193
205
|
Jika Anda perlu me-refresh secret key JWT:
|
|
194
206
|
|
|
@@ -196,6 +208,19 @@ Jika Anda perlu me-refresh secret key JWT:
|
|
|
196
208
|
npm run generate:jwt
|
|
197
209
|
```
|
|
198
210
|
|
|
211
|
+
### 6. Maintenance (Clear Config)
|
|
212
|
+
|
|
213
|
+
Membersihkan cache framework, NPM, build artifacts, dan temporary files (sangat berguna jika mengalami isu cache aneh atau ingin reset environment development).
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm run config:clear
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- Menghapus `node_modules/.cache`
|
|
220
|
+
- Menghapus `dist/`
|
|
221
|
+
- Menghapus `dump.rdb` (Redis Persistence)
|
|
222
|
+
- Membersihkan `npm cache`
|
|
223
|
+
|
|
199
224
|
---
|
|
200
225
|
|
|
201
226
|
## 📂 Struktur Folder
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
const rootDir = path.join(__dirname, '..');
|
|
6
|
+
|
|
7
|
+
console.log('🧹 Starting cleanup process...');
|
|
8
|
+
|
|
9
|
+
// 1. Remove dist folder (Build artifacts)
|
|
10
|
+
const distDir = path.join(rootDir, 'dist');
|
|
11
|
+
if (fs.existsSync(distDir)) {
|
|
12
|
+
console.log('🗑️ Removing dist/ folder...');
|
|
13
|
+
fs.rmSync(distDir, { recursive: true, force: true });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 2. Remove node_modules/.cache (Framework caches: ts-node, eslint, etc)
|
|
17
|
+
const nmCacheDir = path.join(rootDir, 'node_modules', '.cache');
|
|
18
|
+
if (fs.existsSync(nmCacheDir)) {
|
|
19
|
+
console.log('🗑️ Removing node_modules/.cache...');
|
|
20
|
+
fs.rmSync(nmCacheDir, { recursive: true, force: true });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 3. Remove Redis local persistence file (dump.rdb)
|
|
24
|
+
const dumpRdb = path.join(rootDir, 'dump.rdb');
|
|
25
|
+
if (fs.existsSync(dumpRdb)) {
|
|
26
|
+
console.log('🗑️ Removing dump.rdb (Redis persistence)...');
|
|
27
|
+
fs.unlinkSync(dumpRdb);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 4. Remove Coverage folder (if exists)
|
|
31
|
+
const coverageDir = path.join(rootDir, 'coverage');
|
|
32
|
+
if (fs.existsSync(coverageDir)) {
|
|
33
|
+
console.log('🗑️ Removing coverage/ folder...');
|
|
34
|
+
fs.rmSync(coverageDir, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 5. Clear NPM Cache
|
|
38
|
+
try {
|
|
39
|
+
console.log('📦 Clearing NPM cache...');
|
|
40
|
+
execSync('npm cache clean --force', { stdio: 'inherit' });
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.warn('⚠️ Warning: Could not clear NPM cache. You might need admin privileges.');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log('✨ Cleanup complete! Project is fresh.');
|
package/scripts/init-project.js
CHANGED
|
@@ -49,27 +49,21 @@ const selectOption = async (query, options) => {
|
|
|
49
49
|
const dbType = await selectOption("Database apa yang akan digunakan?", [
|
|
50
50
|
{ key: "pgsql", label: "PostgreSQL", provider: "postgresql", defaultPort: "5432" },
|
|
51
51
|
{ key: "mysql", label: "MySQL", provider: "mysql", defaultPort: "3306" },
|
|
52
|
-
{ key: "mariadb", label: "MariaDB", provider: "mysql", defaultPort: "3306" },
|
|
53
|
-
{ key: "sqlite", label: "SQLite", provider: "sqlite", defaultPort: "" },
|
|
54
52
|
]);
|
|
55
53
|
|
|
56
54
|
let dbUrl = "";
|
|
57
55
|
let dbProvider = dbType.provider;
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const host = await ask("Database Host", "localhost");
|
|
58
|
+
const port = await ask("Database Port", dbType.defaultPort);
|
|
59
|
+
const user = await ask("Database User", "root");
|
|
60
|
+
const password = await ask("Database Password", "");
|
|
61
|
+
const dbName = await ask("Database Name", "lapeh");
|
|
62
|
+
|
|
63
|
+
if (dbType.key === "pgsql") {
|
|
64
|
+
dbUrl = `postgresql://${user}:${password}@${host}:${port}/${dbName}?schema=public`;
|
|
61
65
|
} else {
|
|
62
|
-
|
|
63
|
-
const port = await ask("Database Port", dbType.defaultPort);
|
|
64
|
-
const user = await ask("Database User", "root");
|
|
65
|
-
const password = await ask("Database Password", "");
|
|
66
|
-
const dbName = await ask("Database Name", "lapeh");
|
|
67
|
-
|
|
68
|
-
if (dbType.key === "pgsql") {
|
|
69
|
-
dbUrl = `postgresql://${user}:${password}@${host}:${port}/${dbName}?schema=public`;
|
|
70
|
-
} else {
|
|
71
|
-
dbUrl = `mysql://${user}:${password}@${host}:${port}/${dbName}`;
|
|
72
|
-
}
|
|
66
|
+
dbUrl = `mysql://${user}:${password}@${host}:${port}/${dbName}`;
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
// Close readline as we are done with input
|
package/src/models/core.prisma
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
model cache {
|
|
2
|
-
key String @id
|
|
3
|
-
value String
|
|
2
|
+
key String @id
|
|
3
|
+
value String
|
|
4
4
|
expiration Int
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
model cache_locks {
|
|
8
|
-
key String @id
|
|
9
|
-
owner String
|
|
8
|
+
key String @id
|
|
9
|
+
owner String
|
|
10
10
|
expiration Int
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
model failed_jobs {
|
|
14
14
|
id BigInt @id @default(autoincrement())
|
|
15
|
-
uuid String @unique
|
|
16
|
-
connection String
|
|
17
|
-
queue String
|
|
18
|
-
payload String
|
|
19
|
-
exception String
|
|
20
|
-
failed_at DateTime @default(now())
|
|
15
|
+
uuid String @unique
|
|
16
|
+
connection String
|
|
17
|
+
queue String
|
|
18
|
+
payload String
|
|
19
|
+
exception String
|
|
20
|
+
failed_at DateTime @default(now())
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
model job_batches {
|
|
24
|
-
id String @id
|
|
25
|
-
name String
|
|
24
|
+
id String @id
|
|
25
|
+
name String
|
|
26
26
|
total_jobs Int
|
|
27
27
|
pending_jobs Int
|
|
28
28
|
failed_jobs Int
|
|
29
|
-
failed_job_ids String
|
|
30
|
-
options String?
|
|
29
|
+
failed_job_ids String
|
|
30
|
+
options String?
|
|
31
31
|
cancelled_at Int?
|
|
32
32
|
created_at Int
|
|
33
33
|
finished_at Int?
|
|
@@ -35,9 +35,9 @@ model job_batches {
|
|
|
35
35
|
|
|
36
36
|
model jobs {
|
|
37
37
|
id BigInt @id @default(autoincrement())
|
|
38
|
-
queue String
|
|
39
|
-
payload String
|
|
40
|
-
attempts Int
|
|
38
|
+
queue String
|
|
39
|
+
payload String
|
|
40
|
+
attempts Int
|
|
41
41
|
reserved_at Int?
|
|
42
42
|
available_at Int
|
|
43
43
|
created_at Int
|
|
@@ -47,38 +47,38 @@ model jobs {
|
|
|
47
47
|
|
|
48
48
|
model migrations {
|
|
49
49
|
id Int @id @default(autoincrement())
|
|
50
|
-
migration String
|
|
50
|
+
migration String
|
|
51
51
|
batch Int
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
model password_reset_tokens {
|
|
55
|
-
email String @id
|
|
56
|
-
token String
|
|
57
|
-
created_at DateTime?
|
|
55
|
+
email String @id
|
|
56
|
+
token String
|
|
57
|
+
created_at DateTime?
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
model personal_access_tokens {
|
|
61
61
|
id BigInt @id @default(autoincrement())
|
|
62
|
-
tokenable_type String
|
|
62
|
+
tokenable_type String
|
|
63
63
|
tokenable_id BigInt
|
|
64
|
-
name String
|
|
65
|
-
token String @unique
|
|
66
|
-
abilities String?
|
|
67
|
-
last_used_at DateTime?
|
|
68
|
-
expires_at DateTime?
|
|
69
|
-
created_at DateTime?
|
|
70
|
-
updated_at DateTime?
|
|
64
|
+
name String
|
|
65
|
+
token String @unique
|
|
66
|
+
abilities String?
|
|
67
|
+
last_used_at DateTime?
|
|
68
|
+
expires_at DateTime?
|
|
69
|
+
created_at DateTime?
|
|
70
|
+
updated_at DateTime?
|
|
71
71
|
|
|
72
72
|
@@index([expires_at])
|
|
73
73
|
@@index([tokenable_type, tokenable_id])
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
model sessions {
|
|
77
|
-
id String @id
|
|
77
|
+
id String @id
|
|
78
78
|
user_id BigInt?
|
|
79
|
-
ip_address String?
|
|
80
|
-
user_agent String?
|
|
81
|
-
payload String
|
|
79
|
+
ip_address String?
|
|
80
|
+
user_agent String?
|
|
81
|
+
payload String
|
|
82
82
|
last_activity Int
|
|
83
83
|
|
|
84
84
|
@@index([last_activity])
|
|
@@ -87,16 +87,16 @@ model sessions {
|
|
|
87
87
|
|
|
88
88
|
model users {
|
|
89
89
|
id BigInt @id @default(autoincrement())
|
|
90
|
-
uuid String @unique
|
|
91
|
-
name String
|
|
92
|
-
email String @unique
|
|
93
|
-
avatar String?
|
|
94
|
-
avatar_url String?
|
|
95
|
-
email_verified_at DateTime?
|
|
96
|
-
password String
|
|
97
|
-
remember_token String?
|
|
98
|
-
created_at DateTime?
|
|
99
|
-
updated_at DateTime?
|
|
90
|
+
uuid String @unique
|
|
91
|
+
name String
|
|
92
|
+
email String @unique
|
|
93
|
+
avatar String?
|
|
94
|
+
avatar_url String?
|
|
95
|
+
email_verified_at DateTime?
|
|
96
|
+
password String
|
|
97
|
+
remember_token String?
|
|
98
|
+
created_at DateTime?
|
|
99
|
+
updated_at DateTime?
|
|
100
100
|
|
|
101
101
|
user_roles user_roles[]
|
|
102
102
|
user_permissions user_permissions[]
|
|
@@ -104,11 +104,11 @@ model users {
|
|
|
104
104
|
|
|
105
105
|
model roles {
|
|
106
106
|
id BigInt @id @default(autoincrement())
|
|
107
|
-
name String
|
|
108
|
-
slug String @unique
|
|
109
|
-
description String?
|
|
110
|
-
created_at DateTime?
|
|
111
|
-
updated_at DateTime?
|
|
107
|
+
name String
|
|
108
|
+
slug String @unique
|
|
109
|
+
description String?
|
|
110
|
+
created_at DateTime?
|
|
111
|
+
updated_at DateTime?
|
|
112
112
|
|
|
113
113
|
user_roles user_roles[]
|
|
114
114
|
role_permissions role_permissions[]
|
|
@@ -116,11 +116,11 @@ model roles {
|
|
|
116
116
|
|
|
117
117
|
model permissions {
|
|
118
118
|
id BigInt @id @default(autoincrement())
|
|
119
|
-
name String
|
|
120
|
-
slug String @unique
|
|
121
|
-
description String?
|
|
122
|
-
created_at DateTime?
|
|
123
|
-
updated_at DateTime?
|
|
119
|
+
name String
|
|
120
|
+
slug String @unique
|
|
121
|
+
description String?
|
|
122
|
+
created_at DateTime?
|
|
123
|
+
updated_at DateTime?
|
|
124
124
|
|
|
125
125
|
role_permissions role_permissions[]
|
|
126
126
|
user_permissions user_permissions[]
|
|
@@ -130,7 +130,7 @@ model user_roles {
|
|
|
130
130
|
id BigInt @id @default(autoincrement())
|
|
131
131
|
user_id BigInt
|
|
132
132
|
role_id BigInt
|
|
133
|
-
created_at DateTime?
|
|
133
|
+
created_at DateTime?
|
|
134
134
|
|
|
135
135
|
user users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
136
136
|
role roles @relation(fields: [role_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
@@ -142,7 +142,7 @@ model role_permissions {
|
|
|
142
142
|
id BigInt @id @default(autoincrement())
|
|
143
143
|
role_id BigInt
|
|
144
144
|
permission_id BigInt
|
|
145
|
-
created_at DateTime?
|
|
145
|
+
created_at DateTime?
|
|
146
146
|
|
|
147
147
|
role roles @relation(fields: [role_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
148
148
|
permission permissions @relation(fields: [permission_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
@@ -154,7 +154,7 @@ model user_permissions {
|
|
|
154
154
|
id BigInt @id @default(autoincrement())
|
|
155
155
|
user_id BigInt
|
|
156
156
|
permission_id BigInt
|
|
157
|
-
created_at DateTime?
|
|
157
|
+
created_at DateTime?
|
|
158
158
|
|
|
159
159
|
user users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
|
160
160
|
permission permissions @relation(fields: [permission_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
package/src/models/pets.prisma
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
model pets {
|
|
3
3
|
id BigInt @id @default(autoincrement())
|
|
4
|
-
name String
|
|
5
|
-
species String
|
|
6
|
-
age Int
|
|
7
|
-
created_at DateTime?
|
|
8
|
-
updated_at DateTime?
|
|
4
|
+
name String
|
|
5
|
+
species String
|
|
6
|
+
age Int
|
|
7
|
+
created_at DateTime?
|
|
8
|
+
updated_at DateTime?
|
|
9
9
|
}
|