create-nextjs-cms 0.5.28 → 0.5.30

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/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import fs from 'fs-extra';
3
3
  import { execSync } from 'node:child_process';
4
4
  import { fileURLToPath } from 'node:url';
5
+ import { randomBytes } from 'node:crypto';
5
6
  import path, { dirname, resolve, relative, basename } from 'node:path';
6
7
  import { Command } from 'commander';
7
8
  import prompts from 'prompts';
@@ -166,6 +167,37 @@ export default hasItemsSection({
166
167
  await fs.writeFile(blogSectionPath, blogSectionContent, 'utf-8');
167
168
  console.log('✅ Blog section created successfully!');
168
169
  }
170
+ /**
171
+ * Generates a random secret string using crypto.randomBytes
172
+ */
173
+ function generateSecret() {
174
+ return randomBytes(32).toString('hex');
175
+ }
176
+ /**
177
+ * Updates .env file with generated random secrets
178
+ */
179
+ async function updateEnvSecrets(targetDir) {
180
+ const envPath = path.join(targetDir, '.env');
181
+ if (!(await fs.pathExists(envPath))) {
182
+ console.warn('⚠️ No .env file found; skipping secret generation.');
183
+ return;
184
+ }
185
+ try {
186
+ let envContent = await fs.readFile(envPath, 'utf-8');
187
+ // Replace placeholder secrets with generated ones
188
+ envContent = envContent.replace(/ACCESS_TOKEN_SECRET=.*/, `ACCESS_TOKEN_SECRET=${generateSecret()}`);
189
+ envContent = envContent.replace(/REFRESH_TOKEN_SECRET=.*/, `REFRESH_TOKEN_SECRET=${generateSecret()}`);
190
+ envContent = envContent.replace(/CSRF_TOKEN_SECRET=.*/, `CSRF_TOKEN_SECRET=${generateSecret()}`);
191
+ envContent = envContent.replace(/ACCESS_TOKEN_EXPIRATION=.*/, 'ACCESS_TOKEN_EXPIRATION=2h');
192
+ envContent = envContent.replace(/REFRESH_TOKEN_EXPIRATION=.*/, 'REFRESH_TOKEN_EXPIRATION=1y');
193
+ await fs.writeFile(envPath, envContent, 'utf-8');
194
+ console.log('🔐 Generated random secrets and set token expirations in .env file');
195
+ }
196
+ catch (e) {
197
+ console.warn('⚠️ Could not update .env secrets automatically.');
198
+ console.warn(` Error: ${e instanceof Error ? e.message : 'Unknown error'}`);
199
+ }
200
+ }
169
201
  async function createNextjsCms() {
170
202
  console.log('🚀 Welcome to NextJS CMS!');
171
203
  console.log('Creating your new CMS project...\n');
@@ -291,6 +323,8 @@ async function createNextjsCms() {
291
323
  errorOnExist: false,
292
324
  });
293
325
  console.log('✅ Template copied successfully!');
326
+ // Generate random secrets for .env file
327
+ await updateEnvSecrets(options.targetDir);
294
328
  // npm excludes .gitignore from packages, so we rename it back from _gitignore
295
329
  const gitignoreTemplatePath = path.join(options.targetDir, '_gitignore');
296
330
  const gitignorePath = path.join(options.targetDir, '.gitignore');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextjs-cms",
3
- "version": "0.5.28",
3
+ "version": "0.5.30",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "create-nextjs-cms": "./dist/index.js"
@@ -1,373 +1,381 @@
1
- import {mysqlTable,int,longtext,mysqlEnum,varchar,double,boolean,datetime} from 'drizzle-orm/mysql-core'
2
-
3
- export const AppInfoTable = mysqlTable('app_info', {
4
- id: int('id').autoincrement().notNull().primaryKey(),
5
- aboutEn: longtext('about_en').notNull(),
6
- aboutAr: longtext('about_ar').notNull(),
7
- aboutTr: longtext('about_tr').notNull(),
8
- privacyEn: longtext('privacy_en').notNull(),
9
- privacyAr: longtext('privacy_ar').notNull(),
10
- privacyTr: longtext('privacy_tr').notNull()
11
- });
12
-
13
-
14
- export const UserReportsTable = mysqlTable('user_reports', {
15
- id: int('id').autoincrement().notNull().primaryKey(),
16
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
17
- reportType: mysqlEnum('report_type', ['explicit_content', 'wrong_information', 'no_longer_available', 'user_not_responsive', 'other']).notNull(),
18
- contentId: int('content_id').notNull(),
19
- catId: int('cat_id').notNull(),
20
- userId: int('user_id'),
21
- appId: varchar('app_id', { length: 36 }).notNull()
22
- });
23
-
24
-
25
- export const FeaturedSliderTable = mysqlTable('featured_slider', {
26
- id: int('id').autoincrement().notNull().primaryKey(),
27
- image: varchar('image', { length: 255 }).notNull(),
28
- titleEn: varchar('title_en', { length: 255 }).notNull(),
29
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
30
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
31
- descEn: longtext('desc_en').notNull(),
32
- descAr: longtext('desc_ar').notNull(),
33
- descTr: longtext('desc_tr').notNull()
34
- });
35
-
36
-
37
- export const ServicesTable = mysqlTable('services', {
38
- id: int('id').autoincrement().notNull().primaryKey(),
39
- title: varchar('title', { length: 255 }).notNull(),
40
- catId: int('cat_id').notNull(),
41
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
42
- price: int('price'),
43
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
44
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
45
- desc: longtext('desc'),
46
- latitude: double('latitude'),
47
- longitude: double('longitude'),
48
- viewCount: int('view_count'),
49
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
50
- govId: int('gov_id').notNull(),
51
- districtId: int('district_id').notNull(),
52
- subDistrictId: int('sub_district_id'),
53
- townId: int('town_id')
54
- });
55
-
56
-
57
- export const RealestateTable = mysqlTable('realestate', {
58
- id: int('id').autoincrement().notNull().primaryKey(),
59
- catId: int('cat_id').notNull(),
60
- title: varchar('title', { length: 255 }).notNull(),
61
- price: int('price').notNull(),
62
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
63
- spaceGross: int('space_gross').notNull(),
64
- spaceNet: int('space_net').notNull(),
65
- latitude: double('latitude').notNull(),
66
- longitude: double('longitude').notNull(),
67
- roomCount: varchar('room_count', { length: 255 }),
68
- buildingAge: varchar('building_age', { length: 255 }),
69
- floorCount: varchar('floor_count', { length: 255 }),
70
- bathroomCount: varchar('bathroom_count', { length: 255 }),
71
- floorLocation: varchar('floor_location', { length: 255 }),
72
- heatingType: varchar('heating_type', { length: 255 }),
73
- kitchenType: varchar('kitchen_type', { length: 255 }),
74
- balcony: boolean('balcony'),
75
- lift: boolean('lift'),
76
- parkingType: varchar('parking_type', { length: 255 }),
77
- furnished: boolean('furnished'),
78
- belongsToSite: boolean('belongs_to_site'),
79
- siteName: varchar('site_name', { length: 255 }),
80
- installments: boolean('installments'),
81
- exchangeable: boolean('exchangeable'),
82
- fromWhom: varchar('from_whom', { length: 255 }),
83
- buildingMembershipFees: int('building_membership_fees'),
84
- deposit: int('deposit'),
85
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
86
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
87
- desc: longtext('desc'),
88
- viewCount: int('view_count'),
89
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
90
- govId: int('gov_id').notNull(),
91
- districtId: int('district_id').notNull(),
92
- subDistrictId: int('sub_district_id'),
93
- townId: int('town_id')
94
- });
95
-
96
-
97
- export const HomepageSliderTable = mysqlTable('homepage_slider', {
98
- id: int('id').autoincrement().notNull().primaryKey(),
99
- titleEn: varchar('title_en', { length: 255 }).notNull(),
100
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
101
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
102
- subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
103
- subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
104
- subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
105
- photo: varchar('photo', { length: 255 }).notNull(),
106
- buttonUrl: varchar('button_url', { length: 255 }),
107
- buttonTextEn: varchar('button_text_en', { length: 255 }),
108
- buttonTextAr: varchar('button_text_ar', { length: 255 }),
109
- buttonTextTr: varchar('button_text_tr', { length: 255 }),
110
- buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
111
- });
112
-
113
-
114
- export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
115
- id: int('id').autoincrement().notNull().primaryKey(),
116
- contestId: varchar('contest_id', { length: 255 }).notNull(),
117
- userId: int('user_id').notNull()
118
- });
119
-
120
-
121
- export const ContestsTable = mysqlTable('contests', {
122
- id: int('id').autoincrement().notNull().primaryKey(),
123
- date: datetime('date').notNull(),
124
- prize: varchar('prize', { length: 255 }).notNull(),
125
- winnerId: int('winner_id')
126
- });
127
-
128
-
129
- export const NotificationsTable = mysqlTable('notifications', {
130
- id: int('id').autoincrement().notNull().primaryKey(),
131
- type: mysqlEnum('type', ['ad_price_updated', 'ad_updated', 'ad_activated', 'ad_pending_review', 'ad_expired', 'ad_rejected', 'ad_viewed', 'ad_favorited', 'ad_shared', 'ad_reported', 'ad_deleted', 'ad_created', 'contest_winner', 'contest_reminder', 'contest_created', 'custom']).notNull(),
132
- contentId: int('content_id'),
133
- contentCatId: int('content_cat_id'),
134
- userId: int('user_id'),
135
- message: varchar('message', { length: 255 })
136
- });
137
-
138
-
139
- export const ModerationTable = mysqlTable('moderation', {
140
- id: int('id').autoincrement().notNull().primaryKey(),
141
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
142
- contentId: int('content_id').notNull(),
143
- catId: int('cat_id'),
144
- userId: int('user_id').notNull(),
145
- flagged: int('flagged').notNull(),
146
- result: varchar('result', { length: 255 }).notNull()
147
- });
148
-
149
-
150
- export const JobsTable = mysqlTable('jobs', {
151
- id: int('id').autoincrement().notNull().primaryKey(),
152
- title: varchar('title', { length: 255 }).notNull(),
153
- catId: int('cat_id').notNull(),
154
- salary: int('salary'),
155
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
156
- workMethod: varchar('work_method', { length: 255 }).notNull(),
157
- minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
158
- experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
159
- remote: boolean('remote'),
160
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
161
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
162
- desc: longtext('desc'),
163
- latitude: double('latitude'),
164
- longitude: double('longitude'),
165
- viewCount: int('view_count'),
166
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
167
- govId: int('gov_id').notNull(),
168
- districtId: int('district_id').notNull(),
169
- subDistrictId: int('sub_district_id'),
170
- townId: int('town_id')
171
- });
172
-
173
-
174
- export const FurnitureTable = mysqlTable('furniture', {
175
- id: int('id').autoincrement().notNull().primaryKey(),
176
- title: varchar('title', { length: 255 }).notNull(),
177
- catId: int('cat_id').notNull(),
178
- condition: varchar('condition', { length: 255 }).notNull(),
179
- price: int('price').notNull(),
180
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
181
- exchangeable: boolean('exchangeable'),
182
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
183
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
184
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
185
- desc: longtext('desc'),
186
- latitude: double('latitude'),
187
- longitude: double('longitude'),
188
- viewCount: int('view_count'),
189
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
190
- govId: int('gov_id').notNull(),
191
- districtId: int('district_id').notNull(),
192
- subDistrictId: int('sub_district_id'),
193
- townId: int('town_id')
194
- });
195
-
196
-
197
- export const FiltersTable = mysqlTable('filters', {
198
- id: int('id').autoincrement().notNull().primaryKey(),
199
- title: varchar('title', { length: 255 }).notNull(),
200
- Key: varchar('_key', { length: 255 }).notNull(),
201
- fieldName: varchar('field_name', { length: 255 }).notNull(),
202
- type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
203
- tableName: varchar('table_name', { length: 255 }),
204
- isMandatory: boolean('is_mandatory')
205
- });
206
-
207
-
208
- export const FaqTable = mysqlTable('faq', {
209
- id: int('id').autoincrement().notNull().primaryKey(),
210
- qEn: varchar('q_en', { length: 255 }).notNull(),
211
- qAr: varchar('q_ar', { length: 255 }).notNull(),
212
- qTr: varchar('q_tr', { length: 255 }),
213
- aEn: longtext('a_en').notNull(),
214
- aAr: longtext('a_ar'),
215
- aTr: longtext('a_tr')
216
- });
217
-
218
-
219
- export const ErrorsTable = mysqlTable('errors', {
220
- id: int('id').autoincrement().notNull().primaryKey(),
221
- title: varchar('title', { length: 255 }).notNull(),
222
- caseId: varchar('case_id', { length: 255 }).notNull(),
223
- userId: int('user_id'),
224
- itemSlug: varchar('item_slug', { length: 255 }),
225
- desc: longtext('desc'),
226
- isResolved: boolean('is_resolved')
227
- });
228
-
229
-
230
- export const ElectronicsTable = mysqlTable('electronics', {
231
- id: int('id').autoincrement().notNull().primaryKey(),
232
- title: varchar('title', { length: 255 }).notNull(),
233
- catId: int('cat_id').notNull(),
234
- condition: varchar('condition', { length: 255 }).notNull(),
235
- price: int('price').notNull(),
236
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
237
- exchangeable: boolean('exchangeable'),
238
- installments: boolean('installments'),
239
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
240
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
241
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
242
- desc: longtext('desc'),
243
- latitude: double('latitude'),
244
- longitude: double('longitude'),
245
- viewCount: int('view_count'),
246
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
247
- govId: int('gov_id').notNull(),
248
- districtId: int('district_id').notNull(),
249
- subDistrictId: int('sub_district_id'),
250
- townId: int('town_id')
251
- });
252
-
253
-
254
- export const ClothesTable = mysqlTable('clothes', {
255
- id: int('id').autoincrement().notNull().primaryKey(),
256
- title: varchar('title', { length: 255 }).notNull(),
257
- catId: int('cat_id').notNull(),
258
- condition: varchar('condition', { length: 255 }).notNull(),
259
- price: int('price').notNull(),
260
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
261
- exchangeable: boolean('exchangeable'),
262
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
263
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
264
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
265
- desc: longtext('desc'),
266
- latitude: double('latitude'),
267
- longitude: double('longitude'),
268
- viewCount: int('view_count'),
269
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
270
- govId: int('gov_id').notNull(),
271
- districtId: int('district_id').notNull(),
272
- subDistrictId: int('sub_district_id'),
273
- townId: int('town_id')
274
- });
275
-
276
-
277
- export const CatsTable = mysqlTable('cats', {
278
- id: int('id').autoincrement().notNull().primaryKey(),
279
- catOrder: int('cat_order').notNull(),
280
- slug: varchar('slug', { length: 255 }).notNull(),
281
- titleEn: varchar('title_en', { length: 255 }).notNull(),
282
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
283
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
284
- fullTitleEn: varchar('full_title_en', { length: 255 }),
285
- fullTitleAr: varchar('full_title_ar', { length: 255 }),
286
- fullTitleTr: varchar('full_title_tr', { length: 255 }),
287
- image: varchar('image', { length: 255 }),
288
- metaDescEn: varchar('meta_desc_en', { length: 255 }),
289
- metaDescAr: varchar('meta_desc_ar', { length: 255 }),
290
- metaDescTr: varchar('meta_desc_tr', { length: 255 }),
291
- filters: varchar('filters', { length: 255 }),
292
- tableName: varchar('table_name', { length: 255 }).notNull(),
293
- adCount: int('ad_count'),
294
- parentId: int('parent_id'),
295
- level: int('level')
296
- });
297
-
298
-
299
- export const CarsTable = mysqlTable('cars', {
300
- id: int('id').autoincrement().notNull().primaryKey(),
301
- modelYear: int('model_year').notNull(),
302
- model: varchar('model', { length: 255 }).notNull(),
303
- title: varchar('title', { length: 255 }).notNull(),
304
- catId: int('cat_id').notNull(),
305
- govId: int('gov_id').notNull(),
306
- districtId: int('district_id').notNull(),
307
- subDistrictId: int('sub_district_id'),
308
- townId: int('town_id'),
309
- price: int('price').notNull(),
310
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
311
- condition: varchar('condition', { length: 255 }).notNull(),
312
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
313
- engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
314
- enginePower: varchar('engine_power', { length: 255 }).notNull(),
315
- tractionType: varchar('traction_type', { length: 255 }).notNull(),
316
- bodyType: varchar('body_type', { length: 255 }).notNull(),
317
- gearType: varchar('gear_type', { length: 255 }).notNull(),
318
- fuelType: varchar('fuel_type', { length: 255 }).notNull(),
319
- exchangeable: boolean('exchangeable'),
320
- installments: boolean('installments'),
321
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
322
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
323
- desc: longtext('desc'),
324
- latitude: double('latitude'),
325
- longitude: double('longitude'),
326
- viewCount: int('view_count'),
327
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
328
- });
329
-
330
-
331
- export const CarsDbTable = mysqlTable('cars_db', {
332
- id: int('id').autoincrement().notNull().primaryKey(),
333
- name: varchar('name', { length: 255 }).notNull(),
334
- parentId: int('parent_id'),
335
- level: int('level')
336
- });
337
-
338
-
339
- export const BooksTable = mysqlTable('books', {
340
- id: int('id').autoincrement().notNull().primaryKey(),
341
- title: varchar('title', { length: 255 }).notNull(),
342
- catId: int('cat_id').notNull(),
343
- condition: varchar('condition', { length: 255 }).notNull(),
344
- price: int('price').notNull(),
345
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
346
- exchangeable: boolean('exchangeable'),
347
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
348
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
349
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
350
- desc: longtext('desc'),
351
- latitude: double('latitude'),
352
- longitude: double('longitude'),
353
- viewCount: int('view_count'),
354
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
355
- govId: int('gov_id').notNull(),
356
- districtId: int('district_id').notNull(),
357
- subDistrictId: int('sub_district_id'),
358
- townId: int('town_id')
359
- });
360
-
361
-
362
- export const AddressTable = mysqlTable('address', {
363
- id: int('id').autoincrement().notNull().primaryKey(),
364
- catOrder: int('cat_order').notNull(),
365
- titleEn: varchar('title_en', { length: 255 }).notNull(),
366
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
367
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
368
- image: varchar('image', { length: 255 }),
369
- path: varchar('path', { length: 255 }),
370
- parentId: int('parent_id'),
371
- level: int('level')
372
- });
373
-
1
+ import {mysqlTable,int,longtext,mysqlEnum,varchar,boolean,double,timestamp} from 'drizzle-orm/mysql-core'
2
+
3
+ export const AppInfoTable = mysqlTable('app_info', {
4
+ id: int('id').autoincrement().notNull().primaryKey(),
5
+ aboutEn: longtext('about_en').notNull(),
6
+ aboutAr: longtext('about_ar').notNull(),
7
+ aboutTr: longtext('about_tr').notNull(),
8
+ privacyEn: longtext('privacy_en').notNull(),
9
+ privacyAr: longtext('privacy_ar').notNull(),
10
+ privacyTr: longtext('privacy_tr').notNull()
11
+ });
12
+
13
+
14
+ export const UserReportsTable = mysqlTable('user_reports', {
15
+ id: int('id').autoincrement().notNull().primaryKey(),
16
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
17
+ reportType: mysqlEnum('report_type', ['explicit_content', 'wrong_information', 'no_longer_available', 'user_not_responsive', 'other']).notNull(),
18
+ contentId: int('content_id').notNull(),
19
+ catId: int('cat_id').notNull(),
20
+ userId: int('user_id'),
21
+ appId: varchar('app_id', { length: 36 }).notNull()
22
+ });
23
+
24
+
25
+ export const FeaturedSliderTable = mysqlTable('featured_slider', {
26
+ id: int('id').autoincrement().notNull().primaryKey(),
27
+ image: varchar('image', { length: 255 }).notNull(),
28
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
29
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
30
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
31
+ descEn: longtext('desc_en').notNull(),
32
+ descAr: longtext('desc_ar').notNull(),
33
+ descTr: longtext('desc_tr').notNull()
34
+ });
35
+
36
+
37
+ export const MenuSettingsTable = mysqlTable('menu_settings', {
38
+ id: int('id').autoincrement().notNull().primaryKey(),
39
+ taxRate: varchar('tax_rate', { length: 255 }),
40
+ hideSlider: boolean('hide_slider')
41
+ });
42
+
43
+
44
+ export const ServicesTable = mysqlTable('services', {
45
+ id: int('id').autoincrement().notNull().primaryKey(),
46
+ title: varchar('title', { length: 255 }).notNull(),
47
+ catId: int('cat_id').notNull(),
48
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
49
+ price: int('price'),
50
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
51
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
52
+ desc: longtext('desc'),
53
+ latitude: double('latitude'),
54
+ longitude: double('longitude'),
55
+ viewCount: int('view_count'),
56
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
57
+ govId: int('gov_id').notNull(),
58
+ districtId: int('district_id').notNull(),
59
+ subDistrictId: int('sub_district_id'),
60
+ townId: int('town_id')
61
+ });
62
+
63
+
64
+ export const RealestateTable = mysqlTable('realestate', {
65
+ id: int('id').autoincrement().notNull().primaryKey(),
66
+ catId: int('cat_id').notNull(),
67
+ title: varchar('title', { length: 255 }).notNull(),
68
+ price: int('price').notNull(),
69
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
70
+ spaceGross: int('space_gross').notNull(),
71
+ spaceNet: int('space_net').notNull(),
72
+ latitude: double('latitude').notNull(),
73
+ longitude: double('longitude').notNull(),
74
+ roomCount: varchar('room_count', { length: 255 }),
75
+ buildingAge: varchar('building_age', { length: 255 }),
76
+ floorCount: varchar('floor_count', { length: 255 }),
77
+ bathroomCount: varchar('bathroom_count', { length: 255 }),
78
+ floorLocation: varchar('floor_location', { length: 255 }),
79
+ heatingType: varchar('heating_type', { length: 255 }),
80
+ kitchenType: varchar('kitchen_type', { length: 255 }),
81
+ balcony: boolean('balcony'),
82
+ lift: boolean('lift'),
83
+ parkingType: varchar('parking_type', { length: 255 }),
84
+ furnished: boolean('furnished'),
85
+ belongsToSite: boolean('belongs_to_site'),
86
+ siteName: varchar('site_name', { length: 255 }),
87
+ installments: boolean('installments'),
88
+ exchangeable: boolean('exchangeable'),
89
+ fromWhom: varchar('from_whom', { length: 255 }),
90
+ buildingMembershipFees: int('building_membership_fees'),
91
+ deposit: int('deposit'),
92
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
93
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
94
+ desc: longtext('desc'),
95
+ viewCount: int('view_count'),
96
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
97
+ govId: int('gov_id').notNull(),
98
+ districtId: int('district_id').notNull(),
99
+ subDistrictId: int('sub_district_id'),
100
+ townId: int('town_id')
101
+ });
102
+
103
+
104
+ export const HomepageSliderTable = mysqlTable('homepage_slider', {
105
+ id: int('id').autoincrement().notNull().primaryKey(),
106
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
107
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
108
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
109
+ subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
110
+ subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
111
+ subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
112
+ photo: varchar('photo', { length: 255 }).notNull(),
113
+ buttonUrl: varchar('button_url', { length: 255 }),
114
+ buttonTextEn: varchar('button_text_en', { length: 255 }),
115
+ buttonTextAr: varchar('button_text_ar', { length: 255 }),
116
+ buttonTextTr: varchar('button_text_tr', { length: 255 }),
117
+ buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
118
+ });
119
+
120
+
121
+ export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
122
+ id: int('id').autoincrement().notNull().primaryKey(),
123
+ contestId: varchar('contest_id', { length: 255 }).notNull(),
124
+ userId: int('user_id').notNull()
125
+ });
126
+
127
+
128
+ export const ContestsTable = mysqlTable('contests', {
129
+ id: int('id').autoincrement().notNull().primaryKey(),
130
+ date: timestamp('date').notNull(),
131
+ prize: varchar('prize', { length: 255 }).notNull(),
132
+ winnerId: int('winner_id'),
133
+ tags: varchar('tags', { length: 255 })
134
+ });
135
+
136
+
137
+ export const NotificationsTable = mysqlTable('notifications', {
138
+ id: int('id').autoincrement().notNull().primaryKey(),
139
+ type: mysqlEnum('type', ['ad_price_updated', 'ad_updated', 'ad_activated', 'ad_pending_review', 'ad_expired', 'ad_rejected', 'ad_viewed', 'ad_favorited', 'ad_shared', 'ad_reported', 'ad_deleted', 'ad_created', 'contest_winner', 'contest_reminder', 'contest_created', 'custom']).notNull(),
140
+ contentId: int('content_id'),
141
+ contentCatId: int('content_cat_id'),
142
+ userId: int('user_id'),
143
+ message: varchar('message', { length: 255 })
144
+ });
145
+
146
+
147
+ export const ModerationTable = mysqlTable('moderation', {
148
+ id: int('id').autoincrement().notNull().primaryKey(),
149
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
150
+ contentId: int('content_id').notNull(),
151
+ catId: int('cat_id'),
152
+ userId: int('user_id').notNull(),
153
+ flagged: int('flagged').notNull(),
154
+ result: varchar('result', { length: 255 }).notNull()
155
+ });
156
+
157
+
158
+ export const JobsTable = mysqlTable('jobs', {
159
+ id: int('id').autoincrement().notNull().primaryKey(),
160
+ title: varchar('title', { length: 255 }).notNull(),
161
+ catId: int('cat_id').notNull(),
162
+ salary: int('salary'),
163
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
164
+ workMethod: varchar('work_method', { length: 255 }).notNull(),
165
+ minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
166
+ experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
167
+ remote: boolean('remote'),
168
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
169
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
170
+ desc: longtext('desc'),
171
+ latitude: double('latitude'),
172
+ longitude: double('longitude'),
173
+ viewCount: int('view_count'),
174
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
175
+ govId: int('gov_id').notNull(),
176
+ districtId: int('district_id').notNull(),
177
+ subDistrictId: int('sub_district_id'),
178
+ townId: int('town_id')
179
+ });
180
+
181
+
182
+ export const FurnitureTable = mysqlTable('furniture', {
183
+ id: int('id').autoincrement().notNull().primaryKey(),
184
+ title: varchar('title', { length: 255 }).notNull(),
185
+ catId: int('cat_id').notNull(),
186
+ condition: varchar('condition', { length: 255 }).notNull(),
187
+ price: int('price').notNull(),
188
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
189
+ exchangeable: boolean('exchangeable'),
190
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
191
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
192
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
193
+ desc: longtext('desc'),
194
+ latitude: double('latitude'),
195
+ longitude: double('longitude'),
196
+ viewCount: int('view_count'),
197
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
198
+ govId: int('gov_id').notNull(),
199
+ districtId: int('district_id').notNull(),
200
+ subDistrictId: int('sub_district_id'),
201
+ townId: int('town_id')
202
+ });
203
+
204
+
205
+ export const FiltersTable = mysqlTable('filters', {
206
+ id: int('id').autoincrement().notNull().primaryKey(),
207
+ title: varchar('title', { length: 255 }).notNull(),
208
+ Key: varchar('_key', { length: 255 }).notNull(),
209
+ fieldName: varchar('field_name', { length: 255 }).notNull(),
210
+ type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
211
+ tableName: varchar('table_name', { length: 255 }),
212
+ isMandatory: boolean('is_mandatory')
213
+ });
214
+
215
+
216
+ export const FaqTable = mysqlTable('faq', {
217
+ id: int('id').autoincrement().notNull().primaryKey(),
218
+ qEn: varchar('q_en', { length: 255 }).notNull(),
219
+ qAr: varchar('q_ar', { length: 255 }).notNull(),
220
+ qTr: varchar('q_tr', { length: 255 }),
221
+ aEn: longtext('a_en').notNull(),
222
+ aAr: longtext('a_ar'),
223
+ aTr: longtext('a_tr')
224
+ });
225
+
226
+
227
+ export const ErrorsTable = mysqlTable('errors', {
228
+ id: int('id').autoincrement().notNull().primaryKey(),
229
+ title: varchar('title', { length: 255 }).notNull(),
230
+ caseId: varchar('case_id', { length: 255 }).notNull(),
231
+ userId: int('user_id'),
232
+ itemSlug: varchar('item_slug', { length: 255 }),
233
+ desc: longtext('desc'),
234
+ isResolved: boolean('is_resolved')
235
+ });
236
+
237
+
238
+ export const ElectronicsTable = mysqlTable('electronics', {
239
+ id: int('id').autoincrement().notNull().primaryKey(),
240
+ title: varchar('title', { length: 255 }).notNull(),
241
+ catId: int('cat_id').notNull(),
242
+ condition: varchar('condition', { length: 255 }).notNull(),
243
+ price: int('price').notNull(),
244
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
245
+ exchangeable: boolean('exchangeable'),
246
+ installments: boolean('installments'),
247
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
248
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
249
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
250
+ desc: longtext('desc'),
251
+ latitude: double('latitude'),
252
+ longitude: double('longitude'),
253
+ viewCount: int('view_count'),
254
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
255
+ govId: int('gov_id').notNull(),
256
+ districtId: int('district_id').notNull(),
257
+ subDistrictId: int('sub_district_id'),
258
+ townId: int('town_id')
259
+ });
260
+
261
+
262
+ export const ClothesTable = mysqlTable('clothes', {
263
+ id: int('id').autoincrement().notNull().primaryKey(),
264
+ title: varchar('title', { length: 255 }).notNull(),
265
+ catId: int('cat_id').notNull(),
266
+ condition: varchar('condition', { length: 255 }).notNull(),
267
+ price: int('price').notNull(),
268
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
269
+ exchangeable: boolean('exchangeable'),
270
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
271
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
272
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
273
+ desc: longtext('desc'),
274
+ latitude: double('latitude'),
275
+ longitude: double('longitude'),
276
+ viewCount: int('view_count'),
277
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
278
+ govId: int('gov_id').notNull(),
279
+ districtId: int('district_id').notNull(),
280
+ subDistrictId: int('sub_district_id'),
281
+ townId: int('town_id')
282
+ });
283
+
284
+
285
+ export const CatsTable = mysqlTable('cats', {
286
+ id: int('id').autoincrement().notNull().primaryKey(),
287
+ catOrder: int('cat_order').notNull(),
288
+ slug: varchar('slug', { length: 255 }).notNull(),
289
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
290
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
291
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
292
+ fullTitleEn: varchar('full_title_en', { length: 255 }),
293
+ fullTitleAr: varchar('full_title_ar', { length: 255 }),
294
+ fullTitleTr: varchar('full_title_tr', { length: 255 }),
295
+ image: varchar('image', { length: 255 }),
296
+ metaDescEn: varchar('meta_desc_en', { length: 255 }),
297
+ metaDescAr: varchar('meta_desc_ar', { length: 255 }),
298
+ metaDescTr: varchar('meta_desc_tr', { length: 255 }),
299
+ filters: varchar('filters', { length: 255 }),
300
+ tableName: varchar('table_name', { length: 255 }).notNull(),
301
+ adCount: int('ad_count'),
302
+ parentId: int('parent_id'),
303
+ level: int('level')
304
+ });
305
+
306
+
307
+ export const CarsTable = mysqlTable('cars', {
308
+ id: int('id').autoincrement().notNull().primaryKey(),
309
+ modelYear: int('model_year').notNull(),
310
+ model: varchar('model', { length: 255 }).notNull(),
311
+ title: varchar('title', { length: 255 }).notNull(),
312
+ catId: int('cat_id').notNull(),
313
+ govId: int('gov_id').notNull(),
314
+ districtId: int('district_id').notNull(),
315
+ subDistrictId: int('sub_district_id'),
316
+ townId: int('town_id'),
317
+ price: int('price').notNull(),
318
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
319
+ condition: varchar('condition', { length: 255 }).notNull(),
320
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
321
+ engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
322
+ enginePower: varchar('engine_power', { length: 255 }).notNull(),
323
+ tractionType: varchar('traction_type', { length: 255 }).notNull(),
324
+ bodyType: varchar('body_type', { length: 255 }).notNull(),
325
+ gearType: varchar('gear_type', { length: 255 }).notNull(),
326
+ fuelType: varchar('fuel_type', { length: 255 }).notNull(),
327
+ exchangeable: boolean('exchangeable'),
328
+ installments: boolean('installments'),
329
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
330
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
331
+ desc: longtext('desc'),
332
+ latitude: double('latitude'),
333
+ longitude: double('longitude'),
334
+ viewCount: int('view_count'),
335
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
336
+ });
337
+
338
+
339
+ export const CarsDbTable = mysqlTable('cars_db', {
340
+ id: int('id').autoincrement().notNull().primaryKey(),
341
+ name: varchar('name', { length: 255 }).notNull(),
342
+ parentId: int('parent_id'),
343
+ level: int('level')
344
+ });
345
+
346
+
347
+ export const BooksTable = mysqlTable('books', {
348
+ id: int('id').autoincrement().notNull().primaryKey(),
349
+ title: varchar('title', { length: 255 }).notNull(),
350
+ catId: int('cat_id').notNull(),
351
+ condition: varchar('condition', { length: 255 }).notNull(),
352
+ price: int('price').notNull(),
353
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
354
+ exchangeable: boolean('exchangeable'),
355
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
356
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
357
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
358
+ desc: longtext('desc'),
359
+ latitude: double('latitude'),
360
+ longitude: double('longitude'),
361
+ viewCount: int('view_count'),
362
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
363
+ govId: int('gov_id').notNull(),
364
+ districtId: int('district_id').notNull(),
365
+ subDistrictId: int('sub_district_id'),
366
+ townId: int('town_id')
367
+ });
368
+
369
+
370
+ export const AddressTable = mysqlTable('address', {
371
+ id: int('id').autoincrement().notNull().primaryKey(),
372
+ catOrder: int('cat_order').notNull(),
373
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
374
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
375
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
376
+ image: varchar('image', { length: 255 }),
377
+ path: varchar('path', { length: 255 }),
378
+ parentId: int('parent_id'),
379
+ level: int('level')
380
+ });
381
+
@@ -14,8 +14,8 @@
14
14
  "db:gen": "drizzle-kit generate",
