create-nextjs-cms 0.8.10 → 0.9.1

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 (36) hide show
  1. package/package.json +2 -2
  2. package/templates/default/app/(auth)/auth/login/LoginPage.tsx +9 -9
  3. package/templates/default/app/(auth)/auth-language-provider.tsx +34 -0
  4. package/templates/default/app/(auth)/layout.tsx +10 -10
  5. package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +4 -1
  6. package/templates/default/app/(rootLayout)/layout.tsx +5 -5
  7. package/templates/default/app/(rootLayout)/section/[section]/page.tsx +4 -1
  8. package/templates/default/app/api/auth/route.ts +2 -2
  9. package/templates/default/app/api/submit/section/item/[slug]/route.ts +32 -3
  10. package/templates/default/app/api/submit/section/simple/route.ts +32 -3
  11. package/templates/default/app/globals.css +9 -0
  12. package/templates/default/cms.config.ts +4 -4
  13. package/templates/default/components/ItemEditPage.tsx +82 -2
  14. package/templates/default/components/LocaleSwitcher.tsx +89 -0
  15. package/templates/default/components/Navbar.tsx +5 -5
  16. package/templates/default/components/NewPage.tsx +1 -0
  17. package/templates/default/components/SectionPage.tsx +81 -1
  18. package/templates/default/components/form/ContentLocaleContext.tsx +11 -0
  19. package/templates/default/components/form/Form.tsx +48 -5
  20. package/templates/default/components/form/FormInputs.tsx +16 -7
  21. package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
  22. package/templates/default/components/form/inputs/NumberFormInput.tsx +2 -1
  23. package/templates/default/components/form/inputs/PhotoFormInput.tsx +168 -112
  24. package/templates/default/components/form/inputs/RichTextFormInput.tsx +3 -0
  25. package/templates/default/components/form/inputs/SelectFormInput.tsx +1 -1
  26. package/templates/default/components/form/inputs/TagsFormInput.tsx +6 -2
  27. package/templates/default/components/form/inputs/TextFormInput.tsx +3 -0
  28. package/templates/default/components/form/inputs/TextareaFormInput.tsx +3 -0
  29. package/templates/default/components/{locale-dropdown.tsx → language-dropdown.tsx} +74 -74
  30. package/templates/default/components/{locale-picker.tsx → language-picker.tsx} +85 -85
  31. package/templates/default/components/login-language-dropdown.tsx +46 -0
  32. package/templates/default/components/ui/alert.tsx +2 -1
  33. package/templates/default/dynamic-schemas/schema.ts +475 -448
  34. package/templates/default/package.json +1 -1
  35. package/templates/default/app/(auth)/auth-locale-provider.tsx +0 -34
  36. package/templates/default/components/login-locale-dropdown.tsx +0 -46
