create-nextjs-cms 0.9.0 → 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 (186) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +71 -71
  3. package/dist/helpers/utils.js +16 -16
  4. package/dist/lib/section-creators.js +166 -166
  5. package/package.json +1 -1
  6. package/templates/default/.eslintrc.json +5 -5
  7. package/templates/default/.prettierignore +7 -7
  8. package/templates/default/.prettierrc.json +27 -27
  9. package/templates/default/CHANGELOG.md +140 -140
  10. package/templates/default/_gitignore +57 -57
  11. package/templates/default/app/(auth)/auth/login/LoginPage.tsx +192 -192
  12. package/templates/default/app/(auth)/auth/login/page.tsx +11 -11
  13. package/templates/default/app/(auth)/layout.tsx +81 -81
  14. package/templates/default/app/(rootLayout)/(plugins)/[...slug]/page.tsx +40 -40
  15. package/templates/default/app/(rootLayout)/(plugins)/[...slug]/plugin-server-registry.ts +16 -16
  16. package/templates/default/app/(rootLayout)/admins/page.tsx +10 -10
  17. package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +22 -22
  18. package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +15 -15
  19. package/templates/default/app/(rootLayout)/dashboard/page.tsx +63 -63
  20. package/templates/default/app/(rootLayout)/dashboard-new/page.tsx +7 -7
  21. package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +20 -20
  22. package/templates/default/app/(rootLayout)/layout.tsx +81 -81
  23. package/templates/default/app/(rootLayout)/loading.tsx +10 -10
  24. package/templates/default/app/(rootLayout)/log/page.tsx +7 -7
  25. package/templates/default/app/(rootLayout)/new/[section]/page.tsx +15 -15
  26. package/templates/default/app/(rootLayout)/section/[section]/page.tsx +19 -19
  27. package/templates/default/app/(rootLayout)/settings/page.tsx +13 -13
  28. package/templates/default/app/_trpc/client.ts +3 -3
  29. package/templates/default/app/api/auth/csrf/route.ts +25 -25
  30. package/templates/default/app/api/auth/refresh/route.ts +10 -10
  31. package/templates/default/app/api/auth/route.ts +49 -49
  32. package/templates/default/app/api/auth/session/route.ts +20 -20
  33. package/templates/default/app/api/document/route.ts +165 -165
  34. package/templates/default/app/api/editor/photo/route.ts +49 -49
  35. package/templates/default/app/api/photo/route.ts +27 -27
  36. package/templates/default/app/api/submit/section/item/[slug]/route.ts +95 -95
  37. package/templates/default/app/api/submit/section/item/route.ts +56 -56
  38. package/templates/default/app/api/submit/section/simple/route.ts +86 -86
  39. package/templates/default/app/api/trpc/[trpc]/route.ts +33 -33
  40. package/templates/default/app/api/video/route.ts +174 -174
  41. package/templates/default/app/globals.css +228 -228
  42. package/templates/default/app/providers.tsx +152 -152
  43. package/templates/default/cms.config.ts +57 -58
  44. package/templates/default/components/AdminCard.tsx +166 -166
  45. package/templates/default/components/AdminEditPage.tsx +124 -124
  46. package/templates/default/components/AdminPrivilegeCard.tsx +185 -185
  47. package/templates/default/components/AdminsPage.tsx +43 -43
  48. package/templates/default/components/AnalyticsPage.tsx +128 -128
  49. package/templates/default/components/BarChartBox.tsx +42 -42
  50. package/templates/default/components/BrowsePage.tsx +106 -106
  51. package/templates/default/components/CategorizedSectionPage.tsx +31 -31
  52. package/templates/default/components/CategoryDeleteConfirmPage.tsx +130 -130
  53. package/templates/default/components/CategorySectionSelectInput.tsx +140 -140
  54. package/templates/default/components/ConditionalFields.tsx +49 -49
  55. package/templates/default/components/ContainerBox.tsx +24 -24
  56. package/templates/default/components/DashboardNewPage.tsx +253 -253
  57. package/templates/default/components/DashboardPage.tsx +188 -188
  58. package/templates/default/components/DashboardPageAlt.tsx +45 -45
  59. package/templates/default/components/DefaultNavItems.tsx +3 -3
  60. package/templates/default/components/Dropzone.tsx +154 -154
  61. package/templates/default/components/EmailCard.tsx +138 -138
  62. package/templates/default/components/EmailPasswordForm.tsx +85 -85
  63. package/templates/default/components/EmailQuotaForm.tsx +73 -73
  64. package/templates/default/components/EmailsPage.tsx +49 -49
  65. package/templates/default/components/ErrorComponent.tsx +16 -16
  66. package/templates/default/components/GalleryPhoto.tsx +93 -93
  67. package/templates/default/components/InfoCard.tsx +93 -93
  68. package/templates/default/components/ItemEditPage.tsx +294 -294
  69. package/templates/default/components/Layout.tsx +84 -84
  70. package/templates/default/components/LoadingSpinners.tsx +67 -67
  71. package/templates/default/components/LocaleSwitcher.tsx +89 -89
  72. package/templates/default/components/LogPage.tsx +107 -107
  73. package/templates/default/components/Modal.tsx +166 -166
  74. package/templates/default/components/Navbar.tsx +258 -258
  75. package/templates/default/components/NewAdminForm.tsx +173 -173
  76. package/templates/default/components/NewEmailForm.tsx +132 -132
  77. package/templates/default/components/NewPage.tsx +206 -206
  78. package/templates/default/components/NewVariantComponent.tsx +229 -229
  79. package/templates/default/components/PhotoGallery.tsx +35 -35
  80. package/templates/default/components/PieChartBox.tsx +101 -101
  81. package/templates/default/components/ProgressBar.tsx +48 -48
  82. package/templates/default/components/ProtectedDocument.tsx +44 -44
  83. package/templates/default/components/ProtectedImage.tsx +143 -143
  84. package/templates/default/components/ProtectedVideo.tsx +76 -76
  85. package/templates/default/components/SectionIcon.tsx +8 -8
  86. package/templates/default/components/SectionItemCard.tsx +144 -144
  87. package/templates/default/components/SectionItemStatusBadge.tsx +17 -17
  88. package/templates/default/components/SectionPage.tsx +205 -205
  89. package/templates/default/components/SelectBox.tsx +98 -98
  90. package/templates/default/components/SelectInputButtons.tsx +125 -125
  91. package/templates/default/components/SettingsPage.tsx +232 -232
  92. package/templates/default/components/Sidebar.tsx +204 -204
  93. package/templates/default/components/SidebarDropdownItem.tsx +83 -83
  94. package/templates/default/components/SidebarItem.tsx +24 -24
  95. package/templates/default/components/ThemeProvider.tsx +8 -8
  96. package/templates/default/components/TooltipComponent.tsx +27 -27
  97. package/templates/default/components/VariantCard.tsx +124 -124
  98. package/templates/default/components/VariantEditPage.tsx +230 -230
  99. package/templates/default/components/analytics/BounceRate.tsx +70 -70
  100. package/templates/default/components/analytics/LivePageViews.tsx +55 -55
  101. package/templates/default/components/analytics/LiveUsersCount.tsx +33 -33
  102. package/templates/default/components/analytics/MonthlyPageViews.tsx +42 -42
  103. package/templates/default/components/analytics/TopCountries.tsx +52 -52
  104. package/templates/default/components/analytics/TopDevices.tsx +46 -46
  105. package/templates/default/components/analytics/TopMediums.tsx +58 -58
  106. package/templates/default/components/analytics/TopSources.tsx +45 -45
  107. package/templates/default/components/analytics/TotalPageViews.tsx +41 -41
  108. package/templates/default/components/analytics/TotalSessions.tsx +41 -41
  109. package/templates/default/components/analytics/TotalUniqueUsers.tsx +41 -41
  110. package/templates/default/components/custom/RightHomeRoomVariantCard.tsx +138 -138
  111. package/templates/default/components/dndKit/Draggable.tsx +21 -21
  112. package/templates/default/components/dndKit/Droppable.tsx +20 -20
  113. package/templates/default/components/dndKit/SortableItem.tsx +18 -18
  114. package/templates/default/components/form/DateRangeFormInput.tsx +57 -57
  115. package/templates/default/components/form/Form.tsx +360 -360
  116. package/templates/default/components/form/FormInputElement.tsx +70 -70
  117. package/templates/default/components/form/FormInputs.tsx +111 -111
  118. package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
  119. package/templates/default/components/form/helpers/util.ts +17 -17
  120. package/templates/default/components/form/inputs/CheckboxFormInput.tsx +46 -46
  121. package/templates/default/components/form/inputs/ColorFormInput.tsx +44 -44
  122. package/templates/default/components/form/inputs/DateFormInput.tsx +156 -156
  123. package/templates/default/components/form/inputs/DocumentFormInput.tsx +222 -222
  124. package/templates/default/components/form/inputs/MapFormInput.tsx +140 -140
  125. package/templates/default/components/form/inputs/MultipleSelectFormInput.tsx +85 -85
  126. package/templates/default/components/form/inputs/NumberFormInput.tsx +43 -43
  127. package/templates/default/components/form/inputs/PasswordFormInput.tsx +47 -47
  128. package/templates/default/components/form/inputs/PhotoFormInput.tsx +275 -275
  129. package/templates/default/components/form/inputs/RichTextFormInput.tsx +138 -138
  130. package/templates/default/components/form/inputs/SelectFormInput.tsx +175 -175
  131. package/templates/default/components/form/inputs/SlugFormInput.tsx +131 -131
  132. package/templates/default/components/form/inputs/TagsFormInput.tsx +260 -260
  133. package/templates/default/components/form/inputs/TextFormInput.tsx +51 -51
  134. package/templates/default/components/form/inputs/TextareaFormInput.tsx +50 -50
  135. package/templates/default/components/form/inputs/VideoFormInput.tsx +118 -118
  136. package/templates/default/components/multi-select.tsx +1146 -1146
  137. package/templates/default/components/pagination/Pagination.tsx +36 -36
  138. package/templates/default/components/pagination/PaginationButtons.tsx +147 -147
  139. package/templates/default/components/theme-toggle.tsx +39 -39
  140. package/templates/default/components/ui/accordion.tsx +53 -53
  141. package/templates/default/components/ui/alert-dialog.tsx +157 -157
  142. package/templates/default/components/ui/alert.tsx +47 -47
  143. package/templates/default/components/ui/badge.tsx +38 -38
  144. package/templates/default/components/ui/button.tsx +62 -62
  145. package/templates/default/components/ui/calendar.tsx +166 -166
  146. package/templates/default/components/ui/card.tsx +43 -43
  147. package/templates/default/components/ui/checkbox.tsx +29 -29
  148. package/templates/default/components/ui/command.tsx +137 -137
  149. package/templates/default/components/ui/custom-alert-dialog.tsx +113 -113
  150. package/templates/default/components/ui/custom-dialog.tsx +123 -123
  151. package/templates/default/components/ui/dialog.tsx +123 -123
  152. package/templates/default/components/ui/direction.tsx +22 -22
  153. package/templates/default/components/ui/dropdown-menu.tsx +182 -182
  154. package/templates/default/components/ui/input-group.tsx +54 -54
  155. package/templates/default/components/ui/input.tsx +22 -22
  156. package/templates/default/components/ui/label.tsx +19 -19
  157. package/templates/default/components/ui/popover.tsx +42 -42
  158. package/templates/default/components/ui/progress.tsx +31 -31
  159. package/templates/default/components/ui/scroll-area.tsx +42 -42
  160. package/templates/default/components/ui/select.tsx +165 -165
  161. package/templates/default/components/ui/separator.tsx +28 -28
  162. package/templates/default/components/ui/sheet.tsx +103 -103
  163. package/templates/default/components/ui/spinner.tsx +16 -16
  164. package/templates/default/components/ui/switch.tsx +29 -29
  165. package/templates/default/components/ui/table.tsx +83 -83
  166. package/templates/default/components/ui/tabs.tsx +55 -55
  167. package/templates/default/components/ui/toast.tsx +113 -113
  168. package/templates/default/components/ui/toaster.tsx +35 -35
  169. package/templates/default/components/ui/tooltip.tsx +30 -30
  170. package/templates/default/components/ui/use-toast.ts +188 -188
  171. package/templates/default/components.json +21 -21
  172. package/templates/default/context/ModalProvider.tsx +53 -53
  173. package/templates/default/drizzle.config.ts +4 -4
  174. package/templates/default/dynamic-schemas/schema.ts +475 -474
  175. package/templates/default/env/env.js +130 -130
  176. package/templates/default/envConfig.ts +4 -4
  177. package/templates/default/hooks/useModal.ts +8 -8
  178. package/templates/default/lib/apiHelpers.ts +92 -92
  179. package/templates/default/lib/postinstall.js +14 -14
  180. package/templates/default/lib/utils.ts +6 -6
  181. package/templates/default/next-env.d.ts +6 -6
  182. package/templates/default/next.config.ts +23 -23
  183. package/templates/default/package.json +1 -1
  184. package/templates/default/postcss.config.mjs +6 -6
  185. package/templates/default/proxy.ts +32 -32
  186. package/templates/default/tsconfig.json +48 -48
