create-nextjs-cms 0.5.89 → 0.5.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextjs-cms",
3
- "version": "0.5.89",
3
+ "version": "0.5.91",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,8 +29,8 @@
29
29
  "tsx": "^4.20.6",
30
30
  "typescript": "^5.9.2",
31
31
  "@lzcms/eslint-config": "0.3.0",
32
- "@lzcms/prettier-config": "0.1.0",
33
- "@lzcms/tsconfig": "0.1.0"
32
+ "@lzcms/tsconfig": "0.1.0",
33
+ "@lzcms/prettier-config": "0.1.0"
34
34
  },
35
35
  "prettier": "@lzcms/prettier-config",
36
36
  "scripts": {
@@ -1,23 +1,49 @@
1
- import { NextRequest } from 'next/server'
2
- import auth from 'nextjs-cms/auth'
3
- import { deleteSession, login } from 'nextjs-cms/auth/actions'
4
-
5
- export async function POST(request: NextRequest) {
6
- const { username, password } = await request.json()
7
- try {
8
- const loginResult = await login({ username, password })
9
- return Response.json(loginResult, { status: 200 })
10
- } catch (error: any) {
11
- return Response.json({ error: error.message }, { status: 400 })
12
- }
13
- }
14
-
15
- export async function DELETE() {
16
- const session = await auth()
17
- try {
18
- const loginResult = await deleteSession(session)
19
- return Response.json(loginResult, { status: 200 })
20
- } catch (error: any) {
21
- return Response.json({ error: error.message }, { status: 400 })
22
- }
23
- }
1
+ import { NextRequest } from 'next/server'
2
+ import auth from 'nextjs-cms/auth'
3
+ import { deleteSession, login } from 'nextjs-cms/auth/actions'
4
+ import { getRequestMetadataFromHeaders, recordLog } from 'nextjs-cms/logging'
5
+
6
+ export async function POST(request: NextRequest) {
7
+ const { username, password } = await request.json()
8
+ try {
9
+ const loginResult = await login({ username, password })
10
+ const requestMetadata = getRequestMetadataFromHeaders(request.headers)
11
+
12
+ await recordLog({
13
+ eventType: 'auth.login',
14
+ actorId: loginResult.user?.id ?? null,
15
+ actorUsername: loginResult.user?.username ?? null,
16
+ entityType: 'admin',
17
+ entityId: loginResult.user?.id ?? null,
18
+ entityLabel: loginResult.user?.username ?? null,
19
+ sectionName: 'auth',
20
+ requestMetadata,
21
+ })
22
+ return Response.json(loginResult, { status: 200 })
23
+ } catch (error: any) {
24
+ return Response.json({ error: error.message }, { status: 400 })
25
+ }
26
+ }
27
+
28
+ export async function DELETE(request: NextRequest) {
29
+ const session = await auth()
30
+ try {
31
+ const loginResult = await deleteSession(session)
32
+ if (session?.user?.id) {
33
+ const requestMetadata = getRequestMetadataFromHeaders(request.headers)
34
+ await recordLog({
35
+ eventType: 'auth.logout',
36
+ actorId: session.user.id,
37
+ actorUsername: session.user.name ?? null,
38
+ entityType: 'admin',
39
+ entityId: session.user.id,
40
+ entityLabel: session.user.name ?? null,
41
+ sectionName: 'auth',
42
+ requestMetadata,
43
+ })
44
+ }
45
+ return Response.json(loginResult, { status: 200 })
46
+ } catch (error: any) {
47
+ return Response.json({ error: error.message }, { status: 400 })
48
+ }
49
+ }
@@ -1,6 +1,7 @@
1
- import { NextRequest, NextResponse } from 'next/server'
2
- import { EditSubmit } from 'nextjs-cms/core/submit'
3
- import auth from 'nextjs-cms/auth'
1
+ import { NextRequest, NextResponse } from 'next/server'
2
+ import { EditSubmit } from 'nextjs-cms/core/submit'
3
+ import auth from 'nextjs-cms/auth'
4
+ import { getRequestMetadataFromHeaders } from 'nextjs-cms/logging'
4
5
 
5
6
  export async function PUT(request: NextRequest, { params }: { params: Promise<{ slug: string }> }) {
6
7
  const session = await auth()
@@ -24,9 +25,10 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
24
25
  )
25
26
  }
26
27
 
27
- const user = session.user
28
- const formData = await request.formData()
29
- const sectionName = formData.get('sectionName') as string | null
28
+ const user = session.user
29
+ const formData = await request.formData()
30
+ const sectionName = formData.get('sectionName') as string | null
31
+ const requestMetadata = getRequestMetadataFromHeaders(request.headers)
30
32
 
31
33
  if (!sectionName) {
32
34
  return NextResponse.json(
@@ -37,12 +39,13 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
37
39
  )
38
40
  }
39
41
 
40
- const submit = new EditSubmit({
41
- itemId: itemId as string,
42
- sectionName,
43
- user,
44
- postData: formData,
45
- })
42
+ const submit = new EditSubmit({
43
+ itemId: itemId as string,
44
+ sectionName,
45
+ user,
46
+ postData: formData,
47
+ requestMetadata,
48
+ })
46
49
 
47
50
  await submit.initialize()
48
51
  await submit.submit()
@@ -1,6 +1,7 @@
1
- import { NextRequest, NextResponse } from 'next/server'
2
- import { NewSubmit } from 'nextjs-cms/core/submit'
3
- import auth from 'nextjs-cms/auth'
1
+ import { NextRequest, NextResponse } from 'next/server'
2
+ import { NewSubmit } from 'nextjs-cms/core/submit'
3
+ import auth from 'nextjs-cms/auth'
4
+ import { getRequestMetadataFromHeaders } from 'nextjs-cms/logging'
4
5
 
5
6
  export async function POST(request: NextRequest) {
6
7
  const session = await auth()
@@ -14,9 +15,10 @@ export async function POST(request: NextRequest) {
14
15
  )
15
16
  }
16
17
 
17
- const user = session.user
18
- const formData = await request.formData()
19
- const sectionName = formData.get('sectionName') as string | null
18
+ const user = session.user
19
+ const formData = await request.formData()
20
+ const sectionName = formData.get('sectionName') as string | null
21
+ const requestMetadata = getRequestMetadataFromHeaders(request.headers)
20
22
 
