create-nextjs-cms 0.5.8

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 (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +395 -0
  6. package/dist/lib/utils.d.ts +11 -0
  7. package/dist/lib/utils.d.ts.map +1 -0
  8. package/dist/lib/utils.js +48 -0
  9. package/package.json +44 -0
  10. package/templates/default/.env +24 -0
  11. package/templates/default/.env.development +8 -0
  12. package/templates/default/.eslintrc.json +5 -0
  13. package/templates/default/.prettierignore +7 -0
  14. package/templates/default/.prettierrc.json +19 -0
  15. package/templates/default/CHANGELOG.md +77 -0
  16. package/templates/default/README.md +45 -0
  17. package/templates/default/app/(auth)/auth/login/LoginPage.tsx +175 -0
  18. package/templates/default/app/(auth)/auth/login/page.tsx +12 -0
  19. package/templates/default/app/(rootLayout)/admins/page.tsx +5 -0
  20. package/templates/default/app/(rootLayout)/advanced/page.tsx +5 -0
  21. package/templates/default/app/(rootLayout)/analytics/page.tsx +7 -0
  22. package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +7 -0
  23. package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +7 -0
  24. package/templates/default/app/(rootLayout)/dashboard/page.tsx +7 -0
  25. package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +7 -0
  26. package/templates/default/app/(rootLayout)/emails/page.tsx +6 -0
  27. package/templates/default/app/(rootLayout)/layout.tsx +5 -0
  28. package/templates/default/app/(rootLayout)/loading.tsx +10 -0
  29. package/templates/default/app/(rootLayout)/log/page.tsx +7 -0
  30. package/templates/default/app/(rootLayout)/new/[section]/page.tsx +7 -0
  31. package/templates/default/app/(rootLayout)/page.tsx +9 -0
  32. package/templates/default/app/(rootLayout)/section/[section]/page.tsx +7 -0
  33. package/templates/default/app/(rootLayout)/settings/page.tsx +7 -0
  34. package/templates/default/app/_trpc/client.ts +4 -0
  35. package/templates/default/app/api/auth/csrf/route.ts +25 -0
  36. package/templates/default/app/api/auth/refresh/route.ts +10 -0
  37. package/templates/default/app/api/auth/route.ts +23 -0
  38. package/templates/default/app/api/auth/session/route.ts +20 -0
  39. package/templates/default/app/api/editor/photo/route.ts +42 -0
  40. package/templates/default/app/api/photo/route.ts +27 -0
  41. package/templates/default/app/api/placeholder/route.ts +7 -0
  42. package/templates/default/app/api/submit/section/item/[slug]/route.ts +63 -0
  43. package/templates/default/app/api/submit/section/item/route.ts +53 -0
  44. package/templates/default/app/api/submit/section/simple/route.ts +54 -0
  45. package/templates/default/app/api/trpc/[trpc]/route.ts +33 -0
  46. package/templates/default/app/api/video/route.ts +174 -0
  47. package/templates/default/app/dictionaries.ts +14 -0
  48. package/templates/default/app/layout.tsx +28 -0
  49. package/templates/default/app/providers.tsx +151 -0
  50. package/templates/default/cli.ts +4 -0
  51. package/templates/default/components/AdminCard.tsx +163 -0
  52. package/templates/default/components/AdminEditPage.tsx +123 -0
  53. package/templates/default/components/AdminPrivilegeCard.tsx +184 -0
  54. package/templates/default/components/AdminsPage.tsx +43 -0
  55. package/templates/default/components/AdvancedSettingsPage.tsx +167 -0
  56. package/templates/default/components/AnalyticsPage.tsx +127 -0
  57. package/templates/default/components/BarChartBox.tsx +43 -0
  58. package/templates/default/components/BrowsePage.tsx +119 -0
  59. package/templates/default/components/CategorizedSectionPage.tsx +36 -0
  60. package/templates/default/components/CategoryDeleteConfirmPage.tsx +129 -0
  61. package/templates/default/components/CategorySectionSelectInput.tsx +139 -0
  62. package/templates/default/components/ConditionalFields.tsx +49 -0
  63. package/templates/default/components/ContainerBox.tsx +24 -0
  64. package/templates/default/components/DashboardPage.tsx +187 -0
  65. package/templates/default/components/DashboardPageAlt.tsx +43 -0
  66. package/templates/default/components/DefaultNavItems.tsx +3 -0
  67. package/templates/default/components/Dropzone.tsx +153 -0
  68. package/templates/default/components/EmailCard.tsx +137 -0
  69. package/templates/default/components/EmailPasswordForm.tsx +84 -0
  70. package/templates/default/components/EmailQuotaForm.tsx +72 -0
  71. package/templates/default/components/EmailsPage.tsx +48 -0
  72. package/templates/default/components/GalleryPhoto.tsx +93 -0
  73. package/templates/default/components/InfoCard.tsx +94 -0
  74. package/templates/default/components/ItemEditPage.tsx +217 -0
  75. package/templates/default/components/Layout.tsx +70 -0
  76. package/templates/default/components/LoadingSpinners.tsx +67 -0
  77. package/templates/default/components/LogPage.tsx +17 -0
  78. package/templates/default/components/Modal.tsx +99 -0
  79. package/templates/default/components/Navbar.tsx +29 -0
  80. package/templates/default/components/NavbarAlt.tsx +182 -0
  81. package/templates/default/components/NewAdminForm.tsx +172 -0
  82. package/templates/default/components/NewEmailForm.tsx +131 -0
  83. package/templates/default/components/NewPage.tsx +206 -0
  84. package/templates/default/components/NewVariantComponent.tsx +228 -0
  85. package/templates/default/components/PhotoGallery.tsx +35 -0
  86. package/templates/default/components/PieChartBox.tsx +101 -0
  87. package/templates/default/components/ProgressBar.tsx +24 -0
  88. package/templates/default/components/ProtectedDocument.tsx +78 -0
  89. package/templates/default/components/ProtectedImage.tsx +143 -0
  90. package/templates/default/components/ProtectedVideo.tsx +76 -0
  91. package/templates/default/components/SectionItemCard.tsx +143 -0
  92. package/templates/default/components/SectionItemStatusBadge.tsx +16 -0
  93. package/templates/default/components/SectionPage.tsx +124 -0
  94. package/templates/default/components/SelectBox.tsx +99 -0
  95. package/templates/default/components/SelectInputButtons.tsx +124 -0
  96. package/templates/default/components/SettingsPage.tsx +238 -0
  97. package/templates/default/components/Sidebar.tsx +209 -0
  98. package/templates/default/components/SidebarDropdownItem.tsx +74 -0
  99. package/templates/default/components/SidebarItem.tsx +19 -0
  100. package/templates/default/components/TempPage.tsx +12 -0
  101. package/templates/default/components/ThemeProvider.tsx +8 -0
  102. package/templates/default/components/TooltipComponent.tsx +27 -0
  103. package/templates/default/components/VariantCard.tsx +123 -0
  104. package/templates/default/components/VariantEditPage.tsx +229 -0
  105. package/templates/default/components/analytics/BounceRate.tsx +69 -0
  106. package/templates/default/components/analytics/LivePageViews.tsx +54 -0
  107. package/templates/default/components/analytics/LiveUsersCount.tsx +32 -0
  108. package/templates/default/components/analytics/MonthlyPageViews.tsx +41 -0
  109. package/templates/default/components/analytics/TopCountries.tsx +51 -0
  110. package/templates/default/components/analytics/TopDevices.tsx +45 -0
  111. package/templates/default/components/analytics/TopMediums.tsx +57 -0
  112. package/templates/default/components/analytics/TopSources.tsx +44 -0
  113. package/templates/default/components/analytics/TotalPageViews.tsx +40 -0
  114. package/templates/default/components/analytics/TotalSessions.tsx +40 -0
  115. package/templates/default/components/analytics/TotalUniqueUsers.tsx +40 -0
  116. package/templates/default/components/custom/RightHomeRoomVariantCard.tsx +137 -0
  117. package/templates/default/components/dndKit/Draggable.tsx +21 -0
  118. package/templates/default/components/dndKit/Droppable.tsx +20 -0
  119. package/templates/default/components/dndKit/SortableItem.tsx +18 -0
  120. package/templates/default/components/form/DateRangeFormInput.tsx +55 -0
  121. package/templates/default/components/form/Form.tsx +298 -0
  122. package/templates/default/components/form/FormInputElement.tsx +68 -0
  123. package/templates/default/components/form/FormInputs.tsx +108 -0
  124. package/templates/default/components/form/helpers/util.ts +20 -0
  125. package/templates/default/components/form/inputs/CheckboxFormInput.tsx +33 -0
  126. package/templates/default/components/form/inputs/ColorFormInput.tsx +44 -0
  127. package/templates/default/components/form/inputs/DateFormInput.tsx +107 -0
  128. package/templates/default/components/form/inputs/DocumentFormInput.tsx +124 -0
  129. package/templates/default/components/form/inputs/MapFormInput.tsx +139 -0
  130. package/templates/default/components/form/inputs/MultipleSelectFormInput.tsx +150 -0
  131. package/templates/default/components/form/inputs/NumberFormInput.tsx +42 -0
  132. package/templates/default/components/form/inputs/PasswordFormInput.tsx +47 -0
  133. package/templates/default/components/form/inputs/PhotoFormInput.tsx +218 -0
  134. package/templates/default/components/form/inputs/RichTextFormInput.tsx +133 -0
  135. package/templates/default/components/form/inputs/SelectFormInput.tsx +164 -0
  136. package/templates/default/components/form/inputs/TagsFormInput.tsx +63 -0
  137. package/templates/default/components/form/inputs/TextFormInput.tsx +48 -0
  138. package/templates/default/components/form/inputs/TextareaFormInput.tsx +47 -0
  139. package/templates/default/components/form/inputs/VideoFormInput.tsx +117 -0
  140. package/templates/default/components/pagination/Pagination.tsx +36 -0
  141. package/templates/default/components/pagination/PaginationButtons.tsx +145 -0
  142. package/templates/default/components/ui/accordion.tsx +57 -0
  143. package/templates/default/components/ui/alert.tsx +46 -0
  144. package/templates/default/components/ui/badge.tsx +33 -0
  145. package/templates/default/components/ui/button.tsx +57 -0
  146. package/templates/default/components/ui/calendar.tsx +68 -0
  147. package/templates/default/components/ui/card.tsx +76 -0
  148. package/templates/default/components/ui/checkbox.tsx +29 -0
  149. package/templates/default/components/ui/dropdown-menu.tsx +205 -0
  150. package/templates/default/components/ui/input.tsx +25 -0
  151. package/templates/default/components/ui/label.tsx +26 -0
  152. package/templates/default/components/ui/popover.tsx +31 -0
  153. package/templates/default/components/ui/scroll-area.tsx +42 -0
  154. package/templates/default/components/ui/select.tsx +164 -0
  155. package/templates/default/components/ui/sheet.tsx +107 -0
  156. package/templates/default/components/ui/switch.tsx +29 -0
  157. package/templates/default/components/ui/table.tsx +120 -0
  158. package/templates/default/components/ui/tabs.tsx +55 -0
  159. package/templates/default/components/ui/toast.tsx +113 -0
  160. package/templates/default/components/ui/toaster.tsx +35 -0
  161. package/templates/default/components/ui/tooltip.tsx +30 -0
  162. package/templates/default/components/ui/use-toast.ts +188 -0
  163. package/templates/default/components.json +16 -0
  164. package/templates/default/context/ModalProvider.tsx +53 -0
  165. package/templates/default/drizzle.config.ts +4 -0
  166. package/templates/default/dynamic-schemas/schema.ts +373 -0
  167. package/templates/default/env/env.js +130 -0
  168. package/templates/default/envConfig.ts +4 -0
  169. package/templates/default/hooks/useModal.ts +8 -0
  170. package/templates/default/lib/apiHelpers.ts +106 -0
  171. package/templates/default/lz.config.ts +40 -0
  172. package/templates/default/middleware.ts +33 -0
  173. package/templates/default/next.config.ts +46 -0
  174. package/templates/default/package.json +134 -0
  175. package/templates/default/postcss.config.js +6 -0
  176. package/templates/default/postinstall.js +14 -0
  177. package/templates/default/public/blank_avatar.png +0 -0
  178. package/templates/default/public/favicon.ico +0 -0
  179. package/templates/default/public/img/placeholder.svg +1 -0
  180. package/templates/default/public/lazemni_logo.png +0 -0
  181. package/templates/default/public/next.svg +1 -0
  182. package/templates/default/public/vercel.svg +1 -0
  183. package/templates/default/section-tests.ts +92 -0
  184. package/templates/default/styles/globals.css +88 -0
  185. package/templates/default/tailwind.config.js +95 -0
  186. package/templates/default/test.ts +77 -0
  187. package/templates/default/tsconfig.json +44 -0
@@ -0,0 +1,373 @@
1
+ import {mysqlTable,int,longtext,mysqlEnum,varchar,double,boolean,datetime} from 'drizzle-orm/mysql-core'
2
+
3
+ export const AppInfoTable = mysqlTable('app_info', {
4
+ id: int('id').autoincrement().notNull().primaryKey(),
5
+ aboutEn: longtext('about_en').notNull(),
6
+ aboutAr: longtext('about_ar').notNull(),
7
+ aboutTr: longtext('about_tr').notNull(),
8
+ privacyEn: longtext('privacy_en').notNull(),
9
+ privacyAr: longtext('privacy_ar').notNull(),
10
+ privacyTr: longtext('privacy_tr').notNull()
11
+ });
12
+
13
+
14
+ export const UserReportsTable = mysqlTable('user_reports', {
15
+ id: int('id').autoincrement().notNull().primaryKey(),
16
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
17
+ reportType: mysqlEnum('report_type', ['explicit_content', 'wrong_information', 'no_longer_available', 'user_not_responsive', 'other']).notNull(),
18
+ contentId: int('content_id').notNull(),
19
+ catId: int('cat_id').notNull(),
20
+ userId: int('user_id'),
21
+ appId: varchar('app_id', { length: 36 }).notNull()
22
+ });
23
+
24
+
25
+ export const FeaturedSliderTable = mysqlTable('featured_slider', {
26
+ id: int('id').autoincrement().notNull().primaryKey(),
27
+ image: varchar('image', { length: 255 }).notNull(),
28
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
29
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
30
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
31
+ descEn: longtext('desc_en').notNull(),
32
+ descAr: longtext('desc_ar').notNull(),
33
+ descTr: longtext('desc_tr').notNull()
34
+ });
35
+
36
+
37
+ export const ServicesTable = mysqlTable('services', {
38
+ id: int('id').autoincrement().notNull().primaryKey(),
39
+ title: varchar('title', { length: 255 }).notNull(),
40
+ catId: int('cat_id').notNull(),
41
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
42
+ price: int('price'),
43
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
44
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
45
+ desc: longtext('desc'),
46
+ latitude: double('latitude'),
47
+ longitude: double('longitude'),
48
+ viewCount: int('view_count'),
49
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
50
+ govId: int('gov_id').notNull(),
51
+ districtId: int('district_id').notNull(),
52
+ subDistrictId: int('sub_district_id'),
53
+ townId: int('town_id')
54
+ });
55
+
56
+
57
+ export const RealestateTable = mysqlTable('realestate', {
58
+ id: int('id').autoincrement().notNull().primaryKey(),
59
+ catId: int('cat_id').notNull(),
60
+ title: varchar('title', { length: 255 }).notNull(),
61
+ price: int('price').notNull(),
62
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
63
+ spaceGross: int('space_gross').notNull(),
64
+ spaceNet: int('space_net').notNull(),
65
+ latitude: double('latitude').notNull(),
66
+ longitude: double('longitude').notNull(),
67
+ roomCount: varchar('room_count', { length: 255 }),
68
+ buildingAge: varchar('building_age', { length: 255 }),
69
+ floorCount: varchar('floor_count', { length: 255 }),
70
+ bathroomCount: varchar('bathroom_count', { length: 255 }),
71
+ floorLocation: varchar('floor_location', { length: 255 }),
72
+ heatingType: varchar('heating_type', { length: 255 }),
73
+ kitchenType: varchar('kitchen_type', { length: 255 }),
74
+ balcony: boolean('balcony'),
75
+ lift: boolean('lift'),
76
+ parkingType: varchar('parking_type', { length: 255 }),
77
+ furnished: boolean('furnished'),
78
+ belongsToSite: boolean('belongs_to_site'),
79
+ siteName: varchar('site_name', { length: 255 }),
80
+ installments: boolean('installments'),
81
+ exchangeable: boolean('exchangeable'),
82
+ fromWhom: varchar('from_whom', { length: 255 }),
83
+ buildingMembershipFees: int('building_membership_fees'),
84
+ deposit: int('deposit'),
85
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
86
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
87
+ desc: longtext('desc'),
88
+ viewCount: int('view_count'),
89
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
90
+ govId: int('gov_id').notNull(),
91
+ districtId: int('district_id').notNull(),
92
+ subDistrictId: int('sub_district_id'),
93
+ townId: int('town_id')
94
+ });
95
+
96
+
97
+ export const HomepageSliderTable = mysqlTable('homepage_slider', {
98
+ id: int('id').autoincrement().notNull().primaryKey(),
99
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
100
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
101
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
102
+ subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
103
+ subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
104
+ subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
105
+ photo: varchar('photo', { length: 255 }).notNull(),
106
+ buttonUrl: varchar('button_url', { length: 255 }),
107
+ buttonTextEn: varchar('button_text_en', { length: 255 }),
108
+ buttonTextAr: varchar('button_text_ar', { length: 255 }),
109
+ buttonTextTr: varchar('button_text_tr', { length: 255 }),
110
+ buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
111
+ });
112
+
113
+
114
+ export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
115
+ id: int('id').autoincrement().notNull().primaryKey(),
116
+ contestId: varchar('contest_id', { length: 255 }).notNull(),
117
+ userId: int('user_id').notNull()
118
+ });
119
+
120
+
121
+ export const ContestsTable = mysqlTable('contests', {
122
+ id: int('id').autoincrement().notNull().primaryKey(),
123
+ date: datetime('date').notNull(),
124
+ prize: varchar('prize', { length: 255 }).notNull(),
125
+ winnerId: int('winner_id')
126
+ });
127
+
128
+
129
+ export const NotificationsTable = mysqlTable('notifications', {
130
+ id: int('id').autoincrement().notNull().primaryKey(),
131
+ type: mysqlEnum('type', ['ad_price_updated', 'ad_updated', 'ad_activated', 'ad_pending_review', 'ad_expired', 'ad_rejected', 'ad_viewed', 'ad_favorited', 'ad_shared', 'ad_reported', 'ad_deleted', 'ad_created', 'contest_winner', 'contest_reminder', 'contest_created', 'custom']).notNull(),
132
+ contentId: int('content_id'),
133
+ contentCatId: int('content_cat_id'),
134
+ userId: int('user_id'),
135
+ message: varchar('message', { length: 255 })
136
+ });
137
+
138
+
139
+ export const ModerationTable = mysqlTable('moderation', {
140
+ id: int('id').autoincrement().notNull().primaryKey(),
141
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
142
+ contentId: int('content_id').notNull(),
143
+ catId: int('cat_id'),
144
+ userId: int('user_id').notNull(),
145
+ flagged: int('flagged').notNull(),
146
+ result: varchar('result', { length: 255 }).notNull()
147
+ });
148
+
149
+
150
+ export const JobsTable = mysqlTable('jobs', {
151
+ id: int('id').autoincrement().notNull().primaryKey(),
152
+ title: varchar('title', { length: 255 }).notNull(),
153
+ catId: int('cat_id').notNull(),
154
+ salary: int('salary'),
155
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
156
+ workMethod: varchar('work_method', { length: 255 }).notNull(),
157
+ minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
158
+ experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
159
+ remote: boolean('remote'),
160
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
161
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
162
+ desc: longtext('desc'),
163
+ latitude: double('latitude'),
164
+ longitude: double('longitude'),
165
+ viewCount: int('view_count'),
166
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
167
+ govId: int('gov_id').notNull(),
168
+ districtId: int('district_id').notNull(),
169
+ subDistrictId: int('sub_district_id'),
170
+ townId: int('town_id')
171
+ });
172
+
173
+
174
+ export const FurnitureTable = mysqlTable('furniture', {
175
+ id: int('id').autoincrement().notNull().primaryKey(),
176
+ title: varchar('title', { length: 255 }).notNull(),
177
+ catId: int('cat_id').notNull(),
178
+ condition: varchar('condition', { length: 255 }).notNull(),
179
+ price: int('price').notNull(),
180
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
181
+ exchangeable: boolean('exchangeable'),
182
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
183
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
184
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
185
+ desc: longtext('desc'),
186
+ latitude: double('latitude'),
187
+ longitude: double('longitude'),
188
+ viewCount: int('view_count'),
189
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
190
+ govId: int('gov_id').notNull(),
191
+ districtId: int('district_id').notNull(),
192
+ subDistrictId: int('sub_district_id'),
193
+ townId: int('town_id')
194
+ });
195
+
196
+
197
+ export const FiltersTable = mysqlTable('filters', {
198
+ id: int('id').autoincrement().notNull().primaryKey(),
199
+ title: varchar('title', { length: 255 }).notNull(),
200
+ Key: varchar('_key', { length: 255 }).notNull(),
201
+ fieldName: varchar('field_name', { length: 255 }).notNull(),
202
+ type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
203
+ tableName: varchar('table_name', { length: 255 }),
204
+ isMandatory: boolean('is_mandatory')
205
+ });
206
+
207
+
208
+ export const FaqTable = mysqlTable('faq', {
209
+ id: int('id').autoincrement().notNull().primaryKey(),
210
+ qEn: varchar('q_en', { length: 255 }).notNull(),
211
+ qAr: varchar('q_ar', { length: 255 }).notNull(),
212
+ qTr: varchar('q_tr', { length: 255 }),
213
+ aEn: longtext('a_en').notNull(),
214
+ aAr: longtext('a_ar'),
215
+ aTr: longtext('a_tr')
216
+ });
217
+
218
+
219
+ export const ErrorsTable = mysqlTable('errors', {
220
+ id: int('id').autoincrement().notNull().primaryKey(),
221
+ title: varchar('title', { length: 255 }).notNull(),
222
+ caseId: varchar('case_id', { length: 255 }).notNull(),
223
+ userId: int('user_id'),
224
+ itemSlug: varchar('item_slug', { length: 255 }),
225
+ desc: longtext('desc'),
226
+ isResolved: boolean('is_resolved')
227
+ });
228
+
229
+
230
+ export const ElectronicsTable = mysqlTable('electronics', {
231
+ id: int('id').autoincrement().notNull().primaryKey(),
232
+ title: varchar('title', { length: 255 }).notNull(),
233
+ catId: int('cat_id').notNull(),
234
+ condition: varchar('condition', { length: 255 }).notNull(),
235
+ price: int('price').notNull(),
236
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
237
+ exchangeable: boolean('exchangeable'),
238
+ installments: boolean('installments'),
239
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
240
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
241
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
242
+ desc: longtext('desc'),
243
+ latitude: double('latitude'),
244
+ longitude: double('longitude'),
245
+ viewCount: int('view_count'),
246
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
247
+ govId: int('gov_id').notNull(),
248
+ districtId: int('district_id').notNull(),
249
+ subDistrictId: int('sub_district_id'),
250
+ townId: int('town_id')
251
+ });
252
+
253
+
254
+ export const ClothesTable = mysqlTable('clothes', {
255
+ id: int('id').autoincrement().notNull().primaryKey(),
256
+ title: varchar('title', { length: 255 }).notNull(),
257
+ catId: int('cat_id').notNull(),
258
+ condition: varchar('condition', { length: 255 }).notNull(),
259
+ price: int('price').notNull(),
260
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
261
+ exchangeable: boolean('exchangeable'),
262
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
263
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
264
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
265
+ desc: longtext('desc'),
266
+ latitude: double('latitude'),
267
+ longitude: double('longitude'),
268
+ viewCount: int('view_count'),
269
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
270
+ govId: int('gov_id').notNull(),
271
+ districtId: int('district_id').notNull(),
272
+ subDistrictId: int('sub_district_id'),
273
+ townId: int('town_id')
274
+ });
275
+
276
+
277
+ export const CatsTable = mysqlTable('cats', {
278
+ id: int('id').autoincrement().notNull().primaryKey(),
279
+ catOrder: int('cat_order').notNull(),
280
+ slug: varchar('slug', { length: 255 }).notNull(),
281
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
282
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
283
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
284
+ fullTitleEn: varchar('full_title_en', { length: 255 }),
285
+ fullTitleAr: varchar('full_title_ar', { length: 255 }),
286
+ fullTitleTr: varchar('full_title_tr', { length: 255 }),
287
+ image: varchar('image', { length: 255 }),
288
+ metaDescEn: varchar('meta_desc_en', { length: 255 }),
289
+ metaDescAr: varchar('meta_desc_ar', { length: 255 }),
290
+ metaDescTr: varchar('meta_desc_tr', { length: 255 }),
291
+ filters: varchar('filters', { length: 255 }),
292
+ tableName: varchar('table_name', { length: 255 }).notNull(),
293
+ adCount: int('ad_count'),
294
+ parentId: int('parent_id'),
295
+ level: int('level')
296
+ });
297
+
298
+
299
+ export const CarsTable = mysqlTable('cars', {
300
+ id: int('id').autoincrement().notNull().primaryKey(),
301
+ modelYear: int('model_year').notNull(),
302
+ model: varchar('model', { length: 255 }).notNull(),
303
+ title: varchar('title', { length: 255 }).notNull(),
304
+ catId: int('cat_id').notNull(),
305
+ govId: int('gov_id').notNull(),
306
+ districtId: int('district_id').notNull(),
307
+ subDistrictId: int('sub_district_id'),
308
+ townId: int('town_id'),
309
+ price: int('price').notNull(),
310
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
311
+ condition: varchar('condition', { length: 255 }).notNull(),
312
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
313
+ engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
314
+ enginePower: varchar('engine_power', { length: 255 }).notNull(),
315
+ tractionType: varchar('traction_type', { length: 255 }).notNull(),
316
+ bodyType: varchar('body_type', { length: 255 }).notNull(),
317
+ gearType: varchar('gear_type', { length: 255 }).notNull(),
318
+ fuelType: varchar('fuel_type', { length: 255 }).notNull(),
319
+ exchangeable: boolean('exchangeable'),
320
+ installments: boolean('installments'),
321
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
322
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
323
+ desc: longtext('desc'),
324
+ latitude: double('latitude'),
325
+ longitude: double('longitude'),
326
+ viewCount: int('view_count'),
327
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
328
+ });
329
+
330
+
331
+ export const CarsDbTable = mysqlTable('cars_db', {
332
+ id: int('id').autoincrement().notNull().primaryKey(),
333
+ name: varchar('name', { length: 255 }).notNull(),
334
+ parentId: int('parent_id'),
335
+ level: int('level')
336
+ });
337
+
338
+
339
+ export const BooksTable = mysqlTable('books', {
340
+ id: int('id').autoincrement().notNull().primaryKey(),
341
+ title: varchar('title', { length: 255 }).notNull(),
342
+ catId: int('cat_id').notNull(),
343
+ condition: varchar('condition', { length: 255 }).notNull(),
344
+ price: int('price').notNull(),
345
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
346
+ exchangeable: boolean('exchangeable'),
347
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
348
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
349
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
350
+ desc: longtext('desc'),
351
+ latitude: double('latitude'),
352
+ longitude: double('longitude'),
353
+ viewCount: int('view_count'),
354
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
355
+ govId: int('gov_id').notNull(),
356
+ districtId: int('district_id').notNull(),
357
+ subDistrictId: int('sub_district_id'),
358
+ townId: int('town_id')
359
+ });
360
+
361
+
362
+ export const AddressTable = mysqlTable('address', {
363
+ id: int('id').autoincrement().notNull().primaryKey(),
364
+ catOrder: int('cat_order').notNull(),
365
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
366
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
367
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
368
+ image: varchar('image', { length: 255 }),
369
+ path: varchar('path', { length: 255 }),
370
+ parentId: int('parent_id'),
371
+ level: int('level')
372
+ });
373
+
@@ -0,0 +1,130 @@
1
+ import * as z from 'zod'
2
+ import { object } from 'zod';
3
+
4
+ function createEnv$1(opts) {
5
+ const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
6
+ const emptyStringAsUndefined = opts.emptyStringAsUndefined ?? false;
7
+ if (emptyStringAsUndefined) {
8
+ for (const [key, value] of Object.entries(runtimeEnv)){
9
+ if (value === "") {
10
+ delete runtimeEnv[key];
11
+ }
12
+ }
13
+ }
14
+ const skip = !!opts.skipValidation;
15
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
16
+ if (skip) return runtimeEnv;
17
+ const _client = typeof opts.client === "object" ? opts.client : {};
18
+ const _server = typeof opts.server === "object" ? opts.server : {};
19
+ const _shared = typeof opts.shared === "object" ? opts.shared : {};
20
+ const client = object(_client);
21
+ const server = object(_server);
22
+ const shared = object(_shared);
23
+ const isServer = opts.isServer ?? (typeof window === "undefined" || "Deno" in window);
24
+ const allClient = client.merge(shared);
25
+ const allServer = server.merge(shared).merge(client);
26
+ const parsed = isServer ? allServer.safeParse(runtimeEnv) // on server we can validate all env vars
27
+ : allClient.safeParse(runtimeEnv); // on client we can only validate the ones that are exposed
28
+ const onValidationError = opts.onValidationError ?? ((error)=>{
29
+ console.error("❌ Invalid environment variables:", error.flatten().fieldErrors);
30
+ throw new Error("Invalid environment variables");
31
+ });
32
+ const onInvalidAccess = opts.onInvalidAccess ?? ((_variable)=>{
33
+ throw new Error("❌ Attempted to access a server-side environment variable on the client");
34
+ });
35
+ if (parsed.success === false) {
36
+ return onValidationError(parsed.error);
37
+ }
38
+ const isServerAccess = (prop)=>{
39
+ if (!opts.clientPrefix) return true;
40
+ return !prop.startsWith(opts.clientPrefix) && !(prop in shared.shape);
41
+ };
42
+ const isValidServerAccess = (prop)=>{
43
+ return isServer || !isServerAccess(prop);
44
+ };
45
+ const ignoreProp = (prop)=>{
46
+ return prop === "__esModule" || prop === "$$typeof";
47
+ };
48
+ const extendedObj = (opts.extends ?? []).reduce((acc, curr)=>{
49
+ return Object.assign(acc, curr);
50
+ }, {});
51
+ const fullObj = Object.assign(parsed.data, extendedObj);
52
+ const env = new Proxy(fullObj, {
53
+ get (target, prop) {
54
+ if (typeof prop !== "string") return undefined;
55
+ if (ignoreProp(prop)) return undefined;
56
+ if (!isValidServerAccess(prop)) return onInvalidAccess(prop);
57
+ return Reflect.get(target, prop);
58
+ }
59
+ });
60
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
61
+ return env;
62
+ }
63
+
64
+ const CLIENT_PREFIX = "NEXT_PUBLIC_";
65
+ function createEnv(opts) {
66
+ const client = typeof opts.client === "object" ? opts.client : {};
67
+ const server = typeof opts.server === "object" ? opts.server : {};
68
+ const shared = opts.shared;
69
+ const runtimeEnv = opts.runtimeEnv ? opts.runtimeEnv : {
70
+ ...process.env,
71
+ ...opts.experimental__runtimeEnv
72
+ };
73
+ return createEnv$1({
74
+ ...opts,
75
+ shared,
76
+ client,
77
+ server,
78
+ clientPrefix: CLIENT_PREFIX,
79
+ runtimeEnv
80
+ });
81
+ }
82
+
83
+ export const env = createEnv({
84
+ /**
85
+ * Specify your server-side environment variables schema here. This way you can ensure the app
86
+ * isn't built with invalid env vars.
87
+ */
88
+ server: {
89
+ ACCESS_TOKEN_SECRET: z.string(),
90
+ REFRESH_TOKEN_SECRET: z.string(),
91
+ CSRF_TOKEN_SECRET: z.string(),
92
+ ACCESS_TOKEN_EXPIRATION: z.string(),
93
+ REFRESH_TOKEN_EXPIRATION: z.string(),
94
+ NODE_ENV: z
95
+ .enum(["development", "test", "production"])
96
+ .default("development"),
97
+ },
98
+
99
+ /**
100
+ * Specify your client-side environment variables schema here. This way you can ensure the app
101
+ * isn't built with invalid env vars. To expose them to the client, prefix them with
102
+ * `NEXT_PUBLIC_`.
103
+ */
104
+ client: {
105
+ NEXT_PUBLIC_RICHTEXT_INLINE_PUBLIC_URL: z.string().optional(),
106
+ },
107
+
108
+ /**
109
+ * You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
110
+ * middlewares) or client-side so we need to destruct manually.
111
+ */
112
+ runtimeEnv: {
113
+ ACCESS_TOKEN_SECRET: process.env.ACCESS_TOKEN_SECRET,
114
+ REFRESH_TOKEN_SECRET: process.env.REFRESH_TOKEN_SECRET,
115
+ CSRF_TOKEN_SECRET: process.env.CSRF_TOKEN_SECRET,
116
+ ACCESS_TOKEN_EXPIRATION: process.env.ACCESS_TOKEN_EXPIRATION,
117
+ REFRESH_TOKEN_EXPIRATION: process.env.REFRESH_TOKEN_EXPIRATION,
118
+ NODE_ENV: process.env.NODE_ENV,
119
+ },
120
+ /**
121
+ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
122
+ * useful for Docker builds.
123
+ */
124
+ skipValidation: !!process.env.SKIP_ENV_VALIDATION,
125
+ /**
126
+ * Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
127
+ * `SOME_VAR=''` will throw an error.
128
+ */
129
+ emptyStringAsUndefined: true,
130
+ });
@@ -0,0 +1,4 @@
1
+ import { loadEnvConfig } from '@next/env'
2
+
3
+ const projectDir = process.cwd()
4
+ loadEnvConfig(projectDir)
@@ -0,0 +1,8 @@
1
+ import { useContext } from 'react'
2
+ import ModalContext from '@/context/ModalProvider'
3
+
4
+ const useModal = () => {
5
+ return useContext(ModalContext)
6
+ }
7
+
8
+ export default useModal
@@ -0,0 +1,106 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ import type { AxiosError } from 'axios'
3
+ import type { AdminDetails, NewVariantPageRequestResponse, VariantEditPageRequestResponse } from 'nextjs-cms/core/types'
4
+
5
+ export const handleVariantDeletion = async (
6
+ variant: string,
7
+ id: string,
8
+ axiosPrivate: AxiosInstance,
9
+ controller?: AbortController,
10
+ ): Promise<any> => {
11
+ try {
12
+ const res = await axiosPrivate.post(
13
+ `/api-variant-delete`,
14
+ { variant: variant, id: id },
15
+ {
16
+ signal: controller?.signal,
17
+ headers: {
18
+ 'Content-Type': 'application/x-www-form-urlencoded',
19
+ },
20
+ },
21
+ )
22
+ return res.data
23
+ } catch (error: AxiosError | any) {
24
+ return error?.response?.data
25
+ }
26
+ }
27
+
28
+ export async function getNewVariantPage(
29
+ section: string,
30
+ variant: string,
31
+ axiosPrivate: AxiosInstance,
32
+ controller?: AbortController,
33
+ ): Promise<NewVariantPageRequestResponse | null> {
34
+ try {
35
+ const res = await axiosPrivate.get(`/api-variant-new?section=${section}&variant=${variant}`, {
36
+ signal: controller?.signal,
37
+ })
38
+ return res.data
39
+ } catch (error) {
40
+ return null
41
+ }
42
+ }
43
+
44
+ export async function getVariantPage(
45
+ section: string,
46
+ variant: string,
47
+ sectionItemId: string,
48
+ id: string,
49
+ axiosPrivate: AxiosInstance,
50
+ controller?: AbortController,
51
+ ): Promise<VariantEditPageRequestResponse | null> {
52
+ try {
53
+ const res = await axiosPrivate.get(
54
+ `/api-variant-edit?section=${section}&variant=${variant}&sectionItemId=${sectionItemId}&id=${id}`,
55
+ {
56
+ signal: controller?.signal,
57
+ },
58
+ )
59
+ return res.data
60
+ } catch (error: AxiosError | any) {
61
+ return error.response.data
62
+ }
63
+ }
64
+
65
+ export const getAnalytics = async ({
66
+ requestType,
67
+ axiosPrivate,
68
+ controller,
69
+ fromDate,
70
+ toDate,
71
+ }: {
72
+ requestType: string
73
+ axiosPrivate: AxiosInstance
74
+ controller?: AbortController
75
+ fromDate?: Date | string | null
76
+ toDate?: Date | string | null
77
+ }) => {
78
+ return null
79
+ try {
80
+ const res = await axiosPrivate.get('/api-g-a', {
81
+ params: {
82
+ requestType: requestType,
83
+ fromDate: fromDate,
84
+ toDate: toDate,
85
+ },
86
+ signal: controller?.signal,
87
+ })
88
+ return res.data
89
+ } catch (error) {
90
+ return null
91
+ }
92
+ }
93
+
94
+ export async function getLog(axiosPrivate: AxiosInstance, controller?: AbortController): Promise<AdminDetails> {
95
+ try {
96
+ const res = await axiosPrivate.get(`/api-log`, {
97
+ signal: controller?.signal,
98
+ headers: {
99
+ 'Content-Type': 'application/x-www-form-urlencoded',
100
+ },
101
+ })
102
+ return res.data
103
+ } catch (error: AxiosError | any) {
104
+ return error?.response?.data
105
+ }
106
+ }
@@ -0,0 +1,40 @@
1
+ import type { CMSConfig } from 'nextjs-cms/core/config'
2
+ import process from 'process'
3
+ import { resolve } from 'path'
4
+
5
+ export const config: CMSConfig = {
6
+ sectionsFolder: resolve(process.cwd(), 'sections'),
7
+ siteName: 'NEXT CMS Admin',
8
+ theme: 'dark',
9
+ files: {
10
+ upload: {
11
+ keepFileExtension: true,
12
+ uploadPath:
13
+ process.env.NODE_ENV === 'development'
14
+ ? 'D:/Work/WebstormProjects/turbo-expo-next/apps/web/public/content/'
15
+ : '/home2/syriasell/public_html/assets/content',
16
+ },
17
+ images: {
18
+ thumbnail: {
19
+ width: 400,
20
+ height: 209,
21
+ crop: true,
22
+ quality: 80,
23
+ },
24
+ watermark: false,
25
+ },
26
+ },
27
+ sections: {
28
+ category: {
29
+ allowRecursiveDelete: true,
30
+ },
31
+ },
32
+ db: {
33
+ schemaNamingConvention: {
34
+ tableCaseStyle: 'pascalCase',
35
+ columnCaseStyle: 'camelCase',
36
+ },
37
+ },
38
+ debug: true,
39
+ strict: false,
40
+ }