@@ -1,474 +1,475 @@
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
- }, (table) => [
40
- index('unique_user_report_index').on(table.contentType, table.price, table.appId),
41
- unique('unique_user_report').on(table.contentType, table.price, table.appId),
42
- unique('price_unique').on(table.price)
43
- ]);
44
-
45
-
46
- export const TestTagsTable = mysqlTable('test_tags', {
47
- testId: varchar('test_id', { length: 255 }).notNull(),
48
- tagName: varchar('tag_name', { length: 255 }).notNull(),
49
- locale: varchar('locale', { length: 255 })
50
- }, (table) => [
51
- primaryKey({ columns: [table.testId, table.tagName, table.locale] })
52
- ]);
53
-
54
-
55
- export const TestSectionLocalesTable = mysqlTable('test_section_locales', {
56
- id: int('id').autoincrement().notNull().primaryKey(),
57
- parentId: int('parent_id').notNull(),
58
- locale: varchar('locale', { length: 10 }).notNull(),
59
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
60
- price: int('price'),
61
- appId: varchar('app_id', { length: 36 }).notNull(),
62
- title: varchar('title', { length: 255 }).notNull(),
63
- photo: varchar('photo', { length: 255 }),
64
- category: varchar('category', { length: 255 })
65
- }, (table) => [
66
- unique('test_section_locales_parent_id_locale_unique').on(table.parentId, table.locale)
67
- ]);
68
-
69
-
70
- export const FeaturedSliderTable = mysqlTable('featured_slider', {
71
- id: int('id').autoincrement().notNull().primaryKey(),
72
- image: varchar('image', { length: 255 }).notNull(),
73
- titleEn: varchar('title_en', { length: 255 }).notNull(),
74
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
75
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
76
- descEn: longtext('desc_en').notNull(),
77
- descAr: longtext('desc_ar').notNull(),
78
- descTr: longtext('desc_tr').notNull()
79
- }, (table) => [
80
- unique('title_en_unique').on(table.titleEn),
81
- unique('title_ar_unique').on(table.titleAr),
82
- unique('title_tr_unique').on(table.titleTr)
83
- ]);
84
-
85
-
86
- export const MenuSettingsTable = mysqlTable('menu_settings', {
87
- id: int('id').autoincrement().notNull().primaryKey(),
88
- taxRate: varchar('tax_rate', { length: 255 }),
89
- hideSlider: boolean('hide_slider')
90
- });
91
-
92
-
93
- export const ServicesTable = mysqlTable('services', {
94
- id: int('id').autoincrement().notNull().primaryKey(),
95
- title: varchar('title', { length: 255 }).notNull(),
96
- catId: int('cat_id').notNull(),
97
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
98
- price: int('price'),
99
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
100
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
101
- desc: longtext('desc'),
102
- latitude: double('latitude'),
103
- longitude: double('longitude'),
104
- viewCount: int('view_count'),
105
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
106
- govId: int('gov_id').notNull(),
107
- districtId: int('district_id').notNull(),
108
- subDistrictId: int('sub_district_id'),
109
- townId: int('town_id')
110
- }, (table) => [
111
- index('title_index').on(table.title),
112
- unique('title_unique').on(table.title)
113
- ]);
114
-
115
-
116
- export const RealestateTable = mysqlTable('realestate', {
117
- id: int('id').autoincrement().notNull().primaryKey(),
118
- catId: int('cat_id').notNull(),
119
- title: varchar('title', { length: 255 }).notNull(),
120
- price: int('price').notNull(),
121
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
122
- spaceGross: int('space_gross').notNull(),
123
- spaceNet: int('space_net').notNull(),
124
- latitude: double('latitude').notNull(),
125
- longitude: double('longitude').notNull(),
126
- roomCount: varchar('room_count', { length: 255 }),
127
- buildingAge: varchar('building_age', { length: 255 }),
128
- floorCount: varchar('floor_count', { length: 255 }),
129
- bathroomCount: varchar('bathroom_count', { length: 255 }),
130
- floorLocation: varchar('floor_location', { length: 255 }),
131
- heatingType: varchar('heating_type', { length: 255 }),
132
- kitchenType: varchar('kitchen_type', { length: 255 }),
133
- balcony: boolean('balcony'),
134
- lift: boolean('lift'),
135
- parkingType: varchar('parking_type', { length: 255 }),
136
- furnished: boolean('furnished'),
137
- belongsToSite: boolean('belongs_to_site'),
138
- siteName: varchar('site_name', { length: 255 }),
139
- installments: boolean('installments'),
140
- exchangeable: boolean('exchangeable'),
141
- fromWhom: varchar('from_whom', { length: 255 }),
142
- buildingMembershipFees: int('building_membership_fees'),
143
- deposit: int('deposit'),
144
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
145
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
146
- desc: longtext('desc'),
147
- viewCount: int('view_count'),
148
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
149
- govId: int('gov_id').notNull(),
150
- districtId: int('district_id').notNull(),
151
- subDistrictId: int('sub_district_id'),
152
- townId: int('town_id')
153
- }, (table) => [
154
- index('title_index').on(table.title),
155
- unique('title_unique').on(table.title)
156
- ]);
157
-
158
-
159
- export const HomepageSliderTable = mysqlTable('homepage_slider', {
160
- id: int('id').autoincrement().notNull().primaryKey(),
161
- titleEn: varchar('title_en', { length: 255 }).notNull(),
162
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
163
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
164
- subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
165
- subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
166
- subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
167
- photo: varchar('photo', { length: 255 }).notNull(),
168
- buttonUrl: varchar('button_url', { length: 255 }),
169
- buttonTextEn: varchar('button_text_en', { length: 255 }),
170
- buttonTextAr: varchar('button_text_ar', { length: 255 }),
171
- buttonTextTr: varchar('button_text_tr', { length: 255 }),
172
- buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
173
- });
174
-
175
-
176
- export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
177
- id: int('id').autoincrement().notNull().primaryKey(),
178
- userId: int('user_id').notNull(),
179
- contestId: varchar('contest_id', { length: 255 }).notNull()
180
- }, (table) => [
181
- unique('contest_subscriber_unique').on(table.contestId, table.userId)
182
- ]);
183
-
184
-
185
- export const ContestsTable = mysqlTable('contests', {
186
- id: int('id').autoincrement().notNull().primaryKey(),
187
- date: timestamp('date').notNull(),
188
- prize: varchar('prize', { length: 255 }).notNull(),
189
- winnerId: int('winner_id'),
190
- tags: varchar('tags', { length: 255 })
191
- });
192
-
193
-
194
- export const NotificationsTable = mysqlTable('notifications', {
195
- id: int('id').autoincrement().notNull().primaryKey(),
196
- 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(),
197
- contentId: int('content_id'),
198
- contentCatId: int('content_cat_id'),
199
- userId: int('user_id'),
200
- message: varchar('message', { length: 255 })
201
- }, (table) => [
202
- index('type_index').on(table.type),
203
- unique('unique_notification').on(table.type, table.contentId, table.contentCatId)
204
- ]);
205
-
206
-
207
- export const ModerationTable = mysqlTable('moderation', {
208
- id: int('id').autoincrement().notNull().primaryKey(),
209
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
210
- contentId: int('content_id').notNull(),
211
- catId: int('cat_id'),
212
- userId: int('user_id').notNull(),
213
- flagged: int('flagged').notNull(),
214
- result: varchar('result', { length: 255 }).notNull()
215
- }, (table) => [
216
- index('unique_user_report_index').on(table.contentType, table.contentId, table.catId, table.userId),
217
- unique('unique_user_report').on(table.contentType, table.contentId, table.catId, table.userId)
218
- ]);
219
-
220
-
221
- export const JobsTable = mysqlTable('jobs', {
222
- id: int('id').autoincrement().notNull().primaryKey(),
223
- title: varchar('title', { length: 255 }).notNull(),
224
- catId: int('cat_id').notNull(),
225
- salary: int('salary'),
226
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
227
- workMethod: varchar('work_method', { length: 255 }).notNull(),
228
- minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
229
- experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
230
- remote: boolean('remote'),
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 FurnitureTable = mysqlTable('furniture', {
249
- id: int('id').autoincrement().notNull().primaryKey(),
250
- title: varchar('title', { length: 255 }).notNull(),
251
- catId: int('cat_id').notNull(),
252
- condition: varchar('condition', { length: 255 }).notNull(),
253
- price: int('price').notNull(),
254
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
255
- exchangeable: boolean('exchangeable'),
256
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
257
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
258
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
259
- desc: longtext('desc'),
260
- latitude: double('latitude'),
261
- longitude: double('longitude'),
262
- viewCount: int('view_count'),
263
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
264
- govId: int('gov_id').notNull(),
265
- districtId: int('district_id').notNull(),
266
- subDistrictId: int('sub_district_id'),
267
- townId: int('town_id')
268
- }, (table) => [
269
- index('title_index').on(table.title),
270
- unique('title_unique').on(table.title)
271
- ]);
272
-
273
-
274
- export const FiltersTable = mysqlTable('filters', {
275
- id: int('id').autoincrement().notNull().primaryKey(),
276
- title: varchar('title', { length: 255 }).notNull(),
277
- Key: varchar('_key', { length: 255 }).notNull(),
278
- fieldName: varchar('field_name', { length: 255 }).notNull(),
279
- type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
280
- tableName: varchar('table_name', { length: 255 }),
281
- isMandatory: boolean('is_mandatory')
282
- }, (table) => [
283
- unique('title_unique').on(table.title),
284
- unique('key_unique').on(table.Key)
285
- ]);
286
-
287
-
288
- export const FaqTable = mysqlTable('faq', {
289
- id: int('id').autoincrement().notNull().primaryKey(),
290
- qEn: varchar('q_en', { length: 255 }).notNull(),
291
- qAr: varchar('q_ar', { length: 255 }).notNull(),
292
- qTr: varchar('q_tr', { length: 255 }),
293
- aEn: longtext('a_en').notNull(),
294
- aAr: longtext('a_ar'),
295
- aTr: longtext('a_tr')
296
- }, (table) => [
297
- unique('faq_q_en_unique').on(table.qEn),
298
- unique('title_ar_unique').on(table.qAr),
299
- unique('title_tr_unique').on(table.qTr)
300
- ]);
301
-
302
-
303
- export const ErrorsTable = mysqlTable('errors', {
304
- id: int('id').autoincrement().notNull().primaryKey(),
305
- title: varchar('title', { length: 255 }).notNull(),
306
- caseId: varchar('case_id', { length: 255 }).notNull(),
307
- userId: int('user_id'),
308
- itemSlug: varchar('item_slug', { length: 255 }),
309
- desc: longtext('desc'),
310
- isResolved: boolean('is_resolved')
311
- }, (table) => [
312
- unique('key_unique').on(table.caseId)
313
- ]);
314
-
315
-
316
- export const ElectronicsTable = mysqlTable('electronics', {
317
- id: int('id').autoincrement().notNull().primaryKey(),
318
- title: varchar('title', { length: 255 }).notNull(),
319
- catId: int('cat_id').notNull(),
320
- condition: varchar('condition', { length: 255 }).notNull(),
321
- price: int('price').notNull(),
322
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
323
- exchangeable: boolean('exchangeable'),
324
- installments: boolean('installments'),
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 ClothesTable = mysqlTable('clothes', {
344
- id: int('id').autoincrement().notNull().primaryKey(),
345
- title: varchar('title', { length: 255 }).notNull(),
346
- catId: int('cat_id').notNull(),
347
- condition: varchar('condition', { length: 255 }).notNull(),
348
- price: int('price').notNull(),
349
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
350
- exchangeable: boolean('exchangeable'),
351
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
352
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
353
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
354
- desc: longtext('desc'),
355
- latitude: double('latitude'),
356
- longitude: double('longitude'),
357
- viewCount: int('view_count'),
358
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
359
- govId: int('gov_id').notNull(),
360
- districtId: int('district_id').notNull(),
361
- subDistrictId: int('sub_district_id'),
362
- townId: int('town_id')
363
- }, (table) => [
364
- index('title_index').on(table.title),
365
- unique('title_unique').on(table.title)
366
- ]);
367
-
368
-
369
- export const CatsTable = mysqlTable('cats', {
370
- id: int('id').autoincrement().notNull().primaryKey(),
371
- catOrder: int('cat_order').notNull(),
372
- slug: varchar('slug', { length: 255 }).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
- fullTitleEn: varchar('full_title_en', { length: 255 }),
377
- fullTitleAr: varchar('full_title_ar', { length: 255 }),
378
- fullTitleTr: varchar('full_title_tr', { length: 255 }),
379
- image: varchar('image', { length: 255 }),
380
- metaDescEn: varchar('meta_desc_en', { length: 255 }),
381
- metaDescAr: varchar('meta_desc_ar', { length: 255 }),
382
- metaDescTr: varchar('meta_desc_tr', { length: 255 }),
383
- filters: varchar('filters', { length: 255 }),
384
- tableName: varchar('table_name', { length: 255 }).notNull(),
385
- adCount: int('ad_count'),
386
- parentId: int('parent_id'),
387
- level: int('level')
388
- }, (table) => [
389
- unique('cats_slug_unique').on(table.slug)
390
- ]);
391
-
392
-
393
- export const CarsTable = mysqlTable('cars', {
394
- id: int('id').autoincrement().notNull().primaryKey(),
395
- modelYear: int('model_year').notNull(),
396
- model: varchar('model', { length: 255 }).notNull(),
397
- title: varchar('title', { length: 255 }).notNull(),
398
- catId: int('cat_id').notNull(),
399
- govId: int('gov_id').notNull(),
400
- districtId: int('district_id').notNull(),
401
- subDistrictId: int('sub_district_id'),
402
- townId: int('town_id'),
403
- price: int('price').notNull(),
404
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
405
- condition: varchar('condition', { length: 255 }).notNull(),
406
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
407
- engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
408
- enginePower: varchar('engine_power', { length: 255 }).notNull(),
409
- tractionType: varchar('traction_type', { length: 255 }).notNull(),
410
- bodyType: varchar('body_type', { length: 255 }).notNull(),
411
- gearType: varchar('gear_type', { length: 255 }).notNull(),
412
- fuelType: varchar('fuel_type', { length: 255 }).notNull(),
413
- exchangeable: boolean('exchangeable'),
414
- installments: boolean('installments'),
415
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
416
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
417
- desc: longtext('desc'),
418
- latitude: double('latitude'),
419
- longitude: double('longitude'),
420
- viewCount: int('view_count'),
421
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
422
- }, (table) => [
423
- index('title_index').on(table.title)
424
- ]);
425
-
426
-
427
- export const CarsDbTable = mysqlTable('cars_db', {
428
- id: int('id').autoincrement().notNull().primaryKey(),
429
- name: varchar('name', { length: 255 }).notNull(),
430
- parentId: int('parent_id'),
431
- level: int('level')
432
- }, (table) => [
433
- index('cars_db_name_idx').on(table.name)
434
- ]);
435
-
436
-
437
- export const BooksTable = mysqlTable('books', {
438
- id: int('id').autoincrement().notNull().primaryKey(),
439
- title: varchar('title', { length: 255 }).notNull(),
440
- catId: int('cat_id').notNull(),
441
- condition: varchar('condition', { length: 255 }).notNull(),
442
- price: int('price').notNull(),
443
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
444
- exchangeable: boolean('exchangeable'),
445
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
446
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
447
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
448
- desc: longtext('desc'),
449
- latitude: double('latitude'),
450
- longitude: double('longitude'),
451
- viewCount: int('view_count'),
452
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
453
- govId: int('gov_id').notNull(),
454
- districtId: int('district_id').notNull(),
455
- subDistrictId: int('sub_district_id'),
456
- townId: int('town_id')
457
- }, (table) => [
458
- index('title_index').on(table.title),
459
- unique('title_unique').on(table.title)
460
- ]);
461
-
462
-
463
- export const AddressTable = mysqlTable('address', {
464
- id: int('id').autoincrement().notNull().primaryKey(),
465
- catOrder: int('cat_order').notNull(),
466
- titleEn: varchar('title_en', { length: 255 }).notNull(),
467
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
468
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
469
- image: varchar('image', { length: 255 }),
470
- path: varchar('path', { length: 255 }),
471
- parentId: int('parent_id'),
472
- level: int('level')
473
- });
474
-
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
+