create-craftjs 1.0.3 → 1.0.5

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.
Files changed (68) hide show
  1. package/README.md +137 -137
  2. package/bin/index.js +158 -158
  3. package/package.json +24 -24
  4. package/template/Dockerfile +57 -12
  5. package/template/babel.config.json +3 -3
  6. package/template/craft/commands/build.js +16 -15
  7. package/template/craft/commands/db-fresh.js +22 -22
  8. package/template/craft/commands/db-generate.js +23 -23
  9. package/template/craft/commands/db-migrate.js +22 -22
  10. package/template/craft/commands/dev.js +16 -16
  11. package/template/craft/commands/key-generate.js +41 -41
  12. package/template/craft/commands/make-apidocs.js +121 -121
  13. package/template/craft/commands/make-command.js +38 -38
  14. package/template/craft/commands/make-controller.js +95 -71
  15. package/template/craft/commands/make-dto.js +39 -39
  16. package/template/craft/commands/make-middleware.js +46 -46
  17. package/template/craft/commands/make-repository.js +36 -36
  18. package/template/craft/commands/make-route.js +92 -88
  19. package/template/craft/commands/make-service.js +39 -39
  20. package/template/craft/commands/make-test.js +48 -48
  21. package/template/craft/commands/make-utils.js +30 -30
  22. package/template/craft/commands/make-validation.js +42 -42
  23. package/template/craft/commands/make-view.js +42 -42
  24. package/template/craft/commands/start.js +29 -29
  25. package/template/craft/commands/test.js +20 -20
  26. package/template/craft.js +256 -256
  27. package/template/docker-compose.yml +8 -0
  28. package/template/nodemon.json +6 -6
  29. package/template/package-lock.json +8877 -8877
  30. package/template/package.json +84 -84
  31. package/template/prisma/schema.prisma +22 -22
  32. package/template/prisma/seed.ts +29 -29
  33. package/template/src/apidocs/auth-docs.ts +314 -314
  34. package/template/src/apidocs/users-docs.ts +240 -240
  35. package/template/src/config/cloudinary.ts +21 -21
  36. package/template/src/config/database.ts +90 -90
  37. package/template/src/config/env.ts +67 -67
  38. package/template/src/config/logger.ts +139 -139
  39. package/template/src/config/nodemailer.ts +23 -23
  40. package/template/src/config/web.ts +47 -47
  41. package/template/src/controllers/auth-controller.ts +88 -88
  42. package/template/src/controllers/user-controller.ts +79 -79
  43. package/template/src/dtos/list-dto.ts +12 -12
  44. package/template/src/dtos/user-dto.ts +57 -57
  45. package/template/src/main.ts +28 -28
  46. package/template/src/middleware/auth-middleware.ts +44 -44
  47. package/template/src/middleware/error-middleware.ts +27 -27
  48. package/template/src/middleware/http-logger-middleware.ts +31 -31
  49. package/template/src/repositories/user-repository.ts +75 -75
  50. package/template/src/routes/auth-route.ts +20 -20
  51. package/template/src/routes/main-route.ts +25 -25
  52. package/template/src/routes/user-route.ts +35 -35
  53. package/template/src/services/auth-service.ts +162 -162
  54. package/template/src/services/user-service.ts +102 -102
  55. package/template/src/types/type-request.ts +6 -6
  56. package/template/src/utils/async-handler.ts +9 -9
  57. package/template/src/utils/response-error.ts +10 -10
  58. package/template/src/utils/response.ts +60 -60
  59. package/template/src/utils/swagger.ts +135 -135
  60. package/template/src/utils/validation.ts +7 -7
  61. package/template/src/validations/user-validation.ts +127 -127
  62. package/template/src/views/index.ejs +6 -6
  63. package/template/src/views/layouts/main.ejs +14 -14
  64. package/template/src/views/partials/header.ejs +3 -3
  65. package/template/test/user.test.ts +16 -16
  66. package/template/tsconfig.json +13 -13
  67. package/template/.dockerignore +0 -4
  68. package/template/src/controllers/sass-controller.ts +0 -24