15
15
  "db:push": "drizzle-kit push --config=db/drizzle.config.ts",
16
16
  "db:mig": "tsx db/migrate.ts",
17
- "next-cms-kit": "tsx --env-file=.env cli.ts",
18
- "next-cms-kit:dev": "tsx --env-file=.env.development cli.ts --dev"
17
+ "next-cms-kit": "node --env-file=.env ./lib/cli.mjs",
18
+ "next-cms-kit:dev": "node --env-file=.env.development ./lib/cli.mjs --dev"
19
19
  },
20
20
  "dependencies": {
21
21
  "@dnd-kit/core": "^6.3.1",
@@ -70,7 +70,7 @@
70
70
  "nanoid": "^5.1.2",
71
71
  "next": "^15.5.5",
72
72
  "next-themes": "^0.4.6",
73
- "nextjs-cms": "0.5.28",
73
+ "nextjs-cms": "0.5.30",
74
74
  "plaiceholder": "^3.0.0",
75
75
  "prettier-plugin-tailwindcss": "^0.7.2",
76
76
  "qrcode": "^1.5.4",
@@ -103,7 +103,7 @@
103
103
  "eslint-config-prettier": "^10.0.1",
104
104
  "eslint-plugin-prettier": "^5.2.3",
105
105
  "fs-extra": "^11.3.3",
106
- "nextjs-cms-kit": "0.5.28",
106
+ "nextjs-cms-kit": "0.5.30",
107
107
  "postcss": "^8.5.1",
108
108
  "prettier": "3.5.0",
109
109
  "tailwindcss": "^4.1.18",
@@ -38,7 +38,7 @@
38
38
  "**/*.ts",
39
39
  "**/*.tsx",
40
40
  ".next/types/**/*.ts"
41
- ],
41
+ , "lib/cli.mjs", "cli.js" ],
42
42
  "exclude": [
43
43
  "node_modules"
44
44
  ]
File without changes