21
23
  if (!sectionName) {
22
24
  return NextResponse.json(
@@ -27,11 +29,12 @@ export async function POST(request: NextRequest) {
27
29
  )
28
30
  }
29
31
 
30
- const submit = new NewSubmit({
31
- sectionName,
32
- user,
33
- postData: formData,
34
- })
32
+ const submit = new NewSubmit({
33
+ sectionName,
34
+ user,
35
+ postData: formData,
36
+ requestMetadata,
37
+ })
35
38
 
36
39
  await submit.initialize()
37
40
  await submit.submit()
@@ -1,6 +1,7 @@
1
- import { NextRequest, NextResponse } from 'next/server'
2
- import { SimpleSectionSubmit } from 'nextjs-cms/core/submit'
3
- import auth from 'nextjs-cms/auth'
1
+ import { NextRequest, NextResponse } from 'next/server'
2
+ import { SimpleSectionSubmit } from 'nextjs-cms/core/submit'
3
+ import auth from 'nextjs-cms/auth'
4
+ import { getRequestMetadataFromHeaders } from 'nextjs-cms/logging'
4
5
 
5
6
  export async function PUT(request: NextRequest) {
6
7
  const session = await auth()
@@ -14,9 +15,10 @@ export async function PUT(request: NextRequest) {
14
15
  )
15
16
  }
16
17
 
17
- const user = session.user
18
- const formData = await request.formData()
19
- const sectionName = formData.get('sectionName') as string | null
18
+ const user = session.user
19
+ const formData = await request.formData()
20
+ const sectionName = formData.get('sectionName') as string | null
21
+ const requestMetadata = getRequestMetadataFromHeaders(request.headers)
20
22
 
21
23
  if (!sectionName) {
22
24
  return NextResponse.json(
@@ -27,12 +29,13 @@ export async function PUT(request: NextRequest) {
27
29
  )
28
30
  }
29
31
 
30
- const submit = new SimpleSectionSubmit({
31
- itemId: '1',
32
- sectionName,
33
- user,
34
- postData: formData,
35
- })
32
+ const submit = new SimpleSectionSubmit({
33
+ itemId: '1',
34
+ sectionName,
35
+ user,
36
+ postData: formData,
37
+ requestMetadata,
38
+ })
36
39
 
37
40
  await submit.initialize()
38
41
  await submit.submit()
@@ -1,15 +1,92 @@
1
- 'use client'
2
-
3
- import getString from 'nextjs-cms/translations'
4
-
5
- export default function LogPage() {
6
- return (
7
- <div className='w-full'>
8
- <div className='text-foreground bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold dark:from-blue-800 dark:via-amber-700 dark:to-rose-900'>
9
- <h1 className='text-3xl'>{getString('logs')}</h1>
10
- </div>
11
-
12
- <div className='flex flex-col gap-2 p-4'></div>
13
- </div>
14
- )
15
- }
1
+ 'use client'
2
+
3
+ import getString from 'nextjs-cms/translations'
4
+ import { trpc } from '@/app/_trpc/client'
5
+ import { Badge } from '@/components/ui/badge'
6
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
7
+
8
+ type LogMetadata = {
9
+ fields?: string[]
10
+ previousUsername?: string
11
+ newUsername?: string
12
+ }
13
+
14
+ const formatTimestamp = (value: Date | string | null) => {
15
+ if (!value) return ''
16
+ const date = value instanceof Date ? value : new Date(value)
17
+ if (Number.isNaN(date.getTime())) return ''
18
+ return date.toLocaleString()
19
+ }
20
+
21
+ const parseMetadata = (metadata?: string | null): LogMetadata | null => {
22
+ if (!metadata) return null
23
+ try {
24
+ return JSON.parse(metadata) as LogMetadata
25
+ } catch (error) {
26
+ return null
27
+ }
28
+ }
29
+
30
+ export default function LogPage() {
31
+ const [data] = trpc.logs.list.useSuspenseQuery({
32
+ limit: 50,
33
+ offset: 0,
34
+ })
35
+
36
+ const logs = data?.items ?? []
37
+ return (
38
+ <div className='w-full'>
39
+ <div className='text-foreground bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold dark:from-blue-800 dark:via-amber-700 dark:to-rose-900'>
40
+ <h1 className='text-3xl'>{getString('logs')}</h1>
41
+ </div>
42
+
43
+ <div className='flex flex-col gap-4 p-4'>
44
+ <Table>
45
+ <TableHeader>
46
+ <TableRow>
47
+ <TableHead>{getString('date')}</TableHead>
48
+ <TableHead>{getString('action')}</TableHead>
49
+ <TableHead>{getString('admin')}</TableHead>
50
+ <TableHead>{getString('section')}</TableHead>
51
+ <TableHead>{getString('details')}</TableHead>
52
+ </TableRow>
53
+ </TableHeader>
54
+ <TableBody>
55
+ {logs.length === 0 ? (
56
+ <TableRow>
57
+ <TableCell colSpan={5} className='text-muted-foreground text-center'>
58
+ {getString('no_data')}
59
+ </TableCell>
60
+ </TableRow>
61
+ ) : (
62
+ logs.map((log) => {
63
+ const metadata = parseMetadata(log.metadata)
64
+ const fields = metadata?.fields?.length ? metadata.fields.join(', ') : null
65
+ const usernameChange =
66
+ metadata?.previousUsername && metadata?.newUsername
67
+ ? `${metadata.previousUsername} -> ${metadata.newUsername}`
68
+ : null
69
+
70
+ return (
71
+ <TableRow key={log.id}>
72
+ <TableCell>{formatTimestamp(log.createdAt)}</TableCell>
73
+ <TableCell>
74
+ <Badge variant='outline'>{log.eventType}</Badge>
75
+ </TableCell>
76
+ <TableCell>{log.actorUsername || log.actorId || '-'}</TableCell>
77
+ <TableCell>{log.sectionName || '-'}</TableCell>
78
+ <TableCell className='text-muted-foreground'>
79
+ {log.entityLabel || log.entityId || '-'}
80
+ {fields ? ` | ${fields}` : ''}
81
+ {usernameChange ? ` | ${usernameChange}` : ''}
82
+ </TableCell>
83
+ </TableRow>
84
+ )
85
+ })
86
+ )}
87
+ </TableBody>
88
+ </Table>
89
+ </div>
90
+ </div>
91
+ )
92
+ }
@@ -4,7 +4,9 @@ import { MoonIcon, SunIcon, BellIcon, HamburgerMenuIcon } from '@radix-ui/react-
4
4
  import { useTheme } from 'next-themes'
5
5
  import Link from 'next/link'
6
6
  import getString from 'nextjs-cms/translations'
7
+ import { trpc } from '@/app/_trpc/client'
7
8
  import ProtectedImage from '@/components/ProtectedImage'
9
+ import { Spinner } from '@/components/spinner'
8
10
  import Image from 'next/image'
9
11
  import { LogOut, Settings } from 'lucide-react'
10
12
 
@@ -29,10 +31,34 @@ type Props = {
29
31
  onMenuButtonClick(): void
30
32
  }
31
33
 
34
+ const formatTimestamp = (value?: Date | string | null) => {
35
+ if (!value) return ''
36
+ const date = value instanceof Date ? value : new Date(value)
37
+ if (Number.isNaN(date.getTime())) return ''
38
+ return date.toLocaleString()
39
+ }
40
+
32
41
  export default function Navbar(props: Props) {
33
42
  const { theme, setTheme } = useTheme()
34
43
  const session = useSession()
35
44
  const { toast } = useToast()
45
+ const logsQuery = trpc.logs.list.useQuery(
46
+ {
47
+ limit: 20,
48
+ offset: 0,
49
+ },
50
+ {
51
+ enabled: false,
52
+ },
53
+ )
54
+
55
+ const handleNotificationsOpenChange = (open: boolean) => {
56
+ if (open) {
57
+ void logsQuery.refetch()
58
+ }
59
+ }
60
+
61
+ const logs = logsQuery.data?.items ?? []
36
62
  const handleLogout = async (e: React.MouseEvent<HTMLDivElement>) => {
37
63
  e.preventDefault()
38
64
  e.stopPropagation()
@@ -85,17 +111,61 @@ export default function Navbar(props: Props) {
85
111
  <div className=''>
86
112
  <div className='ml-4 flex items-center md:ml-6'>
87
113
  <div className='flex flex-row items-center gap-3'>
88
- <DropdownMenu>
114
+ <DropdownMenu onOpenChange={handleNotificationsOpenChange}>
89
115
  <DropdownMenuTrigger
90
116
  asChild
91
117
  className='text-foreground hover:text-foreground/90 cursor-pointer'
92
118
  >
93
119
  <BellIcon className='h-6 w-6' />
94
120
  </DropdownMenuTrigger>
95
- <DropdownMenuContent className='mt-2 w-[300px]'>
121
+ <DropdownMenuContent
122
+ sideOffset={20}
123
+ align='end'
124
+ side='bottom'
125
+ alignOffset={-20}
126
+ className='w-[400px] max-w-full ring-1 ring-sky-400/80 dark:ring-amber-900'
127
+ >
96
128
  <DropdownMenuLabel>{getString('notifications')}</DropdownMenuLabel>
97
129
  <DropdownMenuSeparator />
98
- <DropdownMenuGroup></DropdownMenuGroup>
130
+ <DropdownMenuGroup className='max-h-[320px] overflow-y-auto'>
131
+ {logsQuery.isFetching && logs.length === 0 ? (
132
+ <DropdownMenuItem disabled className='flex items-center gap-2'>
133
+ <Spinner className='size-3' />
134
+ <span>{getString('loading')}</span>
135
+ </DropdownMenuItem>
136
+ ) : logsQuery.isError ? (
137
+ <DropdownMenuItem disabled>
138
+ {getString('server_error')}
139
+ </DropdownMenuItem>
140
+ ) : logs.length === 0 ? (
141
+ <DropdownMenuItem disabled>{getString('no_data')}</DropdownMenuItem>
142
+ ) : (
143
+ logs.map((log) => {
144
+ const actorLabel = log.actorUsername || log.actorId || ''
145
+ const contextLabel = log.entityLabel || log.sectionName || ''
146
+ const timestamp = formatTimestamp(log.createdAt)
147
+ const detailParts: string[] = []
148
+ if (actorLabel) detailParts.push(actorLabel)
149
+ if (contextLabel) detailParts.push(contextLabel)
150
+ if (timestamp) detailParts.push(timestamp)
151
+ const details = detailParts.join(' | ') || '-'
152
+
153
+ return (
154
+ <DropdownMenuItem
155
+ key={log.id}
156
+ className='flex flex-col items-start gap-1 py-2'
157
+ >
158
+ <span className='w-full truncate text-sm font-medium'>
159
+ {log.eventType}
160
+ </span>
161
+ <span className='text-muted-foreground w-full truncate text-xs'>
162
+ {details}
163
+ </span>
164
+ </DropdownMenuItem>
165
+ )
166
+ })
167
+ )}
168
+ </DropdownMenuGroup>
99
169
  <DropdownMenuSeparator />
100
170
 
101
171
  <Link href='/log'>
@@ -137,7 +207,13 @@ export default function Navbar(props: Props) {
137
207
  )}
138
208
  </div>
139
209
  </DropdownMenuTrigger>
140
- <DropdownMenuContent className='w-56'>
210
+ <DropdownMenuContent
211
+ sideOffset={12}
212
+ align='end'
213
+ side='bottom'
214
+ alignOffset={-10}
215
+ className='w-56 max-w-full ring-1 ring-sky-400/80 dark:ring-amber-900'
216
+ >
141
217
  <DropdownMenuLabel>{session.data?.user.name}</DropdownMenuLabel>
142
218
  <DropdownMenuSeparator />
143
219
  <DropdownMenuGroup>
@@ -1,381 +1,381 @@
1
- import {mysqlTable,int,longtext,mysqlEnum,varchar,boolean,double,timestamp} from 'drizzle-orm/mysql-core'
2
-
3
- export const AppInfoTable = mysqlTable('app_info', {
4
- id: int('id').autoincrement().notNull().primaryKey(),
5
- aboutEn: longtext('about_en').notNull(),
6
- aboutAr: longtext('about_ar').notNull(),
7
- aboutTr: longtext('about_tr').notNull(),
8
- privacyEn: longtext('privacy_en').notNull(),
9
- privacyAr: longtext('privacy_ar').notNull(),
10
- privacyTr: longtext('privacy_tr').notNull()
11
- });
12
-
13
-
14
- export const UserReportsTable = mysqlTable('user_reports', {
15
- id: int('id').autoincrement().notNull().primaryKey(),
16
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
17
- reportType: mysqlEnum('report_type', ['explicit_content', 'wrong_information', 'no_longer_available', 'user_not_responsive', 'other']).notNull(),
18
- contentId: int('content_id').notNull(),
19
- catId: int('cat_id').notNull(),
20
- userId: int('user_id'),
21
- appId: varchar('app_id', { length: 36 }).notNull()
22
- });
23
-
24
-
25
- export const FeaturedSliderTable = mysqlTable('featured_slider', {
26
- id: int('id').autoincrement().notNull().primaryKey(),
27
- image: varchar('image', { length: 255 }).notNull(),
28
- titleEn: varchar('title_en', { length: 255 }).notNull(),
29
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
30
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
31
- descEn: longtext('desc_en').notNull(),
32
- descAr: longtext('desc_ar').notNull(),
33
- descTr: longtext('desc_tr').notNull()
34
- });
35
-
36
-
37
- export const MenuSettingsTable = mysqlTable('menu_settings', {
38
- id: int('id').autoincrement().notNull().primaryKey(),
39
- taxRate: varchar('tax_rate', { length: 255 }),
40
- hideSlider: boolean('hide_slider')
41
- });
42
-
43
-
44
- export const ServicesTable = mysqlTable('services', {
45
- id: int('id').autoincrement().notNull().primaryKey(),
46
- title: varchar('title', { length: 255 }).notNull(),
47
- catId: int('cat_id').notNull(),
48
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
49
- price: int('price'),
50
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
51
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
52
- desc: longtext('desc'),
53
- latitude: double('latitude'),
54
- longitude: double('longitude'),
55
- viewCount: int('view_count'),
56
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
57
- govId: int('gov_id').notNull(),
58
- districtId: int('district_id').notNull(),
59
- subDistrictId: int('sub_district_id'),
60
- townId: int('town_id')
61
- });
62
-
63
-
64
- export const RealestateTable = mysqlTable('realestate', {
65
- id: int('id').autoincrement().notNull().primaryKey(),
66
- catId: int('cat_id').notNull(),
67
- title: varchar('title', { length: 255 }).notNull(),
68
- price: int('price').notNull(),
69
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
70
- spaceGross: int('space_gross').notNull(),
71
- spaceNet: int('space_net').notNull(),
72
- latitude: double('latitude').notNull(),
73
- longitude: double('longitude').notNull(),
74
- roomCount: varchar('room_count', { length: 255 }),
75
- buildingAge: varchar('building_age', { length: 255 }),
76
- floorCount: varchar('floor_count', { length: 255 }),
77
- bathroomCount: varchar('bathroom_count', { length: 255 }),
78
- floorLocation: varchar('floor_location', { length: 255 }),
79
- heatingType: varchar('heating_type', { length: 255 }),
80
- kitchenType: varchar('kitchen_type', { length: 255 }),
81
- balcony: boolean('balcony'),
82
- lift: boolean('lift'),
83
- parkingType: varchar('parking_type', { length: 255 }),
84
- furnished: boolean('furnished'),
85
- belongsToSite: boolean('belongs_to_site'),
86
- siteName: varchar('site_name', { length: 255 }),
87
- installments: boolean('installments'),
88
- exchangeable: boolean('exchangeable'),
89
- fromWhom: varchar('from_whom', { length: 255 }),
90
- buildingMembershipFees: int('building_membership_fees'),
91
- deposit: int('deposit'),
92
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
93
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
94
- desc: longtext('desc'),
95
- viewCount: int('view_count'),
96
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
97
- govId: int('gov_id').notNull(),
98
- districtId: int('district_id').notNull(),
99
- subDistrictId: int('sub_district_id'),
100
- townId: int('town_id')
101
- });
102
-
103
-
104
- export const HomepageSliderTable = mysqlTable('homepage_slider', {
105
- id: int('id').autoincrement().notNull().primaryKey(),
106
- titleEn: varchar('title_en', { length: 255 }).notNull(),
107
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
108
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
109
- subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
110
- subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
111
- subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
112
- photo: varchar('photo', { length: 255 }).notNull(),
113
- buttonUrl: varchar('button_url', { length: 255 }),
114
- buttonTextEn: varchar('button_text_en', { length: 255 }),
115
- buttonTextAr: varchar('button_text_ar', { length: 255 }),
116
- buttonTextTr: varchar('button_text_tr', { length: 255 }),
117
- buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
118
- });
119
-
120
-
121
- export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
122
- id: int('id').autoincrement().notNull().primaryKey(),
123
- contestId: varchar('contest_id', { length: 255 }).notNull(),
124
- userId: int('user_id').notNull()
125
- });
126
-
127
-
128
- export const ContestsTable = mysqlTable('contests', {
129
- id: int('id').autoincrement().notNull().primaryKey(),
130
- date: timestamp('date').notNull(),
131
- prize: varchar('prize', { length: 255 }).notNull(),
132
- winnerId: int('winner_id'),
133
- tags: varchar('tags', { length: 255 })
134
- });
135
-
136
-
137
- export const NotificationsTable = mysqlTable('notifications', {
138
- id: int('id').autoincrement().notNull().primaryKey(),
139
- type: mysqlEnum('type', ['ad_price_updated', 'ad_updated', 'ad_activated', 'ad_pending_review', 'ad_expired', 'ad_rejected', 'ad_viewed', 'ad_favorited', 'ad_shared', 'ad_reported', 'ad_deleted', 'ad_created', 'contest_winner', 'contest_reminder', 'contest_created', 'custom']).notNull(),
140
- contentId: int('content_id'),
141
- contentCatId: int('content_cat_id'),
142
- userId: int('user_id'),
143
- message: varchar('message', { length: 255 })
144
- });
145
-
146
-
147
- export const ModerationTable = mysqlTable('moderation', {
148
- id: int('id').autoincrement().notNull().primaryKey(),
149
- contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
150
- contentId: int('content_id').notNull(),
151
- catId: int('cat_id'),
152
- userId: int('user_id').notNull(),
153
- flagged: int('flagged').notNull(),
154
- result: varchar('result', { length: 255 }).notNull()
155
- });
156
-
157
-
158
- export const JobsTable = mysqlTable('jobs', {
159
- id: int('id').autoincrement().notNull().primaryKey(),
160
- title: varchar('title', { length: 255 }).notNull(),
161
- catId: int('cat_id').notNull(),
162
- salary: int('salary'),
163
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
164
- workMethod: varchar('work_method', { length: 255 }).notNull(),
165
- minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
166
- experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
167
- remote: boolean('remote'),
168
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
169
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
170
- desc: longtext('desc'),
171
- latitude: double('latitude'),
172
- longitude: double('longitude'),
173
- viewCount: int('view_count'),
174
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
175
- govId: int('gov_id').notNull(),
176
- districtId: int('district_id').notNull(),
177
- subDistrictId: int('sub_district_id'),
178
- townId: int('town_id')
179
- });
180
-
181
-
182
- export const FurnitureTable = mysqlTable('furniture', {
183
- id: int('id').autoincrement().notNull().primaryKey(),
184
- title: varchar('title', { length: 255 }).notNull(),
185
- catId: int('cat_id').notNull(),
186
- condition: varchar('condition', { length: 255 }).notNull(),
187
- price: int('price').notNull(),
188
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
189
- exchangeable: boolean('exchangeable'),
190
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
191
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
192
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
193
- desc: longtext('desc'),
194
- latitude: double('latitude'),
195
- longitude: double('longitude'),
196
- viewCount: int('view_count'),
197
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
198
- govId: int('gov_id').notNull(),
199
- districtId: int('district_id').notNull(),
200
- subDistrictId: int('sub_district_id'),
201
- townId: int('town_id')
202
- });
203
-
204
-
205
- export const FiltersTable = mysqlTable('filters', {
206
- id: int('id').autoincrement().notNull().primaryKey(),
207
- title: varchar('title', { length: 255 }).notNull(),
208
- Key: varchar('_key', { length: 255 }).notNull(),
209
- fieldName: varchar('field_name', { length: 255 }).notNull(),
210
- type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
211
- tableName: varchar('table_name', { length: 255 }),
212
- isMandatory: boolean('is_mandatory')
213
- });
214
-
215
-
216
- export const FaqTable = mysqlTable('faq', {
217
- id: int('id').autoincrement().notNull().primaryKey(),
218
- qEn: varchar('q_en', { length: 255 }).notNull(),
219
- qAr: varchar('q_ar', { length: 255 }).notNull(),
220
- qTr: varchar('q_tr', { length: 255 }),
221
- aEn: longtext('a_en').notNull(),
222
- aAr: longtext('a_ar'),
223
- aTr: longtext('a_tr')
224
- });
225
-
226
-
227
- export const ErrorsTable = mysqlTable('errors', {
228
- id: int('id').autoincrement().notNull().primaryKey(),
229
- title: varchar('title', { length: 255 }).notNull(),
230
- caseId: varchar('case_id', { length: 255 }).notNull(),
231
- userId: int('user_id'),
232
- itemSlug: varchar('item_slug', { length: 255 }),
233
- desc: longtext('desc'),
234
- isResolved: boolean('is_resolved')
235
- });
236
-
237
-
238
- export const ElectronicsTable = mysqlTable('electronics', {
239
- id: int('id').autoincrement().notNull().primaryKey(),
240
- title: varchar('title', { length: 255 }).notNull(),
241
- catId: int('cat_id').notNull(),
242
- condition: varchar('condition', { length: 255 }).notNull(),
243
- price: int('price').notNull(),
244
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
245
- exchangeable: boolean('exchangeable'),
246
- installments: boolean('installments'),
247
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
248
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
249
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
250
- desc: longtext('desc'),
251
- latitude: double('latitude'),
252
- longitude: double('longitude'),
253
- viewCount: int('view_count'),
254
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
255
- govId: int('gov_id').notNull(),
256
- districtId: int('district_id').notNull(),
257
- subDistrictId: int('sub_district_id'),
258
- townId: int('town_id')
259
- });
260
-
261
-
262
- export const ClothesTable = mysqlTable('clothes', {
263
- id: int('id').autoincrement().notNull().primaryKey(),
264
- title: varchar('title', { length: 255 }).notNull(),
265
- catId: int('cat_id').notNull(),
266
- condition: varchar('condition', { length: 255 }).notNull(),
267
- price: int('price').notNull(),
268
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
269
- exchangeable: boolean('exchangeable'),
270
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
271
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
272
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
273
- desc: longtext('desc'),
274
- latitude: double('latitude'),
275
- longitude: double('longitude'),
276
- viewCount: int('view_count'),
277
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
278
- govId: int('gov_id').notNull(),
279
- districtId: int('district_id').notNull(),
280
- subDistrictId: int('sub_district_id'),
281
- townId: int('town_id')
282
- });
283
-
284
-
285
- export const CatsTable = mysqlTable('cats', {
286
- id: int('id').autoincrement().notNull().primaryKey(),
287
- catOrder: int('cat_order').notNull(),
288
- slug: varchar('slug', { length: 255 }).notNull(),
289
- titleEn: varchar('title_en', { length: 255 }).notNull(),
290
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
291
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
292
- fullTitleEn: varchar('full_title_en', { length: 255 }),
293
- fullTitleAr: varchar('full_title_ar', { length: 255 }),
294
- fullTitleTr: varchar('full_title_tr', { length: 255 }),
295
- image: varchar('image', { length: 255 }),
296
- metaDescEn: varchar('meta_desc_en', { length: 255 }),
297
- metaDescAr: varchar('meta_desc_ar', { length: 255 }),
298
- metaDescTr: varchar('meta_desc_tr', { length: 255 }),
299
- filters: varchar('filters', { length: 255 }),
300
- tableName: varchar('table_name', { length: 255 }).notNull(),
301
- adCount: int('ad_count'),
302
- parentId: int('parent_id'),
303
- level: int('level')
304
- });
305
-
306
-
307
- export const CarsTable = mysqlTable('cars', {
308
- id: int('id').autoincrement().notNull().primaryKey(),
309
- modelYear: int('model_year').notNull(),
310
- model: varchar('model', { length: 255 }).notNull(),
311
- title: varchar('title', { length: 255 }).notNull(),
312
- catId: int('cat_id').notNull(),
313
- govId: int('gov_id').notNull(),
314
- districtId: int('district_id').notNull(),
315
- subDistrictId: int('sub_district_id'),
316
- townId: int('town_id'),
317
- price: int('price').notNull(),
318
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
319
- condition: varchar('condition', { length: 255 }).notNull(),
320
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
321
- engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
322
- enginePower: varchar('engine_power', { length: 255 }).notNull(),
323
- tractionType: varchar('traction_type', { length: 255 }).notNull(),
324
- bodyType: varchar('body_type', { length: 255 }).notNull(),
325
- gearType: varchar('gear_type', { length: 255 }).notNull(),
326
- fuelType: varchar('fuel_type', { length: 255 }).notNull(),
327
- exchangeable: boolean('exchangeable'),
328
- installments: boolean('installments'),
329
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
330
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
331
- desc: longtext('desc'),
332
- latitude: double('latitude'),
333
- longitude: double('longitude'),
334
- viewCount: int('view_count'),
335
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
336
- });
337
-
338
-
339
- export const CarsDbTable = mysqlTable('cars_db', {
340
- id: int('id').autoincrement().notNull().primaryKey(),
341
- name: varchar('name', { length: 255 }).notNull(),
342
- parentId: int('parent_id'),
343
- level: int('level')
344
- });
345
-
346
-
347
- export const BooksTable = mysqlTable('books', {
348
- id: int('id').autoincrement().notNull().primaryKey(),
349
- title: varchar('title', { length: 255 }).notNull(),
350
- catId: int('cat_id').notNull(),
351
- condition: varchar('condition', { length: 255 }).notNull(),
352
- price: int('price').notNull(),
353
- currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
354
- exchangeable: boolean('exchangeable'),
355
- fromWhom: varchar('from_whom', { length: 255 }).notNull(),
356
- coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
357
- coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
358
- desc: longtext('desc'),
359
- latitude: double('latitude'),
360
- longitude: double('longitude'),
361
- viewCount: int('view_count'),
362
- status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
363
- govId: int('gov_id').notNull(),
364
- districtId: int('district_id').notNull(),
365
- subDistrictId: int('sub_district_id'),
366
- townId: int('town_id')
367
- });
368
-
369
-
370
- export const AddressTable = mysqlTable('address', {
371
- id: int('id').autoincrement().notNull().primaryKey(),
372
- catOrder: int('cat_order').notNull(),
373
- titleEn: varchar('title_en', { length: 255 }).notNull(),
374
- titleAr: varchar('title_ar', { length: 255 }).notNull(),
375
- titleTr: varchar('title_tr', { length: 255 }).notNull(),
376
- image: varchar('image', { length: 255 }),
377
- path: varchar('path', { length: 255 }),
378
- parentId: int('parent_id'),
379
- level: int('level')
380
- });
381
-
1
+ import {mysqlTable,int,longtext,mysqlEnum,varchar,boolean,double,timestamp} from 'drizzle-orm/mysql-core'
2
+
3
+ export const AppInfoTable = mysqlTable('app_info', {
4
+ id: int('id').autoincrement().notNull().primaryKey(),
5
+ aboutEn: longtext('about_en').notNull(),
6
+ aboutAr: longtext('about_ar').notNull(),
7
+ aboutTr: longtext('about_tr').notNull(),
8
+ privacyEn: longtext('privacy_en').notNull(),
9
+ privacyAr: longtext('privacy_ar').notNull(),
10
+ privacyTr: longtext('privacy_tr').notNull()
11
+ });
12
+
13
+
14
+ export const UserReportsTable = mysqlTable('user_reports', {
15
+ id: int('id').autoincrement().notNull().primaryKey(),
16
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
17
+ reportType: mysqlEnum('report_type', ['explicit_content', 'wrong_information', 'no_longer_available', 'user_not_responsive', 'other']).notNull(),
18
+ contentId: int('content_id').notNull(),
19
+ catId: int('cat_id').notNull(),
20
+ userId: int('user_id'),
21
+ appId: varchar('app_id', { length: 36 }).notNull()
22
+ });
23
+
24
+
25
+ export const FeaturedSliderTable = mysqlTable('featured_slider', {
26
+ id: int('id').autoincrement().notNull().primaryKey(),
27
+ image: varchar('image', { length: 255 }).notNull(),
28
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
29
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
30
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
31
+ descEn: longtext('desc_en').notNull(),
32
+ descAr: longtext('desc_ar').notNull(),
33
+ descTr: longtext('desc_tr').notNull()
34
+ });
35
+
36
+
37
+ export const MenuSettingsTable = mysqlTable('menu_settings', {
38
+ id: int('id').autoincrement().notNull().primaryKey(),
39
+ taxRate: varchar('tax_rate', { length: 255 }),
40
+ hideSlider: boolean('hide_slider')
41
+ });
42
+
43
+
44
+ export const ServicesTable = mysqlTable('services', {
45
+ id: int('id').autoincrement().notNull().primaryKey(),
46
+ title: varchar('title', { length: 255 }).notNull(),
47
+ catId: int('cat_id').notNull(),
48
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
49
+ price: int('price'),
50
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']),
51
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
52
+ desc: longtext('desc'),
53
+ latitude: double('latitude'),
54
+ longitude: double('longitude'),
55
+ viewCount: int('view_count'),
56
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
57
+ govId: int('gov_id').notNull(),
58
+ districtId: int('district_id').notNull(),
59
+ subDistrictId: int('sub_district_id'),
60
+ townId: int('town_id')
61
+ });
62
+
63
+
64
+ export const RealestateTable = mysqlTable('realestate', {
65
+ id: int('id').autoincrement().notNull().primaryKey(),
66
+ catId: int('cat_id').notNull(),
67
+ title: varchar('title', { length: 255 }).notNull(),
68
+ price: int('price').notNull(),
69
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
70
+ spaceGross: int('space_gross').notNull(),
71
+ spaceNet: int('space_net').notNull(),
72
+ latitude: double('latitude').notNull(),
73
+ longitude: double('longitude').notNull(),
74
+ roomCount: varchar('room_count', { length: 255 }),
75
+ buildingAge: varchar('building_age', { length: 255 }),
76
+ floorCount: varchar('floor_count', { length: 255 }),
77
+ bathroomCount: varchar('bathroom_count', { length: 255 }),
78
+ floorLocation: varchar('floor_location', { length: 255 }),
79
+ heatingType: varchar('heating_type', { length: 255 }),
80
+ kitchenType: varchar('kitchen_type', { length: 255 }),
81
+ balcony: boolean('balcony'),
82
+ lift: boolean('lift'),
83
+ parkingType: varchar('parking_type', { length: 255 }),
84
+ furnished: boolean('furnished'),
85
+ belongsToSite: boolean('belongs_to_site'),
86
+ siteName: varchar('site_name', { length: 255 }),
87
+ installments: boolean('installments'),
88
+ exchangeable: boolean('exchangeable'),
89
+ fromWhom: varchar('from_whom', { length: 255 }),
90
+ buildingMembershipFees: int('building_membership_fees'),
91
+ deposit: int('deposit'),
92
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
93
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
94
+ desc: longtext('desc'),
95
+ viewCount: int('view_count'),
96
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
97
+ govId: int('gov_id').notNull(),
98
+ districtId: int('district_id').notNull(),
99
+ subDistrictId: int('sub_district_id'),
100
+ townId: int('town_id')
101
+ });
102
+
103
+
104
+ export const HomepageSliderTable = mysqlTable('homepage_slider', {
105
+ id: int('id').autoincrement().notNull().primaryKey(),
106
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
107
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
108
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
109
+ subtitleEn: varchar('subtitle_en', { length: 255 }).notNull(),
110
+ subtitleAr: varchar('subtitle_ar', { length: 255 }).notNull(),
111
+ subtitleTr: varchar('subtitle_tr', { length: 255 }).notNull(),
112
+ photo: varchar('photo', { length: 255 }).notNull(),
113
+ buttonUrl: varchar('button_url', { length: 255 }),
114
+ buttonTextEn: varchar('button_text_en', { length: 255 }),
115
+ buttonTextAr: varchar('button_text_ar', { length: 255 }),
116
+ buttonTextTr: varchar('button_text_tr', { length: 255 }),
117
+ buttonUrlTarget: mysqlEnum('button_url_target', ['_blank', '_self'])
118
+ });
119
+
120
+
121
+ export const ContestSubscribersTable = mysqlTable('contest_subscribers', {
122
+ id: int('id').autoincrement().notNull().primaryKey(),
123
+ userId: int('user_id').notNull(),
124
+ contestId: varchar('contest_id', { length: 255 }).notNull()
125
+ });
126
+
127
+
128
+ export const ContestsTable = mysqlTable('contests', {
129
+ id: int('id').autoincrement().notNull().primaryKey(),
130
+ date: timestamp('date').notNull(),
131
+ prize: varchar('prize', { length: 255 }).notNull(),
132
+ winnerId: int('winner_id'),
133
+ tags: varchar('tags', { length: 255 })
134
+ });
135
+
136
+
137
+ export const NotificationsTable = mysqlTable('notifications', {
138
+ id: int('id').autoincrement().notNull().primaryKey(),
139
+ type: mysqlEnum('type', ['ad_price_updated', 'ad_updated', 'ad_activated', 'ad_pending_review', 'ad_expired', 'ad_rejected', 'ad_viewed', 'ad_favorited', 'ad_shared', 'ad_reported', 'ad_deleted', 'ad_created', 'contest_winner', 'contest_reminder', 'contest_created', 'custom']).notNull(),
140
+ contentId: int('content_id'),
141
+ contentCatId: int('content_cat_id'),
142
+ userId: int('user_id'),
143
+ message: varchar('message', { length: 255 })
144
+ });
145
+
146
+
147
+ export const ModerationTable = mysqlTable('moderation', {
148
+ id: int('id').autoincrement().notNull().primaryKey(),
149
+ contentType: mysqlEnum('content_type', ['ad', 'user']).notNull(),
150
+ contentId: int('content_id').notNull(),
151
+ catId: int('cat_id'),
152
+ userId: int('user_id').notNull(),
153
+ flagged: int('flagged').notNull(),
154
+ result: varchar('result', { length: 255 }).notNull()
155
+ });
156
+
157
+
158
+ export const JobsTable = mysqlTable('jobs', {
159
+ id: int('id').autoincrement().notNull().primaryKey(),
160
+ title: varchar('title', { length: 255 }).notNull(),
161
+ catId: int('cat_id').notNull(),
162
+ salary: int('salary'),
163
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
164
+ workMethod: varchar('work_method', { length: 255 }).notNull(),
165
+ minimumEducation: varchar('minimum_education', { length: 255 }).notNull(),
166
+ experienceLevel: varchar('experience_level', { length: 255 }).notNull(),
167
+ remote: boolean('remote'),
168
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
169
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
170
+ desc: longtext('desc'),
171
+ latitude: double('latitude'),
172
+ longitude: double('longitude'),
173
+ viewCount: int('view_count'),
174
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
175
+ govId: int('gov_id').notNull(),
176
+ districtId: int('district_id').notNull(),
177
+ subDistrictId: int('sub_district_id'),
178
+ townId: int('town_id')
179
+ });
180
+
181
+
182
+ export const FurnitureTable = mysqlTable('furniture', {
183
+ id: int('id').autoincrement().notNull().primaryKey(),
184
+ title: varchar('title', { length: 255 }).notNull(),
185
+ catId: int('cat_id').notNull(),
186
+ condition: varchar('condition', { length: 255 }).notNull(),
187
+ price: int('price').notNull(),
188
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
189
+ exchangeable: boolean('exchangeable'),
190
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
191
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
192
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
193
+ desc: longtext('desc'),
194
+ latitude: double('latitude'),
195
+ longitude: double('longitude'),
196
+ viewCount: int('view_count'),
197
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
198
+ govId: int('gov_id').notNull(),
199
+ districtId: int('district_id').notNull(),
200
+ subDistrictId: int('sub_district_id'),
201
+ townId: int('town_id')
202
+ });
203
+
204
+
205
+ export const FiltersTable = mysqlTable('filters', {
206
+ id: int('id').autoincrement().notNull().primaryKey(),
207
+ title: varchar('title', { length: 255 }).notNull(),
208
+ Key: varchar('_key', { length: 255 }).notNull(),
209
+ fieldName: varchar('field_name', { length: 255 }).notNull(),
210
+ type: mysqlEnum('type', ['checkbox', 'select', 'text', 'finance', 'number', 'point']).notNull(),
211
+ tableName: varchar('table_name', { length: 255 }),
212
+ isMandatory: boolean('is_mandatory')
213
+ });
214
+
215
+
216
+ export const FaqTable = mysqlTable('faq', {
217
+ id: int('id').autoincrement().notNull().primaryKey(),
218
+ qEn: varchar('q_en', { length: 255 }).notNull(),
219
+ qAr: varchar('q_ar', { length: 255 }).notNull(),
220
+ qTr: varchar('q_tr', { length: 255 }),
221
+ aEn: longtext('a_en').notNull(),
222
+ aAr: longtext('a_ar'),
223
+ aTr: longtext('a_tr')
224
+ });
225
+
226
+
227
+ export const ErrorsTable = mysqlTable('errors', {
228
+ id: int('id').autoincrement().notNull().primaryKey(),
229
+ title: varchar('title', { length: 255 }).notNull(),
230
+ caseId: varchar('case_id', { length: 255 }).notNull(),
231
+ userId: int('user_id'),
232
+ itemSlug: varchar('item_slug', { length: 255 }),
233
+ desc: longtext('desc'),
234
+ isResolved: boolean('is_resolved')
235
+ });
236
+
237
+
238
+ export const ElectronicsTable = mysqlTable('electronics', {
239
+ id: int('id').autoincrement().notNull().primaryKey(),
240
+ title: varchar('title', { length: 255 }).notNull(),
241
+ catId: int('cat_id').notNull(),
242
+ condition: varchar('condition', { length: 255 }).notNull(),
243
+ price: int('price').notNull(),
244
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
245
+ exchangeable: boolean('exchangeable'),
246
+ installments: boolean('installments'),
247
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
248
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
249
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
250
+ desc: longtext('desc'),
251
+ latitude: double('latitude'),
252
+ longitude: double('longitude'),
253
+ viewCount: int('view_count'),
254
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
255
+ govId: int('gov_id').notNull(),
256
+ districtId: int('district_id').notNull(),
257
+ subDistrictId: int('sub_district_id'),
258
+ townId: int('town_id')
259
+ });
260
+
261
+
262
+ export const ClothesTable = mysqlTable('clothes', {
263
+ id: int('id').autoincrement().notNull().primaryKey(),
264
+ title: varchar('title', { length: 255 }).notNull(),
265
+ catId: int('cat_id').notNull(),
266
+ condition: varchar('condition', { length: 255 }).notNull(),
267
+ price: int('price').notNull(),
268
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
269
+ exchangeable: boolean('exchangeable'),
270
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
271
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
272
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
273
+ desc: longtext('desc'),
274
+ latitude: double('latitude'),
275
+ longitude: double('longitude'),
276
+ viewCount: int('view_count'),
277
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
278
+ govId: int('gov_id').notNull(),
279
+ districtId: int('district_id').notNull(),
280
+ subDistrictId: int('sub_district_id'),
281
+ townId: int('town_id')
282
+ });
283
+
284
+
285
+ export const CatsTable = mysqlTable('cats', {
286
+ id: int('id').autoincrement().notNull().primaryKey(),
287
+ catOrder: int('cat_order').notNull(),
288
+ slug: varchar('slug', { length: 255 }).notNull(),
289
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
290
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
291
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
292
+ fullTitleEn: varchar('full_title_en', { length: 255 }),
293
+ fullTitleAr: varchar('full_title_ar', { length: 255 }),
294
+ fullTitleTr: varchar('full_title_tr', { length: 255 }),
295
+ image: varchar('image', { length: 255 }),
296
+ metaDescEn: varchar('meta_desc_en', { length: 255 }),
297
+ metaDescAr: varchar('meta_desc_ar', { length: 255 }),
298
+ metaDescTr: varchar('meta_desc_tr', { length: 255 }),
299
+ filters: varchar('filters', { length: 255 }),
300
+ tableName: varchar('table_name', { length: 255 }).notNull(),
301
+ adCount: int('ad_count'),
302
+ parentId: int('parent_id'),
303
+ level: int('level')
304
+ });
305
+
306
+
307
+ export const CarsTable = mysqlTable('cars', {
308
+ id: int('id').autoincrement().notNull().primaryKey(),
309
+ modelYear: int('model_year').notNull(),
310
+ model: varchar('model', { length: 255 }).notNull(),
311
+ title: varchar('title', { length: 255 }).notNull(),
312
+ catId: int('cat_id').notNull(),
313
+ govId: int('gov_id').notNull(),
314
+ districtId: int('district_id').notNull(),
315
+ subDistrictId: int('sub_district_id'),
316
+ townId: int('town_id'),
317
+ price: int('price').notNull(),
318
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
319
+ condition: varchar('condition', { length: 255 }).notNull(),
320
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
321
+ engineCapacity: varchar('engine_capacity', { length: 255 }).notNull(),
322
+ enginePower: varchar('engine_power', { length: 255 }).notNull(),
323
+ tractionType: varchar('traction_type', { length: 255 }).notNull(),
324
+ bodyType: varchar('body_type', { length: 255 }).notNull(),
325
+ gearType: varchar('gear_type', { length: 255 }).notNull(),
326
+ fuelType: varchar('fuel_type', { length: 255 }).notNull(),
327
+ exchangeable: boolean('exchangeable'),
328
+ installments: boolean('installments'),
329
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
330
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
331
+ desc: longtext('desc'),
332
+ latitude: double('latitude'),
333
+ longitude: double('longitude'),
334
+ viewCount: int('view_count'),
335
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired'])
336
+ });
337
+
338
+
339
+ export const CarsDbTable = mysqlTable('cars_db', {
340
+ id: int('id').autoincrement().notNull().primaryKey(),
341
+ name: varchar('name', { length: 255 }).notNull(),
342
+ parentId: int('parent_id'),
343
+ level: int('level')
344
+ });
345
+
346
+
347
+ export const BooksTable = mysqlTable('books', {
348
+ id: int('id').autoincrement().notNull().primaryKey(),
349
+ title: varchar('title', { length: 255 }).notNull(),
350
+ catId: int('cat_id').notNull(),
351
+ condition: varchar('condition', { length: 255 }).notNull(),
352
+ price: int('price').notNull(),
353
+ currency: mysqlEnum('currency', ['USD', 'TRY', 'SYP']).notNull(),
354
+ exchangeable: boolean('exchangeable'),
355
+ fromWhom: varchar('from_whom', { length: 255 }).notNull(),
356
+ coverphoto: varchar('coverphoto', { length: 255 }).notNull(),
357
+ coverphotoPlaceholder: varchar('coverphoto_placeholder', { length: 255 }),
358
+ desc: longtext('desc'),
359
+ latitude: double('latitude'),
360
+ longitude: double('longitude'),
361
+ viewCount: int('view_count'),
362
+ status: mysqlEnum('status', ['pending_creation', 'active', 'pending_review', 'rejected', 'expired']),
363
+ govId: int('gov_id').notNull(),
364
+ districtId: int('district_id').notNull(),
365
+ subDistrictId: int('sub_district_id'),
366
+ townId: int('town_id')
367
+ });
368
+
369
+
370
+ export const AddressTable = mysqlTable('address', {
371
+ id: int('id').autoincrement().notNull().primaryKey(),
372
+ catOrder: int('cat_order').notNull(),
373
+ titleEn: varchar('title_en', { length: 255 }).notNull(),
374
+ titleAr: varchar('title_ar', { length: 255 }).notNull(),
375
+ titleTr: varchar('title_tr', { length: 255 }).notNull(),
376
+ image: varchar('image', { length: 255 }),
377
+ path: varchar('path', { length: 255 }),
378
+ parentId: int('parent_id'),
379
+ level: int('level')
380
+ });
381
+
@@ -90,17 +90,3 @@ export const getAnalytics = async ({
90
90
  return null
91
91
  }
92
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
- }
@@ -64,7 +64,7 @@
64
64
  "nanoid": "^5.1.2",
65
65
  "next": "16.1.1",
66
66
  "next-themes": "^0.4.6",
67
- "nextjs-cms": "0.5.89",
67
+ "nextjs-cms": "0.5.91",
68
68
  "plaiceholder": "^3.0.0",
69
69
  "prettier-plugin-tailwindcss": "^0.7.2",
70
70
  "qrcode": "^1.5.4",
@@ -97,7 +97,7 @@
97
97
  "eslint-config-prettier": "^10.0.1",
98
98
  "eslint-plugin-prettier": "^5.2.3",
99
99
  "fs-extra": "^11.3.3",
100
- "nextjs-cms-kit": "0.5.89",
100
+ "nextjs-cms-kit": "0.5.91",
101
101
  "postcss": "^8.5.1",
102
102
  "prettier": "3.5.0",
103
103
  "raw-loader": "^4.0.2",