@@ -1,314 +1,314 @@
1
- /**
2
- * @swagger
3
- * /api/auth/register:
4
- * post:
5
- * summary: Register User
6
- * tags: [Auth]
7
- * requestBody:
8
- * required: true
9
- * content:
10
- * application/json:
11
- * schema:
12
- * type: object
13
- * required:
14
- * - fullName
15
- * - email
16
- * - password
17
- * properties:
18
- * fullName:
19
- * type: string
20
- * email:
21
- * type: string
22
- * password:
23
- * type: string
24
- * responses:
25
- * 201:
26
- * description: Register berhasil
27
- * content:
28
- * application/json:
29
- * schema:
30
- * type: object
31
- * properties:
32
- * status:
33
- * type: boolean
34
- * status_code:
35
- * type: integer
36
- * message:
37
- * type: string
38
- * example: Register Berhasil
39
- * data:
40
- * type: object
41
- * properties:
42
- * id:
43
- * type: string
44
- * format: uuid
45
- * fullName:
46
- * type: string
47
- * email:
48
- * type: string
49
- * 400:
50
- * $ref: '#/components/responses/ValidationError'
51
- * 409:
52
- * description: Konflik - akun sudah terdaftar
53
- * content:
54
- * application/json:
55
- * schema:
56
- * type: object
57
- * properties:
58
- * status:
59
- * type: boolean
60
- * status_code:
61
- * type: integer
62
- * message:
63
- * type: string
64
- * example: Akun Sudah Terdaftar!
65
- */
66
- /**
67
- * @swagger
68
- * /api/auth/login:
69
- * post:
70
- * summary: Login User
71
- * tags: [Auth]
72
- * requestBody:
73
- * required: true
74
- * content:
75
- * application/json:
76
- * schema:
77
- * type: object
78
- * required:
79
- * - email
80
- * - password
81
- * properties:
82
- * email:
83
- * type: string
84
- * example: tes@gmail.com
85
- * password:
86
- * type: string
87
- * example: 12345678
88
- * responses:
89
- * 200:
90
- * description: Login berhasil
91
- * content:
92
- * application/json:
93
- * schema:
94
- * type: object
95
- * properties:
96
- * status:
97
- * type: boolean
98
- * example: true
99
- * status_code:
100
- * type: integer
101
- * example: 200
102
- * message:
103
- * type: string
104
- * example: Login Berhasil
105
- * data:
106
- * type: object
107
- * properties:
108
- * user:
109
- * type: object
110
- * properties:
111
- * id:
112
- * type: string
113
- * fullName:
114
- * type: string
115
- * email:
116
- * type: string
117
- * accessToken:
118
- * type: string
119
- * refreshToken:
120
- * type: string
121
- * 400:
122
- * $ref: '#/components/responses/ValidationError'
123
- * 401:
124
- * description: Login gagal - username,email atau password salah
125
- * content:
126
- * application/json:
127
- * example:
128
- * status: false
129
- * status_code: 401
130
- * message: Gagal Login! Detail login salah
131
- */
132
-
133
- // me
134
- /**
135
- * @swagger
136
- * /api/auth/me:
137
- * get:
138
- * summary: Get informasi detail user yang sedang login
139
- * tags: [Auth]
140
- * security:
141
- * - bearerAuth: []
142
- * responses:
143
- * 200:
144
- * description: Get Detail User Berhasil
145
- * content:
146
- * application/json:
147
- * schema:
148
- * type: object
149
- * properties:
150
- * status:
151
- * type: boolean
152
- * status_code:
153
- * type: integer
154
- * message:
155
- * type: string
156
- * data:
157
- * type: object
158
- * properties:
159
- * id:
160
- * type: string
161
- * fullName:
162
- * type: string
163
- * email:
164
- * type: string
165
- * created_at:
166
- * type: string
167
- * format: date-time
168
- * updated_at:
169
- * type: string
170
- * format: date-time
171
- * deleted_at:
172
- * type: string
173
- * format: date-time
174
- * nullable: true
175
- * 401:
176
- * $ref: '#/components/responses/UnauthorizedATError'
177
- */
178
-
179
- // Logout
180
- /**
181
- * @swagger
182
- * /api/auth/logout:
183
- * post:
184
- * summary: Logout User
185
- * tags: [Auth]
186
- * security:
187
- * - bearerAuth: []
188
- * responses:
189
- * 200:
190
- * description: Logout berhasil
191
- * content:
192
- * application/json:
193
- * schema:
194
- * type: object
195
- * properties:
196
- * status:
197
- * type: boolean
198
- * status_code:
199
- * type: integer
200
- * message:
201
- * type: string
202
- * example:
203
- * status: true
204
- * status_code: 200
205
- * message: Logout Berhasil
206
- * 401:
207
- * $ref: '#/components/responses/UnauthorizedNotLoginError'
208
- */
209
-
210
- // refresh token
211
- /**
212
- * @swagger
213
- * /api/auth/refresh-token:
214
- * get:
215
- * summary: Mendapatkan access token baru dari refresh token
216
- * tags: [Auth]
217
- * responses:
218
- * 200:
219
- * description: Access token berhasil diperbarui
220
- * content:
221
- * application/json:
222
- * schema:
223
- * type: object
224
- * properties:
225
- * status:
226
- * type: boolean
227
- * status_code:
228
- * type: integer
229
- * message:
230
- * type: string
231
- * example: Get Access Token Berhasil
232
- * data:
233
- * type: object
234
- * properties:
235
- * user:
236
- * type: object
237
- * properties:
238
- * id:
239
- * type: string
240
- * fullName:
241
- * type: string
242
- * email:
243
- * type: string
244
- * password:
245
- * type: string
246
- * created_at:
247
- * type: string
248
- * updated_at:
249
- * type: string
250
- * deleted_at:
251
- * type: string
252
- * nullable: true
253
- * accessToken:
254
- * type: string
255
- * 401:
256
- * $ref: '#/components/responses/UnauthorizedNotLoginError'
257
- */
258
- // Update profile
259
- /**
260
- * @swagger
261
- * /api/auth/update-profile:
262
- * put:
263
- * summary: Memperbarui profil pengguna yang sedang login
264
- * tags: [Auth]
265
- * security:
266
- * - bearerAuth: []
267
- * requestBody:
268
- * required: true
269
- * content:
270
- * application/json:
271
- * schema:
272
- * type: object
273
- * properties:
274
- * fullName:
275
- * type: string
276
- * example: tes
277
- * email:
278
- * type: string
279
- * example: tes@gmail.com
280
- * responses:
281
- * 200:
282
- * description: Data Berhasil Diupdate
283
- * content:
284
- * application/json:
285
- * schema:
286
- * type: object
287
- * properties:
288
- * status:
289
- * type: boolean
290
- * example: true
291
- * status_code:
292
- * type: integer
293
- * example: 200
294
- * message:
295
- * type: string
296
- * example: Data Berhasil Diupdate
297
- * data:
298
- * type: object
299
- * properties:
300
- * id:
301
- * type: string
302
- * format: uuid
303
- * example: c1fa015f-48b0-456f-8c41-baf54ce092f5
304
- * fullName:
305
- * type: string
306
- * example: tes update
307
- * email:
308
- * type: string
309
- * example: tes@gmail.com
310
- * 400:
311
- * $ref: '#/components/responses/ValidationError'
312
- * 401:
313
- * $ref: '#/components/responses/UnauthorizedATError'
314
- */
1
+ /**
2
+ * @swagger
3
+ * /api/auth/register:
4
+ * post:
5
+ * summary: Register User
6
+ * tags: [Auth]
7
+ * requestBody:
8
+ * required: true
9
+ * content:
10
+ * application/json:
11
+ * schema:
12
+ * type: object
13
+ * required:
14
+ * - fullName
15
+ * - email
16
+ * - password
17
+ * properties:
18
+ * fullName:
19
+ * type: string
20
+ * email:
21
+ * type: string
22
+ * password:
23
+ * type: string
24
+ * responses:
25
+ * 201:
26
+ * description: Register berhasil
27
+ * content:
28
+ * application/json:
29
+ * schema:
30
+ * type: object
31
+ * properties:
32
+ * status:
33
+ * type: boolean
34
+ * status_code:
35
+ * type: integer
36
+ * message:
37
+ * type: string
38
+ * example: Register Berhasil
39
+ * data:
40
+ * type: object
41
+ * properties:
42
+ * id:
43
+ * type: string
44
+ * format: uuid
45
+ * fullName:
46
+ * type: string
47
+ * email:
48
+ * type: string
49
+ * 400:
50
+ * $ref: '#/components/responses/ValidationError'
51
+ * 409:
52
+ * description: Konflik - akun sudah terdaftar
53
+ * content:
54
+ * application/json:
55
+ * schema:
56
+ * type: object
57
+ * properties:
58
+ * status:
59
+ * type: boolean
60
+ * status_code:
61
+ * type: integer
62
+ * message:
63
+ * type: string
64
+ * example: Akun Sudah Terdaftar!
65
+ */
66
+ /**
67
+ * @swagger
68
+ * /api/auth/login:
69
+ * post:
70
+ * summary: Login User
71
+ * tags: [Auth]
72
+ * requestBody:
73
+ * required: true
74
+ * content:
75
+ * application/json:
76
+ * schema:
77
+ * type: object
78
+ * required:
79
+ * - email
80
+ * - password
81
+ * properties:
82
+ * email:
83
+ * type: string
84
+ * example: tes@gmail.com
85
+ * password:
86
+ * type: string
87
+ * example: 12345678
88
+ * responses:
89
+ * 200:
90
+ * description: Login berhasil
91
+ * content:
92
+ * application/json:
93
+ * schema:
94
+ * type: object
95
+ * properties:
96
+ * status:
97
+ * type: boolean
98
+ * example: true
99
+ * status_code:
100
+ * type: integer
101
+ * example: 200
102
+ * message:
103
+ * type: string
104
+ * example: Login Berhasil
105
+ * data:
106
+ * type: object
107
+ * properties:
108
+ * user:
109
+ * type: object
110
+ * properties:
111
+ * id:
112
+ * type: string
113
+ * fullName:
114
+ * type: string
115
+ * email:
116
+ * type: string
117
+ * accessToken:
118
+ * type: string
119
+ * refreshToken:
120
+ * type: string
121
+ * 400:
122
+ * $ref: '#/components/responses/ValidationError'
123
+ * 401:
124
+ * description: Login gagal - username,email atau password salah
125
+ * content:
126
+ * application/json:
127
+ * example:
128
+ * status: false
129
+ * status_code: 401
130
+ * message: Gagal Login! Detail login salah
131
+ */
132
+
133
+ // me
134
+ /**
135
+ * @swagger
136
+ * /api/auth/me:
137
+ * get:
138
+ * summary: Get informasi detail user yang sedang login
139
+ * tags: [Auth]
140
+ * security:
141
+ * - bearerAuth: []
142
+ * responses:
143
+ * 200:
144
+ * description: Get Detail User Berhasil
145
+ * content:
146
+ * application/json:
147
+ * schema:
148
+ * type: object
149
+ * properties:
150
+ * status:
151
+ * type: boolean
152
+ * status_code:
153
+ * type: integer
154
+ * message:
155
+ * type: string
156
+ * data:
157
+ * type: object
158
+ * properties:
159
+ * id:
160
+ * type: string
161
+ * fullName:
162
+ * type: string
163
+ * email:
164
+ * type: string
165
+ * created_at:
166
+ * type: string
167
+ * format: date-time
168
+ * updated_at:
169
+ * type: string
170
+ * format: date-time
171
+ * deleted_at:
172
+ * type: string
173
+ * format: date-time
174
+ * nullable: true
175
+ * 401:
176
+ * $ref: '#/components/responses/UnauthorizedATError'
177
+ */
178
+
179
+ // Logout
180
+ /**
181
+ * @swagger
182
+ * /api/auth/logout:
183
+ * post:
184
+ * summary: Logout User
185
+ * tags: [Auth]
186
+ * security:
187
+ * - bearerAuth: []
188
+ * responses:
189
+ * 200:
190
+ * description: Logout berhasil
191
+ * content:
192
+ * application/json:
193
+ * schema:
194
+ * type: object
195
+ * properties:
196
+ * status:
197
+ * type: boolean
198
+ * status_code:
199
+ * type: integer
200
+ * message:
201
+ * type: string
202
+ * example:
203
+ * status: true
204
+ * status_code: 200
205
+ * message: Logout Berhasil
206
+ * 401:
207
+ * $ref: '#/components/responses/UnauthorizedNotLoginError'
208
+ */
209
+
210
+ // refresh token
211
+ /**
212
+ * @swagger
213
+ * /api/auth/refresh-token:
214
+ * get:
215
+ * summary: Mendapatkan access token baru dari refresh token
216
+ * tags: [Auth]
217
+ * responses:
218
+ * 200:
219
+ * description: Access token berhasil diperbarui
220
+ * content:
221
+ * application/json:
222
+ * schema:
223
+ * type: object
224
+ * properties:
225
+ * status:
226
+ * type: boolean
227
+ * status_code:
228
+ * type: integer
229
+ * message:
230
+ * type: string
231
+ * example: Get Access Token Berhasil
232
+ * data:
233
+ * type: object
234
+ * properties:
235
+ * user:
236
+ * type: object
237
+ * properties:
238
+ * id:
239
+ * type: string
240
+ * fullName:
241
+ * type: string
242
+ * email:
243
+ * type: string
244
+ * password:
245
+ * type: string
246
+ * created_at:
247
+ * type: string
248
+ * updated_at:
249
+ * type: string
250
+ * deleted_at:
251
+ * type: string
252
+ * nullable: true
253
+ * accessToken:
254
+ * type: string
255
+ * 401:
256
+ * $ref: '#/components/responses/UnauthorizedNotLoginError'
257
+ */
258
+ // Update profile
259
+ /**
260
+ * @swagger
261
+ * /api/auth/update-profile:
262
+ * put:
263
+ * summary: Memperbarui profil pengguna yang sedang login
264
+ * tags: [Auth]
265
+ * security:
266
+ * - bearerAuth: []
267
+ * requestBody:
268
+ * required: true
269
+ * content:
270
+ * application/json:
271
+ * schema:
272
+ * type: object
273
+ * properties:
274
+ * fullName:
275
+ * type: string
276
+ * example: tes
277
+ * email:
278
+ * type: string
279
+ * example: tes@gmail.com
280
+ * responses:
281
+ * 200:
282
+ * description: Data Berhasil Diupdate
283
+ * content:
284
+ * application/json:
285
+ * schema:
286
+ * type: object
287
+ * properties:
288
+ * status:
289
+ * type: boolean
290
+ * example: true
291
+ * status_code:
292
+ * type: integer
293
+ * example: 200
294
+ * message:
295
+ * type: string
296
+ * example: Data Berhasil Diupdate
297
+ * data:
298
+ * type: object
299
+ * properties:
300
+ * id:
301
+ * type: string
302
+ * format: uuid
303
+ * example: c1fa015f-48b0-456f-8c41-baf54ce092f5
304
+ * fullName:
305
+ * type: string
306
+ * example: tes update
307
+ * email:
308
+ * type: string
309
+ * example: tes@gmail.com
310
+ * 400:
311
+ * $ref: '#/components/responses/ValidationError'
312
+ * 401:
313
+ * $ref: '#/components/responses/UnauthorizedATError'
314
+ */