@optimatech88/titomeet-shared-lib 1.0.36 → 1.0.37

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": "@optimatech88/titomeet-shared-lib",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,433 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "public"."UserRole" AS ENUM ('SUPER_ADMIN', 'ADMIN', 'USER');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "public"."UserStatus" AS ENUM ('ACTIVE', 'INACTIVE', 'DELETED');
6
+
7
+ -- CreateEnum
8
+ CREATE TYPE "public"."EventAccess" AS ENUM ('FREE', 'PAID');
9
+
10
+ -- CreateEnum
11
+ CREATE TYPE "public"."EventVisibility" AS ENUM ('PUBLIC', 'PRIVATE');
12
+
13
+ -- CreateEnum
14
+ CREATE TYPE "public"."EventStatus" AS ENUM ('DRAFT', 'PUBLISHED', 'PENDING', 'CANCELLED');
15
+
16
+ -- CreateEnum
17
+ CREATE TYPE "public"."MediaType" AS ENUM ('image', 'video', 'audio', 'pdf');
18
+
19
+ -- CreateEnum
20
+ CREATE TYPE "public"."NotificationType" AS ENUM ('NEW_MESSAGE', 'EVENT_REMINDER', 'EVENT_PARTICIPATION_CONFIRMATION', 'EVENT_VALIDATION', 'EVENT_REJECTION', 'EVENT_ASSIGNMENT', 'EVENT_ASSIGNMENT_APPROVAL', 'EVENT_ASSIGNMENT_REJECTION');
21
+
22
+ -- CreateEnum
23
+ CREATE TYPE "public"."ProviderStatus" AS ENUM ('PENDING', 'APPROVED', 'REJECTED');
24
+
25
+ -- CreateEnum
26
+ CREATE TYPE "public"."OrderStatus" AS ENUM ('PENDING', 'CONFIRMED', 'CANCELLED', 'REFUNDED');
27
+
28
+ -- CreateEnum
29
+ CREATE TYPE "public"."PaymentStatus" AS ENUM ('PENDING', 'COMPLETED', 'FAILED', 'REFUNDED');
30
+
31
+ -- CreateTable
32
+ CREATE TABLE "public"."User" (
33
+ "id" TEXT NOT NULL,
34
+ "username" TEXT NOT NULL,
35
+ "email" TEXT NOT NULL,
36
+ "firstName" TEXT NOT NULL,
37
+ "lastName" TEXT NOT NULL,
38
+ "password" TEXT,
39
+ "role" "public"."UserRole" NOT NULL DEFAULT 'USER',
40
+ "profilePicture" TEXT,
41
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
42
+ "updatedAt" TIMESTAMP(3) NOT NULL,
43
+ "emailVerified" BOOLEAN NOT NULL DEFAULT false,
44
+ "status" "public"."UserStatus" NOT NULL DEFAULT 'ACTIVE',
45
+
46
+ CONSTRAINT "User_pkey" PRIMARY KEY ("id")
47
+ );
48
+
49
+ -- CreateTable
50
+ CREATE TABLE "public"."Account" (
51
+ "id" TEXT NOT NULL,
52
+ "refreshToken" TEXT NOT NULL,
53
+ "expiresAt" TIMESTAMP(3) NOT NULL,
54
+ "userId" TEXT NOT NULL,
55
+
56
+ CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
57
+ );
58
+
59
+ -- CreateTable
60
+ CREATE TABLE "public"."Address" (
61
+ "id" TEXT NOT NULL,
62
+ "name" TEXT NOT NULL,
63
+ "line2" TEXT,
64
+ "city" TEXT,
65
+ "state" TEXT,
66
+ "country" TEXT NOT NULL,
67
+ "postalCode" TEXT,
68
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
69
+ "updatedAt" TIMESTAMP(3) NOT NULL,
70
+ "countryCode" TEXT,
71
+ "latitude" DOUBLE PRECISION,
72
+ "longitude" DOUBLE PRECISION,
73
+ "type" TEXT NOT NULL DEFAULT 'suburb',
74
+
75
+ CONSTRAINT "Address_pkey" PRIMARY KEY ("id")
76
+ );
77
+
78
+ -- CreateTable
79
+ CREATE TABLE "public"."EventCategory" (
80
+ "id" TEXT NOT NULL,
81
+ "name" TEXT NOT NULL,
82
+ "description" TEXT,
83
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
84
+ "updatedAt" TIMESTAMP(3) NOT NULL,
85
+ "active" BOOLEAN NOT NULL DEFAULT true,
86
+ "parentId" TEXT,
87
+
88
+ CONSTRAINT "EventCategory_pkey" PRIMARY KEY ("id")
89
+ );
90
+
91
+ -- CreateTable
92
+ CREATE TABLE "public"."Event" (
93
+ "id" TEXT NOT NULL,
94
+ "name" TEXT NOT NULL,
95
+ "description" TEXT NOT NULL,
96
+ "startDate" TIMESTAMP(3) NOT NULL,
97
+ "endDate" TIMESTAMP(3) NOT NULL,
98
+ "startTime" TEXT NOT NULL,
99
+ "endTime" TEXT NOT NULL,
100
+ "capacity" INTEGER NOT NULL,
101
+ "coverPicture" TEXT NOT NULL,
102
+ "badge" TEXT NOT NULL,
103
+ "tags" TEXT[],
104
+ "accessType" "public"."EventAccess" NOT NULL DEFAULT 'FREE',
105
+ "visibility" "public"."EventVisibility" NOT NULL DEFAULT 'PUBLIC',
106
+ "status" "public"."EventStatus" NOT NULL DEFAULT 'DRAFT',
107
+ "addressId" TEXT NOT NULL,
108
+ "postedById" TEXT NOT NULL,
109
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
110
+ "updatedAt" TIMESTAMP(3) NOT NULL,
111
+
112
+ CONSTRAINT "Event_pkey" PRIMARY KEY ("id")
113
+ );
114
+
115
+ -- CreateTable
116
+ CREATE TABLE "public"."EventPrice" (
117
+ "id" TEXT NOT NULL,
118
+ "name" TEXT NOT NULL,
119
+ "amount" DOUBLE PRECISION NOT NULL,
120
+ "description" TEXT,
121
+ "eventId" TEXT NOT NULL,
122
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
123
+ "updatedAt" TIMESTAMP(3) NOT NULL,
124
+
125
+ CONSTRAINT "EventPrice_pkey" PRIMARY KEY ("id")
126
+ );
127
+
128
+ -- CreateTable
129
+ CREATE TABLE "public"."Chat" (
130
+ "id" TEXT NOT NULL,
131
+ "name" TEXT NOT NULL,
132
+ "eventId" TEXT NOT NULL,
133
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
134
+ "updatedAt" TIMESTAMP(3) NOT NULL,
135
+
136
+ CONSTRAINT "Chat_pkey" PRIMARY KEY ("id")
137
+ );
138
+
139
+ -- CreateTable
140
+ CREATE TABLE "public"."ChatUser" (
141
+ "id" TEXT NOT NULL,
142
+ "chatId" TEXT NOT NULL,
143
+ "userId" TEXT NOT NULL,
144
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
145
+ "updatedAt" TIMESTAMP(3) NOT NULL,
146
+
147
+ CONSTRAINT "ChatUser_pkey" PRIMARY KEY ("id")
148
+ );
149
+
150
+ -- CreateTable
151
+ CREATE TABLE "public"."Message" (
152
+ "id" TEXT NOT NULL,
153
+ "chatId" TEXT NOT NULL,
154
+ "senderId" TEXT NOT NULL,
155
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
156
+ "updatedAt" TIMESTAMP(3) NOT NULL,
157
+ "files" JSONB,
158
+ "text" TEXT NOT NULL,
159
+
160
+ CONSTRAINT "Message_pkey" PRIMARY KEY ("id")
161
+ );
162
+
163
+ -- CreateTable
164
+ CREATE TABLE "public"."Notification" (
165
+ "id" TEXT NOT NULL,
166
+ "notifiedToId" TEXT NOT NULL,
167
+ "userId" TEXT,
168
+ "type" "public"."NotificationType" NOT NULL,
169
+ "read" BOOLEAN NOT NULL DEFAULT false,
170
+ "data" JSONB,
171
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
172
+ "updatedAt" TIMESTAMP(3) NOT NULL,
173
+
174
+ CONSTRAINT "Notification_pkey" PRIMARY KEY ("id")
175
+ );
176
+
177
+ -- CreateTable
178
+ CREATE TABLE "public"."ProviderCategory" (
179
+ "id" TEXT NOT NULL,
180
+ "name" TEXT NOT NULL,
181
+ "description" TEXT,
182
+ "active" BOOLEAN NOT NULL DEFAULT true,
183
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
184
+ "updatedAt" TIMESTAMP(3) NOT NULL,
185
+
186
+ CONSTRAINT "ProviderCategory_pkey" PRIMARY KEY ("id")
187
+ );
188
+
189
+ -- CreateTable
190
+ CREATE TABLE "public"."Provider" (
191
+ "id" TEXT NOT NULL,
192
+ "name" TEXT NOT NULL,
193
+ "description" TEXT,
194
+ "image" TEXT,
195
+ "userId" TEXT NOT NULL,
196
+ "status" "public"."ProviderStatus" NOT NULL DEFAULT 'PENDING',
197
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
198
+ "updatedAt" TIMESTAMP(3) NOT NULL,
199
+ "addressId" TEXT,
200
+ "categoryId" TEXT NOT NULL,
201
+ "docs" JSONB,
202
+ "email" TEXT,
203
+ "phoneNumber" TEXT,
204
+ "pricingDetails" TEXT,
205
+ "rating" DOUBLE PRECISION,
206
+ "website" TEXT,
207
+
208
+ CONSTRAINT "Provider_pkey" PRIMARY KEY ("id")
209
+ );
210
+
211
+ -- CreateTable
212
+ CREATE TABLE "public"."ProviderOnEvent" (
213
+ "id" TEXT NOT NULL,
214
+ "providerId" TEXT NOT NULL,
215
+ "eventId" TEXT NOT NULL,
216
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
217
+ "updatedAt" TIMESTAMP(3) NOT NULL,
218
+
219
+ CONSTRAINT "ProviderOnEvent_pkey" PRIMARY KEY ("id")
220
+ );
221
+
222
+ -- CreateTable
223
+ CREATE TABLE "public"."Review" (
224
+ "id" TEXT NOT NULL,
225
+ "rating" DOUBLE PRECISION NOT NULL,
226
+ "comment" TEXT,
227
+ "providerId" TEXT NOT NULL,
228
+ "userId" TEXT NOT NULL,
229
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
230
+ "updatedAt" TIMESTAMP(3) NOT NULL,
231
+
232
+ CONSTRAINT "Review_pkey" PRIMARY KEY ("id")
233
+ );
234
+
235
+ -- CreateTable
236
+ CREATE TABLE "public"."Favorite" (
237
+ "id" TEXT NOT NULL,
238
+ "userId" TEXT NOT NULL,
239
+ "eventId" TEXT NOT NULL,
240
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
241
+ "updatedAt" TIMESTAMP(3) NOT NULL,
242
+
243
+ CONSTRAINT "Favorite_pkey" PRIMARY KEY ("id")
244
+ );
245
+
246
+ -- CreateTable
247
+ CREATE TABLE "public"."Order" (
248
+ "id" TEXT NOT NULL,
249
+ "userId" TEXT NOT NULL,
250
+ "eventId" TEXT NOT NULL,
251
+ "email" TEXT NOT NULL,
252
+ "status" "public"."OrderStatus" NOT NULL DEFAULT 'PENDING',
253
+ "totalAmount" DOUBLE PRECISION NOT NULL,
254
+ "paymentIntentId" TEXT,
255
+ "paymentStatus" "public"."PaymentStatus" NOT NULL DEFAULT 'PENDING',
256
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
257
+ "updatedAt" TIMESTAMP(3) NOT NULL,
258
+
259
+ CONSTRAINT "Order_pkey" PRIMARY KEY ("id")
260
+ );
261
+
262
+ -- CreateTable
263
+ CREATE TABLE "public"."OrderItem" (
264
+ "id" TEXT NOT NULL,
265
+ "orderId" TEXT NOT NULL,
266
+ "eventPriceId" TEXT NOT NULL,
267
+ "quantity" INTEGER NOT NULL,
268
+ "unitPrice" DOUBLE PRECISION NOT NULL,
269
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
270
+ "updatedAt" TIMESTAMP(3) NOT NULL,
271
+
272
+ CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id")
273
+ );
274
+
275
+ -- CreateTable
276
+ CREATE TABLE "public"."UserInterests" (
277
+ "id" TEXT NOT NULL,
278
+ "userId" TEXT NOT NULL,
279
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
280
+ "updatedAt" TIMESTAMP(3) NOT NULL,
281
+
282
+ CONSTRAINT "UserInterests_pkey" PRIMARY KEY ("id")
283
+ );
284
+
285
+ -- CreateTable
286
+ CREATE TABLE "public"."Newsletter" (
287
+ "id" TEXT NOT NULL,
288
+ "email" TEXT NOT NULL,
289
+ "unsubscribedAt" TIMESTAMP(3),
290
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
291
+ "updatedAt" TIMESTAMP(3) NOT NULL,
292
+
293
+ CONSTRAINT "Newsletter_pkey" PRIMARY KEY ("id")
294
+ );
295
+
296
+ -- CreateTable
297
+ CREATE TABLE "public"."_EventCategoryToUserInterests" (
298
+ "A" TEXT NOT NULL,
299
+ "B" TEXT NOT NULL,
300
+
301
+ CONSTRAINT "_EventCategoryToUserInterests_AB_pkey" PRIMARY KEY ("A","B")
302
+ );
303
+
304
+ -- CreateTable
305
+ CREATE TABLE "public"."_EventToEventCategory" (
306
+ "A" TEXT NOT NULL,
307
+ "B" TEXT NOT NULL,
308
+
309
+ CONSTRAINT "_EventToEventCategory_AB_pkey" PRIMARY KEY ("A","B")
310
+ );
311
+
312
+ -- CreateIndex
313
+ CREATE UNIQUE INDEX "User_username_key" ON "public"."User"("username");
314
+
315
+ -- CreateIndex
316
+ CREATE UNIQUE INDEX "User_email_key" ON "public"."User"("email");
317
+
318
+ -- CreateIndex
319
+ CREATE UNIQUE INDEX "Account_refreshToken_key" ON "public"."Account"("refreshToken");
320
+
321
+ -- CreateIndex
322
+ CREATE UNIQUE INDEX "EventCategory_name_key" ON "public"."EventCategory"("name");
323
+
324
+ -- CreateIndex
325
+ CREATE UNIQUE INDEX "Chat_eventId_key" ON "public"."Chat"("eventId");
326
+
327
+ -- CreateIndex
328
+ CREATE UNIQUE INDEX "ProviderCategory_name_key" ON "public"."ProviderCategory"("name");
329
+
330
+ -- CreateIndex
331
+ CREATE UNIQUE INDEX "Order_paymentIntentId_key" ON "public"."Order"("paymentIntentId");
332
+
333
+ -- CreateIndex
334
+ CREATE UNIQUE INDEX "UserInterests_userId_key" ON "public"."UserInterests"("userId");
335
+
336
+ -- CreateIndex
337
+ CREATE UNIQUE INDEX "Newsletter_email_key" ON "public"."Newsletter"("email");
338
+
339
+ -- CreateIndex
340
+ CREATE INDEX "_EventCategoryToUserInterests_B_index" ON "public"."_EventCategoryToUserInterests"("B");
341
+
342
+ -- CreateIndex
343
+ CREATE INDEX "_EventToEventCategory_B_index" ON "public"."_EventToEventCategory"("B");
344
+
345
+ -- AddForeignKey
346
+ ALTER TABLE "public"."Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
347
+
348
+ -- AddForeignKey
349
+ ALTER TABLE "public"."EventCategory" ADD CONSTRAINT "EventCategory_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "public"."EventCategory"("id") ON DELETE SET NULL ON UPDATE CASCADE;
350
+
351
+ -- AddForeignKey
352
+ ALTER TABLE "public"."Event" ADD CONSTRAINT "Event_addressId_fkey" FOREIGN KEY ("addressId") REFERENCES "public"."Address"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
353
+
354
+ -- AddForeignKey
355
+ ALTER TABLE "public"."Event" ADD CONSTRAINT "Event_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
356
+
357
+ -- AddForeignKey
358
+ ALTER TABLE "public"."EventPrice" ADD CONSTRAINT "EventPrice_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
359
+
360
+ -- AddForeignKey
361
+ ALTER TABLE "public"."Chat" ADD CONSTRAINT "Chat_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
362
+
363
+ -- AddForeignKey
364
+ ALTER TABLE "public"."ChatUser" ADD CONSTRAINT "ChatUser_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "public"."Chat"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
365
+
366
+ -- AddForeignKey
367
+ ALTER TABLE "public"."ChatUser" ADD CONSTRAINT "ChatUser_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
368
+
369
+ -- AddForeignKey
370
+ ALTER TABLE "public"."Message" ADD CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "public"."Chat"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
371
+
372
+ -- AddForeignKey
373
+ ALTER TABLE "public"."Message" ADD CONSTRAINT "Message_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
374
+
375
+ -- AddForeignKey
376
+ ALTER TABLE "public"."Notification" ADD CONSTRAINT "Notification_notifiedToId_fkey" FOREIGN KEY ("notifiedToId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
377
+
378
+ -- AddForeignKey
379
+ ALTER TABLE "public"."Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
380
+
381
+ -- AddForeignKey
382
+ ALTER TABLE "public"."Provider" ADD CONSTRAINT "Provider_addressId_fkey" FOREIGN KEY ("addressId") REFERENCES "public"."Address"("id") ON DELETE SET NULL ON UPDATE CASCADE;
383
+
384
+ -- AddForeignKey
385
+ ALTER TABLE "public"."Provider" ADD CONSTRAINT "Provider_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "public"."ProviderCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
386
+
387
+ -- AddForeignKey
388
+ ALTER TABLE "public"."Provider" ADD CONSTRAINT "Provider_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
389
+
390
+ -- AddForeignKey
391
+ ALTER TABLE "public"."ProviderOnEvent" ADD CONSTRAINT "ProviderOnEvent_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "public"."Provider"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
392
+
393
+ -- AddForeignKey
394
+ ALTER TABLE "public"."ProviderOnEvent" ADD CONSTRAINT "ProviderOnEvent_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
395
+
396
+ -- AddForeignKey
397
+ ALTER TABLE "public"."Review" ADD CONSTRAINT "Review_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "public"."Provider"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
398
+
399
+ -- AddForeignKey
400
+ ALTER TABLE "public"."Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
401
+
402
+ -- AddForeignKey
403
+ ALTER TABLE "public"."Favorite" ADD CONSTRAINT "Favorite_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
404
+
405
+ -- AddForeignKey
406
+ ALTER TABLE "public"."Favorite" ADD CONSTRAINT "Favorite_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
407
+
408
+ -- AddForeignKey
409
+ ALTER TABLE "public"."Order" ADD CONSTRAINT "Order_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
410
+
411
+ -- AddForeignKey
412
+ ALTER TABLE "public"."Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
413
+
414
+ -- AddForeignKey
415
+ ALTER TABLE "public"."OrderItem" ADD CONSTRAINT "OrderItem_eventPriceId_fkey" FOREIGN KEY ("eventPriceId") REFERENCES "public"."EventPrice"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
416
+
417
+ -- AddForeignKey
418
+ ALTER TABLE "public"."OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "public"."Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
419
+
420
+ -- AddForeignKey
421
+ ALTER TABLE "public"."UserInterests" ADD CONSTRAINT "UserInterests_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
422
+
423
+ -- AddForeignKey
424
+ ALTER TABLE "public"."_EventCategoryToUserInterests" ADD CONSTRAINT "_EventCategoryToUserInterests_A_fkey" FOREIGN KEY ("A") REFERENCES "public"."EventCategory"("id") ON DELETE CASCADE ON UPDATE CASCADE;
425
+
426
+ -- AddForeignKey
427
+ ALTER TABLE "public"."_EventCategoryToUserInterests" ADD CONSTRAINT "_EventCategoryToUserInterests_B_fkey" FOREIGN KEY ("B") REFERENCES "public"."UserInterests"("id") ON DELETE CASCADE ON UPDATE CASCADE;
428
+
429
+ -- AddForeignKey
430
+ ALTER TABLE "public"."_EventToEventCategory" ADD CONSTRAINT "_EventToEventCategory_A_fkey" FOREIGN KEY ("A") REFERENCES "public"."Event"("id") ON DELETE CASCADE ON UPDATE CASCADE;
431
+
432
+ -- AddForeignKey
433
+ ALTER TABLE "public"."_EventToEventCategory" ADD CONSTRAINT "_EventToEventCategory_B_fkey" FOREIGN KEY ("B") REFERENCES "public"."EventCategory"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,3 @@
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "postgresql"
@@ -1,9 +1,3 @@
1
- // This is your Prisma schema file,
2
- // learn more about it in the docs: https://pris.ly/d/prisma-schema
3
-
4
- // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5
- // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6
-
7
1
  generator client {
8
2
  provider = "prisma-client-js"
9
3
  }
@@ -13,345 +7,320 @@ datasource db {
13
7
  url = env("DATABASE_URL")
14
8
  }
15
9
 
16
- enum UserRole {
17
- SUPER_ADMIN
18
- ADMIN
19
- USER
20
- }
21
-
22
- enum UserStatus {
23
- ACTIVE
24
- INACTIVE
25
- DELETED
26
- }
27
-
28
10
  model User {
29
- id String @id @default(cuid())
30
- username String @unique
31
- email String @unique
32
- firstName String
33
- lastName String
34
- password String?
35
- role UserRole @default(USER)
36
-
37
- profilePicture String?
38
- emailVerified Boolean @default(false)
39
- status UserStatus @default(ACTIVE)
40
-
41
- createdAt DateTime @default(now())
42
- updatedAt DateTime @updatedAt
43
-
11
+ id String @id @default(cuid())
12
+ username String @unique
13
+ email String @unique
14
+ firstName String
15
+ lastName String
16
+ password String?
17
+ role UserRole @default(USER)
18
+ profilePicture String?
19
+ createdAt DateTime @default(now())
20
+ updatedAt DateTime @updatedAt
21
+ emailVerified Boolean @default(false)
22
+ status UserStatus @default(ACTIVE)
44
23
  accounts Account[]
45
- messages Message[]
24
+ chatUsers ChatUser[]
46
25
  events Event[]
26
+ favorites Favorite[]
27
+ messages Message[]
47
28
  notificationsReceived Notification[] @relation("NotificationRecipient")
48
29
  notificationsSent Notification[] @relation("NotificationSender")
30
+ orders Order[]
49
31
  providers Provider[]
50
32
  reviews Review[]
51
33
 
52
- favorites Favorite[]
53
- orders Order[]
54
- chatUsers ChatUser[]
34
+ userInterests UserInterests?
55
35
  }
56
36
 
57
37
  model Account {
58
38
  id String @id @default(cuid())
59
39
  refreshToken String @unique
60
40
  expiresAt DateTime
61
- user User @relation(fields: [userId], references: [id])
62
41
  userId String
42
+ user User @relation(fields: [userId], references: [id])
63
43
  }
64
44
 
65
45
  model Address {
66
- id String @id @default(uuid())
46
+ id String @id @default(uuid())
67
47
  name String
68
48
  line2 String?
69
49
  city String?
70
50
  state String?
71
51
  country String
72
- countryCode String?
73
52
  postalCode String?
74
- type String @default("suburb")
75
-
76
- latitude Float?
77
- longitude Float?
78
-
79
- events Event[]
80
- createdAt DateTime @default(now())
81
- updatedAt DateTime @updatedAt
82
-
83
- Provider Provider[]
84
- }
85
-
86
- enum EventAccess {
87
- FREE
88
- PAID
89
- }
90
-
91
- enum EventVisibility {
92
- PUBLIC
93
- PRIVATE
94
- }
95
-
96
- model EventCategory {
97
- id String @id @default(cuid())
98
- name String @unique
99
- description String?
53
+ createdAt DateTime @default(now())
54
+ updatedAt DateTime @updatedAt
55
+ countryCode String?
56
+ latitude Float?
57
+ longitude Float?
58
+ type String @default("suburb")
100
59
  events Event[]
101
-
102
- active Boolean @default(true)
103
-
104
- createdAt DateTime @default(now())
105
- updatedAt DateTime @updatedAt
60
+ Provider Provider[]
106
61
  }
107
62
 
108
- enum EventStatus {
109
- DRAFT
110
- PENDING
111
- PUBLISHED
112
- CANCELLED
63
+ model EventCategory {
64
+ id String @id @default(cuid())
65
+ name String @unique
66
+ description String?
67
+ createdAt DateTime @default(now())
68
+ updatedAt DateTime @updatedAt
69
+ active Boolean @default(true)
70
+ events Event[] @relation("EventToEventCategory")
71
+ userInterests UserInterests[]
72
+
73
+ parentId String?
74
+ parent EventCategory? @relation("EventCategoryParent", fields: [parentId], references: [id])
75
+
76
+ children EventCategory[] @relation("EventCategoryParent")
113
77
  }
114
78
 
115
79
  model Event {
116
- id String @id @default(cuid())
117
- name String
118
- description String
119
- startDate DateTime
120
- endDate DateTime
121
- startTime String // Format: "HH:mm"
122
- endTime String // Format: "HH:mm"
123
-
80
+ id String @id @default(cuid())
81
+ name String
82
+ description String
83
+ startDate DateTime
84
+ endDate DateTime
85
+ startTime String
86
+ endTime String
124
87
  capacity Int
125
88
  coverPicture String
126
89
  badge String
127
- tags String[] // Array of tags
128
- accessType EventAccess @default(FREE)
129
- visibility EventVisibility @default(PUBLIC)
130
- prices EventPrice[] // Remove the previous price field
131
- chat Chat? // Optional one-to-one relation
132
- status EventStatus @default(DRAFT)
133
-
134
- categories EventCategory[]
135
-
136
- address Address @relation(fields: [addressId], references: [id])
137
- addressId String
138
-
139
- postedBy User @relation(fields: [postedById], references: [id])
140
- postedById String
141
-
142
- createdAt DateTime @default(now())
143
- updatedAt DateTime @updatedAt
144
-
145
- favorites Favorite[]
146
-
147
- orders Order[]
148
- providers ProviderOnEvent[]
90
+ tags String[]
91
+ accessType EventAccess @default(FREE)
92
+ visibility EventVisibility @default(PUBLIC)
93
+ status EventStatus @default(DRAFT)
94
+ addressId String
95
+ postedById String
96
+ createdAt DateTime @default(now())
97
+ updatedAt DateTime @updatedAt
98
+ chat Chat?
99
+ address Address @relation(fields: [addressId], references: [id])
100
+ postedBy User @relation(fields: [postedById], references: [id])
101
+ prices EventPrice[]
102
+ favorites Favorite[]
103
+ orders Order[]
104
+ categories EventCategory[] @relation("EventToEventCategory")
105
+ providers ProviderOnEvent[]
149
106
  }
150
107
 
151
108
  model EventPrice {
152
- id String @id @default(uuid())
153
- name String // e.g., "Early Bird", "VIP", "Regular"
109
+ id String @id @default(uuid())
110
+ name String
154
111
  amount Float
155
112
  description String?
156
- event Event @relation(fields: [eventId], references: [id])
157
113
  eventId String
158
-
159
- // Add relation to OrderItem
160
- orderItems OrderItem[]
161
-
162
- createdAt DateTime @default(now())
163
- updatedAt DateTime @updatedAt
114
+ createdAt DateTime @default(now())
115
+ updatedAt DateTime @updatedAt
116
+ event Event @relation(fields: [eventId], references: [id])
117
+ orderItems OrderItem[]
164
118
  }
165
119
 
166
120
  model Chat {
167
- id String @id @default(cuid())
168
- name String
169
- event Event @relation(fields: [eventId], references: [id])
170
- eventId String @unique // One-to-one relation with Event
171
- messages Message[]
172
- users ChatUser[]
173
-
174
- createdAt DateTime @default(now())
175
- updatedAt DateTime @updatedAt
121
+ id String @id @default(cuid())
122
+ name String
123
+ eventId String @unique
124
+ createdAt DateTime @default(now())
125
+ updatedAt DateTime @updatedAt
126
+ event Event @relation(fields: [eventId], references: [id])
127
+ users ChatUser[]
128
+ messages Message[]
176
129
  }
177
130
 
178
131
  model ChatUser {
179
- id String @id @default(cuid())
180
- chat Chat @relation(fields: [chatId], references: [id])
181
- chatId String
182
- user User @relation(fields: [userId], references: [id])
183
- userId String
184
-
132
+ id String @id @default(cuid())
133
+ chatId String
134
+ userId String
185
135
  createdAt DateTime @default(now())
186
136
  updatedAt DateTime @updatedAt
187
- }
188
-
189
- enum MediaType {
190
- image
191
- video
192
- audio
193
- pdf
137
+ chat Chat @relation(fields: [chatId], references: [id])
138
+ user User @relation(fields: [userId], references: [id])
194
139
  }
195
140
 
196
141
  model Message {
197
- id String @id @default(cuid())
198
- text String
199
- chat Chat @relation(fields: [chatId], references: [id])
200
- chatId String
201
- sender User @relation(fields: [senderId], references: [id])
202
- senderId String
203
-
204
- mediaUrl String?
205
- mediaType MediaType?
206
-
142
+ id String @id @default(cuid())
143
+ chatId String
144
+ senderId String
207
145
  createdAt DateTime @default(now())
208
146
  updatedAt DateTime @updatedAt
209
- }
210
-
211
- enum NotificationType {
212
- NEW_MESSAGE
213
- EVENT_REMINDER
214
- EVENT_PARTICIPATION_CONFIRMATION
147
+ files Json?
148
+ text String
149
+ chat Chat @relation(fields: [chatId], references: [id])
150
+ sender User @relation(fields: [senderId], references: [id])
215
151
  }
216
152
 
217
153
  model Notification {
218
154
  id String @id @default(cuid())
219
- notifiedTo User @relation("NotificationRecipient", fields: [notifiedToId], references: [id])
220
155
  notifiedToId String
221
- user User? @relation("NotificationSender", fields: [userId], references: [id])
222
156
  userId String?
223
157
  type NotificationType
224
158
  read Boolean @default(false)
225
159
  data Json?
226
-
227
- createdAt DateTime @default(now())
228
- updatedAt DateTime @updatedAt
160
+ createdAt DateTime @default(now())
161
+ updatedAt DateTime @updatedAt
162
+ notifiedTo User @relation("NotificationRecipient", fields: [notifiedToId], references: [id])
163
+ user User? @relation("NotificationSender", fields: [userId], references: [id])
229
164
  }
230
165
 
231
166
  model ProviderCategory {
232
167
  id String @id @default(cuid())
233
168
  name String @unique
234
169
  description String?
170
+ active Boolean @default(true)
171
+ createdAt DateTime @default(now())
172
+ updatedAt DateTime @updatedAt
235
173
  providers Provider[]
236
-
237
- active Boolean @default(true)
238
-
239
- createdAt DateTime @default(now())
240
- updatedAt DateTime @updatedAt
241
- }
242
-
243
- enum ProviderStatus {
244
- PENDING
245
- APPROVED
246
- REJECTED
247
174
  }
248
175
 
249
176
  model Provider {
250
- id String @id @default(cuid())
177
+ id String @id @default(cuid())
251
178
  name String
252
- email String?
253
179
  description String?
254
180
  image String?
181
+ userId String
182
+ status ProviderStatus @default(PENDING)
183
+ createdAt DateTime @default(now())
184
+ updatedAt DateTime @updatedAt
185
+ addressId String?
186
+ categoryId String
187
+ docs Json?
188
+ email String?
255
189
  phoneNumber String?
256
- website String?
257
190
  pricingDetails String?
258
- docs Json?
259
191
  rating Float?
260
-
261
- address Address? @relation(fields: [addressId], references: [id])
262
- addressId String?
263
-
264
- category ProviderCategory @relation(fields: [categoryId], references: [id])
265
- categoryId String
266
-
267
- reviews Review[]
268
-
269
- user User @relation(fields: [userId], references: [id])
270
- userId String
271
-
272
- status ProviderStatus @default(PENDING)
273
-
274
- createdAt DateTime @default(now())
275
- updatedAt DateTime @updatedAt
276
- events ProviderOnEvent[]
277
- }
278
-
279
- enum ProviderOnEventStatus {
280
- PENDING
281
- APPROVED
282
- REJECTED
192
+ website String?
193
+ address Address? @relation(fields: [addressId], references: [id])
194
+ category ProviderCategory @relation(fields: [categoryId], references: [id])
195
+ user User @relation(fields: [userId], references: [id])
196
+ reviews Review[]
197
+ events ProviderOnEvent[]
283
198
  }
284
199
 
285
200
  model ProviderOnEvent {
286
- id String @id @default(cuid())
287
- provider Provider @relation(fields: [providerId], references: [id])
201
+ id String @id @default(cuid())
288
202
  providerId String
289
- event Event @relation(fields: [eventId], references: [id])
203
+ provider Provider @relation(fields: [providerId], references: [id])
290
204
  eventId String
291
- status ProviderOnEventStatus @default(PENDING)
205
+ event Event @relation(fields: [eventId], references: [id])
206
+
207
+ createdAt DateTime @default(now())
208
+ updatedAt DateTime @updatedAt
292
209
  }
293
210
 
294
211
  model Review {
295
212
  id String @id @default(cuid())
296
213
  rating Float
297
214
  comment String?
298
- provider Provider @relation(fields: [providerId], references: [id])
299
215
  providerId String
300
-
301
- user User @relation(fields: [userId], references: [id])
302
- userId String
303
-
304
- createdAt DateTime @default(now())
305
- updatedAt DateTime @updatedAt
216
+ userId String
217
+ createdAt DateTime @default(now())
218
+ updatedAt DateTime @updatedAt
219
+ provider Provider @relation(fields: [providerId], references: [id])
220
+ user User @relation(fields: [userId], references: [id])
306
221
  }
307
222
 
308
223
  model Favorite {
309
- id String @id @default(cuid())
310
- user User @relation(fields: [userId], references: [id])
311
- userId String
312
- event Event @relation(fields: [eventId], references: [id])
313
- eventId String
314
-
224
+ id String @id @default(cuid())
225
+ userId String
226
+ eventId String
315
227
  createdAt DateTime @default(now())
316
228
  updatedAt DateTime @updatedAt
229
+ event Event @relation(fields: [eventId], references: [id])
230
+ user User @relation(fields: [userId], references: [id])
317
231
  }
318
232
 
319
- // Add new Order model
320
233
  model Order {
321
- id String @id @default(cuid())
322
- user User @relation(fields: [userId], references: [id])
323
- userId String
234
+ id String @id @default(cuid())
235
+ userId String
236
+ eventId String
237
+ email String
238
+ status OrderStatus @default(PENDING)
239
+ totalAmount Float
240
+ paymentIntentId String? @unique
241
+ paymentStatus PaymentStatus @default(PENDING)
242
+ createdAt DateTime @default(now())
243
+ updatedAt DateTime @updatedAt
244
+ event Event @relation(fields: [eventId], references: [id])
245
+ user User @relation(fields: [userId], references: [id])
246
+ items OrderItem[]
247
+ }
324
248
 
325
- event Event @relation(fields: [eventId], references: [id])
326
- eventId String
249
+ model OrderItem {
250
+ id String @id @default(cuid())
251
+ orderId String
252
+ eventPriceId String
253
+ quantity Int
254
+ unitPrice Float
255
+ createdAt DateTime @default(now())
256
+ updatedAt DateTime @updatedAt
257
+ eventPrice EventPrice @relation(fields: [eventPriceId], references: [id])
258
+ order Order @relation(fields: [orderId], references: [id])
259
+ }
327
260
 
328
- email String
329
- status OrderStatus @default(PENDING)
330
- totalAmount Float
261
+ model UserInterests {
262
+ id String @id @default(cuid())
331
263
 
332
- items OrderItem[]
264
+ interests EventCategory[]
333
265
 
334
- paymentIntentId String? @unique // For Stripe integration
335
- paymentStatus PaymentStatus @default(PENDING)
266
+ userId String @unique
267
+ user User @relation(fields: [userId], references: [id])
336
268
 
337
269
  createdAt DateTime @default(now())
338
270
  updatedAt DateTime @updatedAt
339
271
  }
340
272
 
341
- // Add new OrderItem model
342
- model OrderItem {
343
- id String @id @default(cuid())
344
- order Order @relation(fields: [orderId], references: [id])
345
- orderId String
273
+ enum UserRole {
274
+ SUPER_ADMIN
275
+ ADMIN
276
+ USER
277
+ }
346
278
 
347
- eventPrice EventPrice @relation(fields: [eventPriceId], references: [id])
348
- eventPriceId String
279
+ enum UserStatus {
280
+ ACTIVE
281
+ INACTIVE
282
+ DELETED
283
+ }
349
284
 
350
- quantity Int
351
- unitPrice Float // Price at the time of purchase
285
+ enum EventAccess {
286
+ FREE
287
+ PAID
288
+ }
352
289
 
353
- createdAt DateTime @default(now())
354
- updatedAt DateTime @updatedAt
290
+ enum EventVisibility {
291
+ PUBLIC
292
+ PRIVATE
293
+ }
294
+
295
+ enum EventStatus {
296
+ DRAFT
297
+ PUBLISHED
298
+ PENDING
299
+ CANCELLED
300
+ }
301
+
302
+ enum MediaType {
303
+ image
304
+ video
305
+ audio
306
+ pdf
307
+ }
308
+
309
+ enum NotificationType {
310
+ NEW_MESSAGE
311
+ EVENT_REMINDER
312
+ EVENT_PARTICIPATION_CONFIRMATION
313
+ EVENT_VALIDATION
314
+ EVENT_REJECTION
315
+ EVENT_ASSIGNMENT
316
+ EVENT_ASSIGNMENT_APPROVAL
317
+ EVENT_ASSIGNMENT_REJECTION
318
+ }
319
+
320
+ enum ProviderStatus {
321
+ PENDING
322
+ APPROVED
323
+ REJECTED
355
324
  }
356
325
 
357
326
  enum OrderStatus {
@@ -367,3 +336,12 @@ enum PaymentStatus {
367
336
  FAILED
368
337
  REFUNDED
369
338
  }
339
+
340
+ model Newsletter {
341
+ id String @id @default(cuid())
342
+ email String @unique
343
+ unsubscribedAt DateTime?
344
+
345
+ createdAt DateTime @default(now())
346
+ updatedAt DateTime @updatedAt
347
+ }