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.
- package/README.md +137 -137
- package/bin/index.js +158 -158
- package/package.json +24 -24
- package/template/Dockerfile +57 -12
- package/template/babel.config.json +3 -3
- package/template/craft/commands/build.js +16 -15
- package/template/craft/commands/db-fresh.js +22 -22
- package/template/craft/commands/db-generate.js +23 -23
- package/template/craft/commands/db-migrate.js +22 -22
- package/template/craft/commands/dev.js +16 -16
- package/template/craft/commands/key-generate.js +41 -41
- package/template/craft/commands/make-apidocs.js +121 -121
- package/template/craft/commands/make-command.js +38 -38
- package/template/craft/commands/make-controller.js +95 -71
- package/template/craft/commands/make-dto.js +39 -39
- package/template/craft/commands/make-middleware.js +46 -46
- package/template/craft/commands/make-repository.js +36 -36
- package/template/craft/commands/make-route.js +92 -88
- package/template/craft/commands/make-service.js +39 -39
- package/template/craft/commands/make-test.js +48 -48
- package/template/craft/commands/make-utils.js +30 -30
- package/template/craft/commands/make-validation.js +42 -42
- package/template/craft/commands/make-view.js +42 -42
- package/template/craft/commands/start.js +29 -29
- package/template/craft/commands/test.js +20 -20
- package/template/craft.js +256 -256
- package/template/docker-compose.yml +8 -0
- package/template/nodemon.json +6 -6
- package/template/package-lock.json +8877 -8877
- package/template/package.json +84 -84
- package/template/prisma/schema.prisma +22 -22
- package/template/prisma/seed.ts +29 -29
- package/template/src/apidocs/auth-docs.ts +314 -314
- package/template/src/apidocs/users-docs.ts +240 -240
- package/template/src/config/cloudinary.ts +21 -21
- package/template/src/config/database.ts +90 -90
- package/template/src/config/env.ts +67 -67
- package/template/src/config/logger.ts +139 -139
- package/template/src/config/nodemailer.ts +23 -23
- package/template/src/config/web.ts +47 -47
- package/template/src/controllers/auth-controller.ts +88 -88
- package/template/src/controllers/user-controller.ts +79 -79
- package/template/src/dtos/list-dto.ts +12 -12
- package/template/src/dtos/user-dto.ts +57 -57
- package/template/src/main.ts +28 -28
- package/template/src/middleware/auth-middleware.ts +44 -44
- package/template/src/middleware/error-middleware.ts +27 -27
- package/template/src/middleware/http-logger-middleware.ts +31 -31
- package/template/src/repositories/user-repository.ts +75 -75
- package/template/src/routes/auth-route.ts +20 -20
- package/template/src/routes/main-route.ts +25 -25
- package/template/src/routes/user-route.ts +35 -35
- package/template/src/services/auth-service.ts +162 -162
- package/template/src/services/user-service.ts +102 -102
- package/template/src/types/type-request.ts +6 -6
- package/template/src/utils/async-handler.ts +9 -9
- package/template/src/utils/response-error.ts +10 -10
- package/template/src/utils/response.ts +60 -60
- package/template/src/utils/swagger.ts +135 -135
- package/template/src/utils/validation.ts +7 -7
- package/template/src/validations/user-validation.ts +127 -127
- package/template/src/views/index.ejs +6 -6
- package/template/src/views/layouts/main.ejs +14 -14
- package/template/src/views/partials/header.ejs +3 -3
- package/template/test/user.test.ts +16 -16
- package/template/tsconfig.json +13 -13
- package/template/.dockerignore +0 -4
- package/template/src/controllers/sass-controller.ts +0 -24
|
@@ -1,240 +1,240 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @swagger
|
|
3
|
-
* /api/users:
|
|
4
|
-
* get:
|
|
5
|
-
* summary: Mengambil daftar semua user
|
|
6
|
-
* tags: [Users]
|
|
7
|
-
* security:
|
|
8
|
-
* - bearerAuth: []
|
|
9
|
-
* parameters:
|
|
10
|
-
* - in: query
|
|
11
|
-
* name: page
|
|
12
|
-
* schema:
|
|
13
|
-
* type: integer
|
|
14
|
-
* required: false
|
|
15
|
-
* description: Nomor halaman
|
|
16
|
-
* - in: query
|
|
17
|
-
* name: take
|
|
18
|
-
* schema:
|
|
19
|
-
* type: integer
|
|
20
|
-
* required: false
|
|
21
|
-
* description: Jumlah data per halaman
|
|
22
|
-
* - in: query
|
|
23
|
-
* name: name
|
|
24
|
-
* schema:
|
|
25
|
-
* type: string
|
|
26
|
-
* required: false
|
|
27
|
-
* description: Filter berdasarkan nama (fullName)
|
|
28
|
-
* responses:
|
|
29
|
-
* 200:
|
|
30
|
-
* description: Berhasil Get All Data
|
|
31
|
-
* content:
|
|
32
|
-
* application/json:
|
|
33
|
-
* schema:
|
|
34
|
-
* type: object
|
|
35
|
-
* properties:
|
|
36
|
-
* status:
|
|
37
|
-
* type: boolean
|
|
38
|
-
* status_code:
|
|
39
|
-
* type: integer
|
|
40
|
-
* message:
|
|
41
|
-
* type: string
|
|
42
|
-
* data:
|
|
43
|
-
* type: object
|
|
44
|
-
* properties:
|
|
45
|
-
* data:
|
|
46
|
-
* type: array
|
|
47
|
-
* items:
|
|
48
|
-
* type: object
|
|
49
|
-
* properties:
|
|
50
|
-
* id:
|
|
51
|
-
* type: string
|
|
52
|
-
* format: uuid
|
|
53
|
-
* fullName:
|
|
54
|
-
* type: string
|
|
55
|
-
* email:
|
|
56
|
-
* type: string
|
|
57
|
-
* username:
|
|
58
|
-
* type: string
|
|
59
|
-
* password:
|
|
60
|
-
* type: string
|
|
61
|
-
* description: (Hashed password)
|
|
62
|
-
* image_id:
|
|
63
|
-
* type: string
|
|
64
|
-
* image_url:
|
|
65
|
-
* type: string
|
|
66
|
-
* format: uri
|
|
67
|
-
* is_verify:
|
|
68
|
-
* type: boolean
|
|
69
|
-
* created_at:
|
|
70
|
-
* type: string
|
|
71
|
-
* format: date-time
|
|
72
|
-
* updated_at:
|
|
73
|
-
* type: string
|
|
74
|
-
* format: date-time
|
|
75
|
-
* deleted_at:
|
|
76
|
-
* type: string
|
|
77
|
-
* format: date-time
|
|
78
|
-
* nullable: true
|
|
79
|
-
* role_id:
|
|
80
|
-
* type: string
|
|
81
|
-
* format: uuid
|
|
82
|
-
* total_data:
|
|
83
|
-
* type: integer
|
|
84
|
-
* paging:
|
|
85
|
-
* type: object
|
|
86
|
-
* properties:
|
|
87
|
-
* current_page:
|
|
88
|
-
* type: integer
|
|
89
|
-
* total_page:
|
|
90
|
-
* type: integer
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
/**
|
|
94
|
-
* @swagger
|
|
95
|
-
* /api/users/{id}:
|
|
96
|
-
* get:
|
|
97
|
-
* summary: Mengambil detail user berdasarkan ID
|
|
98
|
-
* tags: [Users]
|
|
99
|
-
* security:
|
|
100
|
-
* - bearerAuth: []
|
|
101
|
-
* parameters:
|
|
102
|
-
* - in: path
|
|
103
|
-
* name: id
|
|
104
|
-
* schema:
|
|
105
|
-
* type: string
|
|
106
|
-
* format: uuid
|
|
107
|
-
* required: true
|
|
108
|
-
* description: ID user yang akan diambil
|
|
109
|
-
* responses:
|
|
110
|
-
* 200:
|
|
111
|
-
* description: Berhasil Get Detail Data
|
|
112
|
-
* content:
|
|
113
|
-
* application/json:
|
|
114
|
-
* schema:
|
|
115
|
-
* type: object
|
|
116
|
-
* properties:
|
|
117
|
-
* status: { type: boolean }
|
|
118
|
-
* status_code: { type: integer }
|
|
119
|
-
* message: { type: string }
|
|
120
|
-
* data:
|
|
121
|
-
* type: object
|
|
122
|
-
* properties:
|
|
123
|
-
* id: { type: string, format: uuid }
|
|
124
|
-
* fullName: { type: string }
|
|
125
|
-
* email: { type: string, format: email }
|
|
126
|
-
* username: { type: string }
|
|
127
|
-
* role_id: { type: string, format: uuid }
|
|
128
|
-
*/
|
|
129
|
-
/**
|
|
130
|
-
* @swagger
|
|
131
|
-
* /api/users:
|
|
132
|
-
* post:
|
|
133
|
-
* summary: Menambahkan user baru
|
|
134
|
-
* tags: [Users]
|
|
135
|
-
* security:
|
|
136
|
-
* - bearerAuth: []
|
|
137
|
-
* - apiKeyAuth: []
|
|
138
|
-
* requestBody:
|
|
139
|
-
* required: true
|
|
140
|
-
* content:
|
|
141
|
-
* application/json:
|
|
142
|
-
* schema:
|
|
143
|
-
* type: object
|
|
144
|
-
* required: [ fullName, email, password ]
|
|
145
|
-
* properties:
|
|
146
|
-
* fullName: { type: string }
|
|
147
|
-
* email: { type: string, format: email }
|
|
148
|
-
* password: { type: string, format: password }
|
|
149
|
-
* responses:
|
|
150
|
-
* 201:
|
|
151
|
-
* description: Data Berhasil Ditambahkan
|
|
152
|
-
* content:
|
|
153
|
-
* application/json:
|
|
154
|
-
* schema:
|
|
155
|
-
* type: object
|
|
156
|
-
* properties:
|
|
157
|
-
* status: { type: boolean }
|
|
158
|
-
* status_code: { type: integer }
|
|
159
|
-
* message: { type: string }
|
|
160
|
-
* data:
|
|
161
|
-
* type: object
|
|
162
|
-
* properties:
|
|
163
|
-
* id: { type: string, format: uuid }
|
|
164
|
-
* fullName: { type: string }
|
|
165
|
-
* email: { type: string }
|
|
166
|
-
*/
|
|
167
|
-
/**
|
|
168
|
-
* @swagger
|
|
169
|
-
* /api/users/{id}:
|
|
170
|
-
* put:
|
|
171
|
-
* summary: Memperbarui data user berdasarkan ID
|
|
172
|
-
* tags: [Users]
|
|
173
|
-
* security:
|
|
174
|
-
* - bearerAuth: []
|
|
175
|
-
* parameters:
|
|
176
|
-
* - in: path
|
|
177
|
-
* name: id
|
|
178
|
-
* schema:
|
|
179
|
-
* type: string
|
|
180
|
-
* format: uuid
|
|
181
|
-
* required: true
|
|
182
|
-
* description: ID user yang akan diupdate
|
|
183
|
-
* requestBody:
|
|
184
|
-
* required: true
|
|
185
|
-
* content:
|
|
186
|
-
* application/json:
|
|
187
|
-
* schema:
|
|
188
|
-
* type: object
|
|
189
|
-
* properties:
|
|
190
|
-
* fullName: { type: string }
|
|
191
|
-
* email: { type: string, format: email }
|
|
192
|
-
* responses:
|
|
193
|
-
* 200:
|
|
194
|
-
* description: Data Berhasil Diupdate
|
|
195
|
-
* content:
|
|
196
|
-
* application/json:
|
|
197
|
-
* schema:
|
|
198
|
-
* type: object
|
|
199
|
-
* properties:
|
|
200
|
-
* status: { type: boolean }
|
|
201
|
-
* status_code: { type: integer }
|
|
202
|
-
* message: { type: string }
|
|
203
|
-
* data:
|
|
204
|
-
* type: object
|
|
205
|
-
* properties:
|
|
206
|
-
* id: { type: string, format: uuid }
|
|
207
|
-
* fullName: { type: string }
|
|
208
|
-
* email: { type: string }
|
|
209
|
-
*/
|
|
210
|
-
/**
|
|
211
|
-
* @swagger
|
|
212
|
-
* /api/users/{id}:
|
|
213
|
-
* delete:
|
|
214
|
-
* summary: Menghapus user secara permanen
|
|
215
|
-
* tags: [Users]
|
|
216
|
-
* security:
|
|
217
|
-
* - bearerAuth: []
|
|
218
|
-
* parameters:
|
|
219
|
-
* - in: path
|
|
220
|
-
* name: id
|
|
221
|
-
* schema:
|
|
222
|
-
* type: string
|
|
223
|
-
* format: uuid
|
|
224
|
-
* required: true
|
|
225
|
-
* description: ID user yang akan dihapus permanen
|
|
226
|
-
* responses:
|
|
227
|
-
* 200:
|
|
228
|
-
* description: Data Berhasil Dihapus
|
|
229
|
-
* content:
|
|
230
|
-
* application/json:
|
|
231
|
-
* schema:
|
|
232
|
-
* type: object
|
|
233
|
-
* properties:
|
|
234
|
-
* status: { type: boolean }
|
|
235
|
-
* status_code: { type: integer }
|
|
236
|
-
* message: { type: string }
|
|
237
|
-
* data:
|
|
238
|
-
* type: object
|
|
239
|
-
* nullable: true
|
|
240
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
* @swagger
|
|
3
|
+
* /api/users:
|
|
4
|
+
* get:
|
|
5
|
+
* summary: Mengambil daftar semua user
|
|
6
|
+
* tags: [Users]
|
|
7
|
+
* security:
|
|
8
|
+
* - bearerAuth: []
|
|
9
|
+
* parameters:
|
|
10
|
+
* - in: query
|
|
11
|
+
* name: page
|
|
12
|
+
* schema:
|
|
13
|
+
* type: integer
|
|
14
|
+
* required: false
|
|
15
|
+
* description: Nomor halaman
|
|
16
|
+
* - in: query
|
|
17
|
+
* name: take
|
|
18
|
+
* schema:
|
|
19
|
+
* type: integer
|
|
20
|
+
* required: false
|
|
21
|
+
* description: Jumlah data per halaman
|
|
22
|
+
* - in: query
|
|
23
|
+
* name: name
|
|
24
|
+
* schema:
|
|
25
|
+
* type: string
|
|
26
|
+
* required: false
|
|
27
|
+
* description: Filter berdasarkan nama (fullName)
|
|
28
|
+
* responses:
|
|
29
|
+
* 200:
|
|
30
|
+
* description: Berhasil Get All Data
|
|
31
|
+
* content:
|
|
32
|
+
* application/json:
|
|
33
|
+
* schema:
|
|
34
|
+
* type: object
|
|
35
|
+
* properties:
|
|
36
|
+
* status:
|
|
37
|
+
* type: boolean
|
|
38
|
+
* status_code:
|
|
39
|
+
* type: integer
|
|
40
|
+
* message:
|
|
41
|
+
* type: string
|
|
42
|
+
* data:
|
|
43
|
+
* type: object
|
|
44
|
+
* properties:
|
|
45
|
+
* data:
|
|
46
|
+
* type: array
|
|
47
|
+
* items:
|
|
48
|
+
* type: object
|
|
49
|
+
* properties:
|
|
50
|
+
* id:
|
|
51
|
+
* type: string
|
|
52
|
+
* format: uuid
|
|
53
|
+
* fullName:
|
|
54
|
+
* type: string
|
|
55
|
+
* email:
|
|
56
|
+
* type: string
|
|
57
|
+
* username:
|
|
58
|
+
* type: string
|
|
59
|
+
* password:
|
|
60
|
+
* type: string
|
|
61
|
+
* description: (Hashed password)
|
|
62
|
+
* image_id:
|
|
63
|
+
* type: string
|
|
64
|
+
* image_url:
|
|
65
|
+
* type: string
|
|
66
|
+
* format: uri
|
|
67
|
+
* is_verify:
|
|
68
|
+
* type: boolean
|
|
69
|
+
* created_at:
|
|
70
|
+
* type: string
|
|
71
|
+
* format: date-time
|
|
72
|
+
* updated_at:
|
|
73
|
+
* type: string
|
|
74
|
+
* format: date-time
|
|
75
|
+
* deleted_at:
|
|
76
|
+
* type: string
|
|
77
|
+
* format: date-time
|
|
78
|
+
* nullable: true
|
|
79
|
+
* role_id:
|
|
80
|
+
* type: string
|
|
81
|
+
* format: uuid
|
|
82
|
+
* total_data:
|
|
83
|
+
* type: integer
|
|
84
|
+
* paging:
|
|
85
|
+
* type: object
|
|
86
|
+
* properties:
|
|
87
|
+
* current_page:
|
|
88
|
+
* type: integer
|
|
89
|
+
* total_page:
|
|
90
|
+
* type: integer
|
|
91
|
+
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* @swagger
|
|
95
|
+
* /api/users/{id}:
|
|
96
|
+
* get:
|
|
97
|
+
* summary: Mengambil detail user berdasarkan ID
|
|
98
|
+
* tags: [Users]
|
|
99
|
+
* security:
|
|
100
|
+
* - bearerAuth: []
|
|
101
|
+
* parameters:
|
|
102
|
+
* - in: path
|
|
103
|
+
* name: id
|
|
104
|
+
* schema:
|
|
105
|
+
* type: string
|
|
106
|
+
* format: uuid
|
|
107
|
+
* required: true
|
|
108
|
+
* description: ID user yang akan diambil
|
|
109
|
+
* responses:
|
|
110
|
+
* 200:
|
|
111
|
+
* description: Berhasil Get Detail Data
|
|
112
|
+
* content:
|
|
113
|
+
* application/json:
|
|
114
|
+
* schema:
|
|
115
|
+
* type: object
|
|
116
|
+
* properties:
|
|
117
|
+
* status: { type: boolean }
|
|
118
|
+
* status_code: { type: integer }
|
|
119
|
+
* message: { type: string }
|
|
120
|
+
* data:
|
|
121
|
+
* type: object
|
|
122
|
+
* properties:
|
|
123
|
+
* id: { type: string, format: uuid }
|
|
124
|
+
* fullName: { type: string }
|
|
125
|
+
* email: { type: string, format: email }
|
|
126
|
+
* username: { type: string }
|
|
127
|
+
* role_id: { type: string, format: uuid }
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* @swagger
|
|
131
|
+
* /api/users:
|
|
132
|
+
* post:
|
|
133
|
+
* summary: Menambahkan user baru
|
|
134
|
+
* tags: [Users]
|
|
135
|
+
* security:
|
|
136
|
+
* - bearerAuth: []
|
|
137
|
+
* - apiKeyAuth: []
|
|
138
|
+
* requestBody:
|
|
139
|
+
* required: true
|
|
140
|
+
* content:
|
|
141
|
+
* application/json:
|
|
142
|
+
* schema:
|
|
143
|
+
* type: object
|
|
144
|
+
* required: [ fullName, email, password ]
|
|
145
|
+
* properties:
|
|
146
|
+
* fullName: { type: string }
|
|
147
|
+
* email: { type: string, format: email }
|
|
148
|
+
* password: { type: string, format: password }
|
|
149
|
+
* responses:
|
|
150
|
+
* 201:
|
|
151
|
+
* description: Data Berhasil Ditambahkan
|
|
152
|
+
* content:
|
|
153
|
+
* application/json:
|
|
154
|
+
* schema:
|
|
155
|
+
* type: object
|
|
156
|
+
* properties:
|
|
157
|
+
* status: { type: boolean }
|
|
158
|
+
* status_code: { type: integer }
|
|
159
|
+
* message: { type: string }
|
|
160
|
+
* data:
|
|
161
|
+
* type: object
|
|
162
|
+
* properties:
|
|
163
|
+
* id: { type: string, format: uuid }
|
|
164
|
+
* fullName: { type: string }
|
|
165
|
+
* email: { type: string }
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* @swagger
|
|
169
|
+
* /api/users/{id}:
|
|
170
|
+
* put:
|
|
171
|
+
* summary: Memperbarui data user berdasarkan ID
|
|
172
|
+
* tags: [Users]
|
|
173
|
+
* security:
|
|
174
|
+
* - bearerAuth: []
|
|
175
|
+
* parameters:
|
|
176
|
+
* - in: path
|
|
177
|
+
* name: id
|
|
178
|
+
* schema:
|
|
179
|
+
* type: string
|
|
180
|
+
* format: uuid
|
|
181
|
+
* required: true
|
|
182
|
+
* description: ID user yang akan diupdate
|
|
183
|
+
* requestBody:
|
|
184
|
+
* required: true
|
|
185
|
+
* content:
|
|
186
|
+
* application/json:
|
|
187
|
+
* schema:
|
|
188
|
+
* type: object
|
|
189
|
+
* properties:
|
|
190
|
+
* fullName: { type: string }
|
|
191
|
+
* email: { type: string, format: email }
|
|
192
|
+
* responses:
|
|
193
|
+
* 200:
|
|
194
|
+
* description: Data Berhasil Diupdate
|
|
195
|
+
* content:
|
|
196
|
+
* application/json:
|
|
197
|
+
* schema:
|
|
198
|
+
* type: object
|
|
199
|
+
* properties:
|
|
200
|
+
* status: { type: boolean }
|
|
201
|
+
* status_code: { type: integer }
|
|
202
|
+
* message: { type: string }
|
|
203
|
+
* data:
|
|
204
|
+
* type: object
|
|
205
|
+
* properties:
|
|
206
|
+
* id: { type: string, format: uuid }
|
|
207
|
+
* fullName: { type: string }
|
|
208
|
+
* email: { type: string }
|
|
209
|
+
*/
|
|
210
|
+
/**
|
|
211
|
+
* @swagger
|
|
212
|
+
* /api/users/{id}:
|
|
213
|
+
* delete:
|
|
214
|
+
* summary: Menghapus user secara permanen
|
|
215
|
+
* tags: [Users]
|
|
216
|
+
* security:
|
|
217
|
+
* - bearerAuth: []
|
|
218
|
+
* parameters:
|
|
219
|
+
* - in: path
|
|
220
|
+
* name: id
|
|
221
|
+
* schema:
|
|
222
|
+
* type: string
|
|
223
|
+
* format: uuid
|
|
224
|
+
* required: true
|
|
225
|
+
* description: ID user yang akan dihapus permanen
|
|
226
|
+
* responses:
|
|
227
|
+
* 200:
|
|
228
|
+
* description: Data Berhasil Dihapus
|
|
229
|
+
* content:
|
|
230
|
+
* application/json:
|
|
231
|
+
* schema:
|
|
232
|
+
* type: object
|
|
233
|
+
* properties:
|
|
234
|
+
* status: { type: boolean }
|
|
235
|
+
* status_code: { type: integer }
|
|
236
|
+
* message: { type: string }
|
|
237
|
+
* data:
|
|
238
|
+
* type: object
|
|
239
|
+
* nullable: true
|
|
240
|
+
*/
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { v2 as cloudinary } from "cloudinary";
|
|
2
|
-
import { env } from "./env";
|
|
3
|
-
import { logger } from "./logger";
|
|
4
|
-
|
|
5
|
-
if (
|
|
6
|
-
env.CLOUDINARY_CLOUD_NAME &&
|
|
7
|
-
env.CLOUDINARY_API_KEY &&
|
|
8
|
-
env.CLOUDINARY_API_SECRET
|
|
9
|
-
) {
|
|
10
|
-
cloudinary.config({
|
|
11
|
-
cloud_name: env.CLOUDINARY_CLOUD_NAME,
|
|
12
|
-
api_key: env.CLOUDINARY_API_KEY,
|
|
13
|
-
api_secret: env.CLOUDINARY_API_SECRET,
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
logger.warn(
|
|
17
|
-
"⚠️ Cloudinary config is incomplete. Skipping Cloudinary configuration."
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { cloudinary };
|
|
1
|
+
import { v2 as cloudinary } from "cloudinary";
|
|
2
|
+
import { env } from "./env";
|
|
3
|
+
import { logger } from "./logger";
|
|
4
|
+
|
|
5
|
+
if (
|
|
6
|
+
env.CLOUDINARY_CLOUD_NAME &&
|
|
7
|
+
env.CLOUDINARY_API_KEY &&
|
|
8
|
+
env.CLOUDINARY_API_SECRET
|
|
9
|
+
) {
|
|
10
|
+
cloudinary.config({
|
|
11
|
+
cloud_name: env.CLOUDINARY_CLOUD_NAME,
|
|
12
|
+
api_key: env.CLOUDINARY_API_KEY,
|
|
13
|
+
api_secret: env.CLOUDINARY_API_SECRET,
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
logger.warn(
|
|
17
|
+
"⚠️ Cloudinary config is incomplete. Skipping Cloudinary configuration."
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { cloudinary };
|