@@ -1,448 +1,475 @@
1
- import {mysqlTable,int,longtext,mysqlEnum,varchar,index,unique,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
- title: varchar('title', { length: 255 }).notNull(),
23
- slug: varchar('slug', { length: 255 }).notNull()
24
- }, (table) => [
25
- index('unique_user_report_index').on(table.contentType, table.contentId, table.catId, table.appId),
26
- unique('unique_user_report').on(table.contentType, table.contentId, table.catId, table.appId),
27
- unique('slug_unique').on(table.slug)
28
- ]);
29
-
30
-
31
- export const TestSectionTable = mysqlTable('test_section', {
32
- id: int('id').autoincrement().notNull().primaryKey(),
33
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
34
- price: int('price'),
35
- appId: varchar('app_id', { length: 36 }).notNull(),
36
- title: varchar('title', { length: 255 }).notNull()
37
- }, (table) => [
38
- index('unique_user_report_index').on(table.contentType, table.price, table.appId),
39
- unique('unique_user_report').on(table.contentType, table.price, table.appId),
40
- unique('price_unique').on(table.price)
41
- ]);
42
-
43
-
44
- export const FeaturedSliderTable = mysqlTable('featured_slider', {
45
- id: int('id').autoincrement().notNull().primaryKey(),
46
- image: varchar('image', { length: 255 }).notNull(),
47
- titleEn: varchar('title_en', { length: 255 }).notNull(),
48
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
49
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
50
- descEn: longtext('desc_en').notNull(),
51
- descAr: longtext('desc_ar').notNull(),
52
- descTr: longtext('desc_tr').notNull()
53
- }, (table) => [
54
- unique('title_en_unique').on(table.titleEn),
55
- unique('title_ar_unique').on(table.titleAr),
56
- unique('title_tr_unique').on(table.titleTr)
57
- ]);
58
-
59
-
60
- export const MenuSettingsTable = mysqlTable('menu_settings', {
61
- id: int('id').autoincrement().notNull().primaryKey(),
62
- taxRate: varchar('tax_rate', { length: 255 }),
63
- hideSlider: boolean('hide_slider')
64
- });
65
-
66
-
67
- export const ServicesTable = mysqlTable('services', {
68
- id: int('id').autoincrement().notNull().primaryKey(),
69
- title: varchar('title', { length: 255 }).notNull(),
70
- catId: int('cat_id').notNull(),
71
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
72
- price: int('price'),
73
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
74
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
75
- desc: longtext('desc'),
76
- latitude: double('latitude'),
77
- longitude: double('longitude'),
78
- viewCount: int('view_count'),
79
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
80
- govId: int('gov_id').notNull(),
81
- districtId: int('district_id').notNull(),
82
- subDistrictId: int('sub_district_id'),
83
- townId: int('town_id')
84
- }, (table) => [
85
- index('title_index').on(table.title),
86
- unique('title_unique').on(table.title)
87
- ]);
88
-
89
-
90
- export const RealestateTable = mysqlTable('realestate', {
91
- id: int('id').autoincrement().notNull().primaryKey(),
92
- catId: int('cat_id').notNull(),
93
- title: varchar('title', { length: 255 }).notNull(),
94
- price: int('price').notNull(),
95
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
96
- spaceGross: int('space_gross').notNull(),
97
- spaceNet: int('space_net').notNull(),
98
- latitude: double('latitude').notNull(),
99
- longitude: double('longitude').notNull(),
100
- roomCount: varchar('room_count', { length: 255 }),
101
- buildingAge: varchar('building_age', { length: 255 }),
102
- floorCount: varchar('floor_count', { length: 255 }),
103
- bathroomCount: varchar('bathroom_count', { length: 255 }),
104
- floorLocation: varchar('floor_location', { length: 255 }),
105
- heatingType: varchar('heating_type', { length: 255 }),
106
- kitchenType: varchar('kitchen_type', { length: 255 }),
107
- balcony: boolean('balcony'),
108
- lift: boolean('lift'),
109
- parkingType: varchar('parking_type', { length: 255 }),
110
- furnished: boolean('furnished'),
111
- belongsToSite: boolean('belongs_to_site'),
112
- siteName: varchar('site_name', { length: 255 }),
113
- installments: boolean('installments'),
114
- exchangeable: boolean('exchangeable'),
115
- fromWhom: varchar('from_whom', { length: 255 }),
116
- buildingMembershipFees: int('building_membership_fees'),
117
- deposit: int('deposit'),
118
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
119
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
120
- desc: longtext('desc'),
121
- viewCount: int('view_count'),
122
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
123
- govId: int('gov_id').notNull(),
124
- districtId: int('district_id').notNull(),
125
- subDistrictId: int('sub_district_id'),
126
- townId: int('town_id')
127
- }, (table) => [
128
- index('title_index').on(table.title),
129
- unique('title_unique').on(table.title)
130
- ]);
131
-
132
-
133
- export const HomepageSliderTable = mysqlTable('homepage_slider', {
134
- id: int('id').autoincrement().notNull().primaryKey(),
135
- titleEn: varchar('title_en', { length: 255 }).notNull(),
136
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
137
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
138
- subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
139
- subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
140
- subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
141
- photo: varchar('photo', { length: 255 }).notNull(),
142
- buttonUrl: varchar('button_url', { length: 255 }),
143
- buttonTextEn: varchar('button_text_en', { length: 255 }),
144
- buttonTextAr: varchar('button_text_ar', { length: 255 }),
145
- buttonTextTr: varchar('button_text_tr', { length: 255 }),
146
- buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
147
- });
148
-
149
-
150
- export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
151
- id: int('id').autoincrement().notNull().primaryKey(),
152
- userId: int('user_id').notNull(),
153
- contestId: varchar('contest_id', { length: 255 }).notNull()
154
- }, (table) => [
155
- unique('contest_subscriber_unique').on(table.contestId, table.userId)
156
- ]);
157
-
158
-
159
- export const ContestsTable = mysqlTable('contests', {
160
- id: int('id').autoincrement().notNull().primaryKey(),
161
- date: timestamp('date').notNull(),
162
- prize: varchar('prize', { length: 255 }).notNull(),
163
- winnerId: int('winner_id'),
164
- tags: varchar('tags', { length: 255 })
165
- });
166
-
167
-
168
- export const NotificationsTable = mysqlTable('notifications', {
169
- id: int('id').autoincrement().notNull().primaryKey(),
170
- 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(),
171
- contentId: int('content_id'),
172
- contentCatId: int('content_cat_id'),
173
- userId: int('user_id'),
174
- message: varchar('message', { length: 255 })
175
- }, (table) => [
176
- index('type_index').on(table.type),
177
- unique('unique_notification').on(table.type, table.contentId, table.contentCatId)
178
- ]);
179
-
180
-
181
- export const ModerationTable = mysqlTable('moderation', {
182
- id: int('id').autoincrement().notNull().primaryKey(),
183
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
184
- contentId: int('content_id').notNull(),
185
- catId: int('cat_id'),
186
- userId: int('user_id').notNull(),
187
- flagged: int('flagged').notNull(),
188
- result: varchar('result', { length: 255 }).notNull()
189
- }, (table) => [
190
- index('unique_user_report_index').on(table.contentType, table.contentId, table.catId, table.userId),
191
- unique('unique_user_report').on(table.contentType, table.contentId, table.catId, table.userId)
192
- ]);
193
-
194
-
195
- export const JobsTable = mysqlTable('jobs', {
196
- id: int('id').autoincrement().notNull().primaryKey(),
197
- title: varchar('title', { length: 255 }).notNull(),
198
- catId: int('cat_id').notNull(),
199
- salary: int('salary'),
200
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
201
- workMethod: varchar('work_method', { length: 255 }).notNull(),
202
- minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
203
- experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
204
- remote: boolean('remote'),
205
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
206
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
207
- desc: longtext('desc'),
208
- latitude: double('latitude'),
209
- longitude: double('longitude'),
210
- viewCount: int('view_count'),
211
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
212
- govId: int('gov_id').notNull(),
213
- districtId: int('district_id').notNull(),
214
- subDistrictId: int('sub_district_id'),
215
- townId: int('town_id')
216
- }, (table) => [
217
- index('title_index').on(table.title),
218
- unique('title_unique').on(table.title)
219
- ]);
220
-
221
-
222
- export const FurnitureTable = mysqlTable('furniture', {
223
- id: int('id').autoincrement().notNull().primaryKey(),
224
- title: varchar('title', { length: 255 }).notNull(),
225
- catId: int('cat_id').notNull(),
226
- condition: varchar('condition', { length: 255 }).notNull(),
227
- price: int('price').notNull(),
228
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
229
- exchangeable: boolean('exchangeable'),
230
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
231
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
232
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
233
- desc: longtext('desc'),
234
- latitude: double('latitude'),
235
- longitude: double('longitude'),
236
- viewCount: int('view_count'),
237
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
238
- govId: int('gov_id').notNull(),
239
- districtId: int('district_id').notNull(),
240
- subDistrictId: int('sub_district_id'),
241
- townId: int('town_id')
242
- }, (table) => [
243
- index('title_index').on(table.title),
244
- unique('title_unique').on(table.title)
245
- ]);
246
-
247
-
248
- export const FiltersTable = mysqlTable('filters', {
249
- id: int('id').autoincrement().notNull().primaryKey(),
250
- title: varchar('title', { length: 255 }).notNull(),
251
- Key: varchar('_key', { length: 255 }).notNull(),
252
- fieldName: varchar('field_name', { length: 255 }).notNull(),
253
- type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
254
- tableName: varchar('table_name', { length: 255 }),
255
- isMandatory: boolean('is_mandatory')
256
- }, (table) => [
257
- unique('title_unique').on(table.title),
258
- unique('key_unique').on(table.Key)
259
- ]);
260
-
261
-
262
- export const FaqTable = mysqlTable('faq', {
263
- id: int('id').autoincrement().notNull().primaryKey(),
264
- qEn: varchar('q_en', { length: 255 }).notNull(),
265
- qAr: varchar('q_ar', { length: 255 }).notNull(),
266
- qTr: varchar('q_tr', { length: 255 }),
267
- aEn: longtext('a_en').notNull(),
268
- aAr: longtext('a_ar'),
269
- aTr: longtext('a_tr')
270
- }, (table) => [
271
- unique('faq_q_en_unique').on(table.qEn),
272
- unique('title_ar_unique').on(table.qAr),
273
- unique('title_tr_unique').on(table.qTr)
274
- ]);
275
-
276
-
277
- export const ErrorsTable = mysqlTable('errors', {
278
- id: int('id').autoincrement().notNull().primaryKey(),
279
- title: varchar('title', { length: 255 }).notNull(),
280
- caseId: varchar('case_id', { length: 255 }).notNull(),
281
- userId: int('user_id'),
282
- itemSlug: varchar('item_slug', { length: 255 }),
283
- desc: longtext('desc'),
284
- isResolved: boolean('is_resolved')
285
- }, (table) => [
286
- unique('key_unique').on(table.caseId)
287
- ]);
288
-
289
-
290
- export const ElectronicsTable = mysqlTable('electronics', {
291
- id: int('id').autoincrement().notNull().primaryKey(),
292
- title: varchar('title', { length: 255 }).notNull(),
293
- catId: int('cat_id').notNull(),
294
- condition: varchar('condition', { length: 255 }).notNull(),
295
- price: int('price').notNull(),
296
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
297
- exchangeable: boolean('exchangeable'),
298
- installments: boolean('installments'),
299
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
300
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
301
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
302
- desc: longtext('desc'),
303
- latitude: double('latitude'),
304
- longitude: double('longitude'),
305
- viewCount: int('view_count'),
306
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
307
- govId: int('gov_id').notNull(),
308
- districtId: int('district_id').notNull(),
309
- subDistrictId: int('sub_district_id'),
310
- townId: int('town_id')
311
- }, (table) => [
312
- index('title_index').on(table.title),
313
- unique('title_unique').on(table.title)
314
- ]);
315
-
316
-
317
- export const ClothesTable = mysqlTable('clothes', {
318
- id: int('id').autoincrement().notNull().primaryKey(),
319
- title: varchar('title', { length: 255 }).notNull(),
320
- catId: int('cat_id').notNull(),
321
- condition: varchar('condition', { length: 255 }).notNull(),
322
- price: int('price').notNull(),
323
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
324
- exchangeable: boolean('exchangeable'),
325
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
326
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
327
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
328
- desc: longtext('desc'),
329
- latitude: double('latitude'),
330
- longitude: double('longitude'),
331
- viewCount: int('view_count'),
332
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
333
- govId: int('gov_id').notNull(),
334
- districtId: int('district_id').notNull(),
335
- subDistrictId: int('sub_district_id'),
336
- townId: int('town_id')
337
- }, (table) => [
338
- index('title_index').on(table.title),
339
- unique('title_unique').on(table.title)
340
- ]);
341
-
342
-
343
- export const CatsTable = mysqlTable('cats', {
344
- id: int('id').autoincrement().notNull().primaryKey(),
345
- catOrder: int('cat_order').notNull(),
346
- slug: varchar('slug', { length: 255 }).notNull(),
347
- titleEn: varchar('title_en', { length: 255 }).notNull(),
348
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
349
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
350
- fullTitleEn: varchar('full_title_en', { length: 255 }),
351
- fullTitleAr: varchar('full_title_ar', { length: 255 }),
352
- fullTitleTr: varchar('full_title_tr', { length: 255 }),
353
- image: varchar('image', { length: 255 }),
354
- metaDescEn: varchar('meta_desc_en', { length: 255 }),
355
- metaDescAr: varchar('meta_desc_ar', { length: 255 }),
356
- metaDescTr: varchar('meta_desc_tr', { length: 255 }),
357
- filters: varchar('filters', { length: 255 }),
358
- tableName: varchar('table_name', { length: 255 }).notNull(),
359
- adCount: int('ad_count'),
360
- parentId: int('parent_id'),
361
- level: int('level')
362
- }, (table) => [
363
- unique('cats_slug_unique').on(table.slug)
364
- ]);
365
-
366
-
367
- export const CarsTable = mysqlTable('cars', {
368
- id: int('id').autoincrement().notNull().primaryKey(),
369
- modelYear: int('model_year').notNull(),
370
- model: varchar('model', { length: 255 }).notNull(),
371
- title: varchar('title', { length: 255 }).notNull(),
372
- catId: int('cat_id').notNull(),
373
- govId: int('gov_id').notNull(),
374
- districtId: int('district_id').notNull(),
375
- subDistrictId: int('sub_district_id'),
376
- townId: int('town_id'),
377
- price: int('price').notNull(),
378
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
379
- condition: varchar('condition', { length: 255 }).notNull(),
380
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
381
- engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
382
- enginePower: varchar('engine_power', { length: 255 }).notNull(),
383
- tractionType: varchar('traction_type', { length: 255 }).notNull(),
384
- bodyType: varchar('body_type', { length: 255 }).notNull(),
385
- gearType: varchar('gear_type', { length: 255 }).notNull(),
386
- fuelType: varchar('fuel_type', { length: 255 }).notNull(),
387
- exchangeable: boolean('exchangeable'),
388
- installments: boolean('installments'),
389
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
390
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
391
- desc: longtext('desc'),
392
- latitude: double('latitude'),
393
- longitude: double('longitude'),
394
- viewCount: int('view_count'),
395
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
396
- }, (table) => [
397
- index('title_index').on(table.title)
398
- ]);
399
-
400
-
401
- export const CarsDbTable = mysqlTable('cars_db', {
402
- id: int('id').autoincrement().notNull().primaryKey(),
403
- name: varchar('name', { length: 255 }).notNull(),
404
- parentId: int('parent_id'),
405
- level: int('level')
406
- }, (table) => [
407
- index('cars_db_name_idx').on(table.name)
408
- ]);
409
-
410
-
411
- export const BooksTable = mysqlTable('books', {
412
- id: int('id').autoincrement().notNull().primaryKey(),
413
- title: varchar('title', { length: 255 }).notNull(),
414
- catId: int('cat_id').notNull(),
415
- condition: varchar('condition', { length: 255 }).notNull(),
416
- price: int('price').notNull(),
417
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
418
- exchangeable: boolean('exchangeable'),
419
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
420
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
421
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
422
- desc: longtext('desc'),
423
- latitude: double('latitude'),
424
- longitude: double('longitude'),
425
- viewCount: int('view_count'),
426
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
427
- govId: int('gov_id').notNull(),
428
- districtId: int('district_id').notNull(),
429
- subDistrictId: int('sub_district_id'),
430
- townId: int('town_id')
431
- }, (table) => [
432
- index('title_index').on(table.title),
433
- unique('title_unique').on(table.title)
434
- ]);
435
-
436
-
437
- export const AddressTable = mysqlTable('address', {
438
- id: int('id').autoincrement().notNull().primaryKey(),
439
- catOrder: int('cat_order').notNull(),
440
- titleEn: varchar('title_en', { length: 255 }).notNull(),
441
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
442
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
443
- image: varchar('image', { length: 255 }),
444
- path: varchar('path', { length: 255 }),
445
- parentId: int('parent_id'),
446
- level: int('level')
447
- });
448
-
1
+ import {mysqlTable,int,longtext,mysqlEnum,varchar,index,unique,primaryKey,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
+ title: varchar('title', { length: 255 }).notNull(),
23
+ slug: varchar('slug', { length: 255 }).notNull()
24
+ }, (table) => [
25
+ index('unique_user_report_index').on(table.contentType, table.contentId, table.catId, table.appId),
26
+ unique('unique_user_report').on(table.contentType, table.contentId, table.catId, table.appId),
27
+ unique('slug_unique').on(table.slug)
28
+ ]);
29
+
30
+
31
+ export const TestSectionTable = mysqlTable('test_section', {
32
+ id: int('id').autoincrement().notNull().primaryKey(),
33
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
34
+ price: int('price'),
35
+ appId: varchar('app_id', { length: 36 }).notNull(),
36
+ title: varchar('title', { length: 255 }).notNull(),
37
+ photo: varchar('photo', { length: 255 }),
38
+ category: varchar('category', { length: 255 }),
39
+ file: varchar('file', { length: 255 }).notNull()
40
+ }, (table) => [
41
+ index('unique_user_report_index').on(table.contentType, table.price, table.appId),
42
+ unique('unique_user_report').on(table.contentType, table.price, table.appId),
43
+ unique('price_unique').on(table.price)
44
+ ]);
45
+
46
+
47
+ export const TestTagsTable = mysqlTable('test_tags', {
48
+ testId: varchar('test_id', { length: 255 }).notNull(),
49
+ tagName: varchar('tag_name', { length: 255 }).notNull(),
50
+ locale: varchar('locale', { length: 255 })
51
+ }, (table) => [
52
+ primaryKey({ columns: [table.testId, table.tagName, table.locale] })
53
+ ]);
54
+
55
+
56
+ export const TestSectionLocalesTable = mysqlTable('test_section_locales', {
57
+ id: int('id').autoincrement().notNull().primaryKey(),
58
+ parentId: int('parent_id').notNull(),
59
+ locale: varchar('locale', { length: 10 }).notNull(),
60
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
61
+ price: int('price'),
62
+ appId: varchar('app_id', { length: 36 }).notNull(),
63
+ title: varchar('title', { length: 255 }).notNull(),
64
+ photo: varchar('photo', { length: 255 }),
65
+ category: varchar('category', { length: 255 })
66
+ }, (table) => [
67
+ unique('test_section_locales_parent_id_locale_unique').on(table.parentId, table.locale)
68
+ ]);
69
+
70
+
71
+ export const FeaturedSliderTable = mysqlTable('featured_slider', {
72
+ id: int('id').autoincrement().notNull().primaryKey(),
73
+ image: varchar('image', { length: 255 }).notNull(),
74
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
75
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
76
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
77
+ descEn: longtext('desc_en').notNull(),
78
+ descAr: longtext('desc_ar').notNull(),
79
+ descTr: longtext('desc_tr').notNull()
80
+ }, (table) => [
81
+ unique('title_en_unique').on(table.titleEn),
82
+ unique('title_ar_unique').on(table.titleAr),
83
+ unique('title_tr_unique').on(table.titleTr)
84
+ ]);
85
+
86
+
87
+ export const MenuSettingsTable = mysqlTable('menu_settings', {
88
+ id: int('id').autoincrement().notNull().primaryKey(),
89
+ taxRate: varchar('tax_rate', { length: 255 }),
90
+ hideSlider: boolean('hide_slider')
91
+ });
92
+
93
+
94
+ export const ServicesTable = mysqlTable('services', {
95
+ id: int('id').autoincrement().notNull().primaryKey(),
96
+ title: varchar('title', { length: 255 }).notNull(),
97
+ catId: int('cat_id').notNull(),
98
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
99
+ price: int('price'),
100
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
101
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
102
+ desc: longtext('desc'),
103
+ latitude: double('latitude'),
104
+ longitude: double('longitude'),
105
+ viewCount: int('view_count'),
106
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
107
+ govId: int('gov_id').notNull(),
108
+ districtId: int('district_id').notNull(),
109
+ subDistrictId: int('sub_district_id'),
110
+ townId: int('town_id')
111
+ }, (table) => [
112
+ index('title_index').on(table.title),
113
+ unique('title_unique').on(table.title)
114
+ ]);
115
+
116
+
117
+ export const RealestateTable = mysqlTable('realestate', {
118
+ id: int('id').autoincrement().notNull().primaryKey(),
119
+ catId: int('cat_id').notNull(),
120
+ title: varchar('title', { length: 255 }).notNull(),
121
+ price: int('price').notNull(),
122
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
123
+ spaceGross: int('space_gross').notNull(),
124
+ spaceNet: int('space_net').notNull(),
125
+ latitude: double('latitude').notNull(),
126
+ longitude: double('longitude').notNull(),
127
+ roomCount: varchar('room_count', { length: 255 }),
128
+ buildingAge: varchar('building_age', { length: 255 }),
129
+ floorCount: varchar('floor_count', { length: 255 }),
130
+ bathroomCount: varchar('bathroom_count', { length: 255 }),
131
+ floorLocation: varchar('floor_location', { length: 255 }),
132
+ heatingType: varchar('heating_type', { length: 255 }),
133
+ kitchenType: varchar('kitchen_type', { length: 255 }),
134
+ balcony: boolean('balcony'),
135
+ lift: boolean('lift'),
136
+ parkingType: varchar('parking_type', { length: 255 }),
137
+ furnished: boolean('furnished'),
138
+ belongsToSite: boolean('belongs_to_site'),
139
+ siteName: varchar('site_name', { length: 255 }),
140
+ installments: boolean('installments'),
141
+ exchangeable: boolean('exchangeable'),
142
+ fromWhom: varchar('from_whom', { length: 255 }),
143
+ buildingMembershipFees: int('building_membership_fees'),
144
+ deposit: int('deposit'),
145
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
146
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
147
+ desc: longtext('desc'),
148
+ viewCount: int('view_count'),
149
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
150
+ govId: int('gov_id').notNull(),
151
+ districtId: int('district_id').notNull(),
152
+ subDistrictId: int('sub_district_id'),
153
+ townId: int('town_id')
154
+ }, (table) => [
155
+ index('title_index').on(table.title),
156
+ unique('title_unique').on(table.title)
157
+ ]);
158
+
159
+
160
+ export const HomepageSliderTable = mysqlTable('homepage_slider', {
161
+ id: int('id').autoincrement().notNull().primaryKey(),
162
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
163
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
164
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
165
+ subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
166
+ subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
167
+ subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
168
+ photo: varchar('photo', { length: 255 }).notNull(),
169
+ buttonUrl: varchar('button_url', { length: 255 }),
170
+ buttonTextEn: varchar('button_text_en', { length: 255 }),
171
+ buttonTextAr: varchar('button_text_ar', { length: 255 }),
172
+ buttonTextTr: varchar('button_text_tr', { length: 255 }),
173
+ buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
174
+ });
175
+
176
+
177
+ export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
178
+ id: int('id').autoincrement().notNull().primaryKey(),
179
+ userId: int('user_id').notNull(),
180
+ contestId: varchar('contest_id', { length: 255 }).notNull()
181
+ }, (table) => [
182
+ unique('contest_subscriber_unique').on(table.contestId, table.userId)
183
+ ]);
184
+
185
+
186
+ export const ContestsTable = mysqlTable('contests', {
187
+ id: int('id').autoincrement().notNull().primaryKey(),
188
+ date: timestamp('date').notNull(),
189
+ prize: varchar('prize', { length: 255 }).notNull(),
190
+ winnerId: int('winner_id'),
191
+ tags: varchar('tags', { length: 255 })
192
+ });
193
+
194
+
195
+ export const NotificationsTable = mysqlTable('notifications', {
196
+ id: int('id').autoincrement().notNull().primaryKey(),
197
+ 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(),
198
+ contentId: int('content_id'),
199
+ contentCatId: int('content_cat_id'),
200
+ userId: int('user_id'),
201
+ message: varchar('message', { length: 255 })
202
+ }, (table) => [
203
+ index('type_index').on(table.type),
204
+ unique('unique_notification').on(table.type, table.contentId, table.contentCatId)
205
+ ]);
206
+
207
+
208
+ export const ModerationTable = mysqlTable('moderation', {
209
+ id: int('id').autoincrement().notNull().primaryKey(),
210
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
211
+ contentId: int('content_id').notNull(),
212
+ catId: int('cat_id'),
213
+ userId: int('user_id').notNull(),
214
+ flagged: int('flagged').notNull(),
215
+ result: varchar('result', { length: 255 }).notNull()
216
+ }, (table) => [
217
+ index('unique_user_report_index').on(table.contentType, table.contentId, table.catId, table.userId),
218
+ unique('unique_user_report').on(table.contentType, table.contentId, table.catId, table.userId)
219
+ ]);
220
+
221
+
222
+ export const JobsTable = mysqlTable('jobs', {
223
+ id: int('id').autoincrement().notNull().primaryKey(),
224
+ title: varchar('title', { length: 255 }).notNull(),
225
+ catId: int('cat_id').notNull(),
226
+ salary: int('salary'),
227
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
228
+ workMethod: varchar('work_method', { length: 255 }).notNull(),
229
+ minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
230
+ experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
231
+ remote: boolean('remote'),
232
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
233
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
234
+ desc: longtext('desc'),
235
+ latitude: double('latitude'),
236
+ longitude: double('longitude'),
237
+ viewCount: int('view_count'),
238
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
239
+ govId: int('gov_id').notNull(),
240
+ districtId: int('district_id').notNull(),
241
+ subDistrictId: int('sub_district_id'),
242
+ townId: int('town_id')
243
+ }, (table) => [
244
+ index('title_index').on(table.title),
245
+ unique('title_unique').on(table.title)
246
+ ]);
247
+
248
+
249
+ export const FurnitureTable = mysqlTable('furniture', {
250
+ id: int('id').autoincrement().notNull().primaryKey(),
251
+ title: varchar('title', { length: 255 }).notNull(),
252
+ catId: int('cat_id').notNull(),
253
+ condition: varchar('condition', { length: 255 }).notNull(),
254
+ price: int('price').notNull(),
255
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
256
+ exchangeable: boolean('exchangeable'),
257
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
258
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
259
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
260
+ desc: longtext('desc'),
261
+ latitude: double('latitude'),
262
+ longitude: double('longitude'),
263
+ viewCount: int('view_count'),
264
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
265
+ govId: int('gov_id').notNull(),
266
+ districtId: int('district_id').notNull(),
267
+ subDistrictId: int('sub_district_id'),
268
+ townId: int('town_id')
269
+ }, (table) => [
270
+ index('title_index').on(table.title),
271
+ unique('title_unique').on(table.title)
272
+ ]);
273
+
274
+
275
+ export const FiltersTable = mysqlTable('filters', {
276
+ id: int('id').autoincrement().notNull().primaryKey(),
277
+ title: varchar('title', { length: 255 }).notNull(),
278
+ Key: varchar('_key', { length: 255 }).notNull(),
279
+ fieldName: varchar('field_name', { length: 255 }).notNull(),
280
+ type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
281
+ tableName: varchar('table_name', { length: 255 }),
282
+ isMandatory: boolean('is_mandatory')
283
+ }, (table) => [
284
+ unique('title_unique').on(table.title),
285
+ unique('key_unique').on(table.Key)
286
+ ]);
287
+
288
+
289
+ export const FaqTable = mysqlTable('faq', {
290
+ id: int('id').autoincrement().notNull().primaryKey(),
291
+ qEn: varchar('q_en', { length: 255 }).notNull(),
292
+ qAr: varchar('q_ar', { length: 255 }).notNull(),
293
+ qTr: varchar('q_tr', { length: 255 }),
294
+ aEn: longtext('a_en').notNull(),
295
+ aAr: longtext('a_ar'),
296
+ aTr: longtext('a_tr')
297
+ }, (table) => [
298
+ unique('faq_q_en_unique').on(table.qEn),
299
+ unique('title_ar_unique').on(table.qAr),
300
+ unique('title_tr_unique').on(table.qTr)
301
+ ]);
302
+
303
+
304
+ export const ErrorsTable = mysqlTable('errors', {
305
+ id: int('id').autoincrement().notNull().primaryKey(),
306
+ title: varchar('title', { length: 255 }).notNull(),
307
+ caseId: varchar('case_id', { length: 255 }).notNull(),
308
+ userId: int('user_id'),
309
+ itemSlug: varchar('item_slug', { length: 255 }),
310
+ desc: longtext('desc'),
311
+ isResolved: boolean('is_resolved')
312
+ }, (table) => [
313
+ unique('key_unique').on(table.caseId)
314
+ ]);
315
+
316
+
317
+ export const ElectronicsTable = mysqlTable('electronics', {
318
+ id: int('id').autoincrement().notNull().primaryKey(),
319
+ title: varchar('title', { length: 255 }).notNull(),
320
+ catId: int('cat_id').notNull(),
321
+ condition: varchar('condition', { length: 255 }).notNull(),
322
+ price: int('price').notNull(),
323
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
324
+ exchangeable: boolean('exchangeable'),
325
+ installments: boolean('installments'),
326
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
327
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
328
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
329
+ desc: longtext('desc'),
330
+ latitude: double('latitude'),
331
+ longitude: double('longitude'),
332
+ viewCount: int('view_count'),
333
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
334
+ govId: int('gov_id').notNull(),
335
+ districtId: int('district_id').notNull(),
336
+ subDistrictId: int('sub_district_id'),
337
+ townId: int('town_id')
338
+ }, (table) => [
339
+ index('title_index').on(table.title),
340
+ unique('title_unique').on(table.title)
341
+ ]);
342
+
343
+
344
+ export const ClothesTable = mysqlTable('clothes', {
345
+ id: int('id').autoincrement().notNull().primaryKey(),
346
+ title: varchar('title', { length: 255 }).notNull(),
347
+ catId: int('cat_id').notNull(),
348
+ condition: varchar('condition', { length: 255 }).notNull(),
349
+ price: int('price').notNull(),
350
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
351
+ exchangeable: boolean('exchangeable'),
352
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
353
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
354
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
355
+ desc: longtext('desc'),
356
+ latitude: double('latitude'),
357
+ longitude: double('longitude'),
358
+ viewCount: int('view_count'),
359
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
360
+ govId: int('gov_id').notNull(),
361
+ districtId: int('district_id').notNull(),
362
+ subDistrictId: int('sub_district_id'),
363
+ townId: int('town_id')
364
+ }, (table) => [
365
+ index('title_index').on(table.title),
366
+ unique('title_unique').on(table.title)
367
+ ]);
368
+
369
+
370
+ export const CatsTable = mysqlTable('cats', {
371
+ id: int('id').autoincrement().notNull().primaryKey(),
372
+ catOrder: int('cat_order').notNull(),
373
+ slug: varchar('slug', { length: 255 }).notNull(),
374
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
375
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
376
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
377
+ fullTitleEn: varchar('full_title_en', { length: 255 }),
378
+ fullTitleAr: varchar('full_title_ar', { length: 255 }),
379
+ fullTitleTr: varchar('full_title_tr', { length: 255 }),
380
+ image: varchar('image', { length: 255 }),
381
+ metaDescEn: varchar('meta_desc_en', { length: 255 }),
382
+ metaDescAr: varchar('meta_desc_ar', { length: 255 }),
383
+ metaDescTr: varchar('meta_desc_tr', { length: 255 }),
384
+ filters: varchar('filters', { length: 255 }),
385
+ tableName: varchar('table_name', { length: 255 }).notNull(),
386
+ adCount: int('ad_count'),
387
+ parentId: int('parent_id'),
388
+ level: int('level')
389
+ }, (table) => [
390
+ unique('cats_slug_unique').on(table.slug)
391
+ ]);
392
+
393
+
394
+ export const CarsTable = mysqlTable('cars', {
395
+ id: int('id').autoincrement().notNull().primaryKey(),
396
+ modelYear: int('model_year').notNull(),
397
+ model: varchar('model', { length: 255 }).notNull(),
398
+ title: varchar('title', { length: 255 }).notNull(),
399
+ catId: int('cat_id').notNull(),
400
+ govId: int('gov_id').notNull(),
401
+ districtId: int('district_id').notNull(),
402
+ subDistrictId: int('sub_district_id'),
403
+ townId: int('town_id'),
404
+ price: int('price').notNull(),
405
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
406
+ condition: varchar('condition', { length: 255 }).notNull(),
407
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
408
+ engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
409
+ enginePower: varchar('engine_power', { length: 255 }).notNull(),
410
+ tractionType: varchar('traction_type', { length: 255 }).notNull(),
411
+ bodyType: varchar('body_type', { length: 255 }).notNull(),
412
+ gearType: varchar('gear_type', { length: 255 }).notNull(),
413
+ fuelType: varchar('fuel_type', { length: 255 }).notNull(),
414
+ exchangeable: boolean('exchangeable'),
415
+ installments: boolean('installments'),
416
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
417
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
418
+ desc: longtext('desc'),
419
+ latitude: double('latitude'),
420
+ longitude: double('longitude'),
421
+ viewCount: int('view_count'),
422
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
423
+ }, (table) => [
424
+ index('title_index').on(table.title)
425
+ ]);
426
+
427
+
428
+ export const CarsDbTable = mysqlTable('cars_db', {
429
+ id: int('id').autoincrement().notNull().primaryKey(),
430
+ name: varchar('name', { length: 255 }).notNull(),
431
+ parentId: int('parent_id'),
432
+ level: int('level')
433
+ }, (table) => [
434
+ index('cars_db_name_idx').on(table.name)
435
+ ]);
436
+
437
+
438
+ export const BooksTable = mysqlTable('books', {
439
+ id: int('id').autoincrement().notNull().primaryKey(),
440
+ title: varchar('title', { length: 255 }).notNull(),
441
+ catId: int('cat_id').notNull(),
442
+ condition: varchar('condition', { length: 255 }).notNull(),
443
+ price: int('price').notNull(),
444
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
445
+ exchangeable: boolean('exchangeable'),
446
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
447
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
448
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
449
+ desc: longtext('desc'),
450
+ latitude: double('latitude'),
451
+ longitude: double('longitude'),
452
+ viewCount: int('view_count'),
453
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
454
+ govId: int('gov_id').notNull(),
455
+ districtId: int('district_id').notNull(),
456
+ subDistrictId: int('sub_district_id'),
457
+ townId: int('town_id')
458
+ }, (table) => [
459
+ index('title_index').on(table.title),
460
+ unique('title_unique').on(table.title)
461
+ ]);
462
+
463
+
464
+ export const AddressTable = mysqlTable('address', {
465
+ id: int('id').autoincrement().notNull().primaryKey(),
466
+ catOrder: int('cat_order').notNull(),
467
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
468
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
469
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
470
+ image: varchar('image', { length: 255 }),
471
+ path: varchar('path', { length: 255 }),
472
+ parentId: int('parent_id'),
473
+ level: int('level')
474
+ });
475
+