@optimatech88/titomeet-shared-lib 1.0.17 → 1.0.19

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.17",
3
+ "version": "1.0.19",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,64 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - Added the required column `email` to the `Provider` table without a default value. This is not possible if the table is not empty.
5
+
6
+ */
7
+ -- CreateEnum
8
+ CREATE TYPE "OrderStatus" AS ENUM ('PENDING', 'CONFIRMED', 'CANCELLED', 'REFUNDED');
9
+
10
+ -- CreateEnum
11
+ CREATE TYPE "PaymentStatus" AS ENUM ('PENDING', 'COMPLETED', 'FAILED', 'REFUNDED');
12
+
13
+ -- AlterTable
14
+ ALTER TABLE "EventCategory" ADD COLUMN "active" BOOLEAN NOT NULL DEFAULT true;
15
+
16
+ -- AlterTable
17
+ ALTER TABLE "Provider" ADD COLUMN "docs" JSONB,
18
+ ADD COLUMN "email" TEXT NOT NULL,
19
+ ADD COLUMN "phoneNumber" TEXT,
20
+ ADD COLUMN "pricingDetails" TEXT,
21
+ ADD COLUMN "website" TEXT;
22
+
23
+ -- AlterTable
24
+ ALTER TABLE "ProviderCategory" ADD COLUMN "active" BOOLEAN NOT NULL DEFAULT true;
25
+
26
+ -- CreateTable
27
+ CREATE TABLE "Order" (
28
+ "id" TEXT NOT NULL,
29
+ "userId" TEXT NOT NULL,
30
+ "email" TEXT NOT NULL,
31
+ "status" "OrderStatus" NOT NULL DEFAULT 'PENDING',
32
+ "totalAmount" DOUBLE PRECISION NOT NULL,
33
+ "paymentIntentId" TEXT,
34
+ "paymentStatus" "PaymentStatus" NOT NULL DEFAULT 'PENDING',
35
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
36
+ "updatedAt" TIMESTAMP(3) NOT NULL,
37
+
38
+ CONSTRAINT "Order_pkey" PRIMARY KEY ("id")
39
+ );
40
+
41
+ -- CreateTable
42
+ CREATE TABLE "OrderItem" (
43
+ "id" TEXT NOT NULL,
44
+ "orderId" TEXT NOT NULL,
45
+ "eventPriceId" TEXT NOT NULL,
46
+ "quantity" INTEGER NOT NULL,
47
+ "unitPrice" DOUBLE PRECISION NOT NULL,
48
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
49
+ "updatedAt" TIMESTAMP(3) NOT NULL,
50
+
51
+ CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id")
52
+ );
53
+
54
+ -- CreateIndex
55
+ CREATE UNIQUE INDEX "Order_paymentIntentId_key" ON "Order"("paymentIntentId");
56
+
57
+ -- AddForeignKey
58
+ ALTER TABLE "Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
59
+
60
+ -- AddForeignKey
61
+ ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
62
+
63
+ -- AddForeignKey
64
+ ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_eventPriceId_fkey" FOREIGN KEY ("eventPriceId") REFERENCES "EventPrice"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -44,6 +44,7 @@ model User {
44
44
  reviews Review[]
45
45
 
46
46
  favorites Favorite[]
47
+ orders Order[]
47
48
  }
48
49
 
49
50
  model Account {
@@ -91,6 +92,8 @@ model EventCategory {
91
92
  description String?
92
93
  events Event[]
93
94
 
95
+ active Boolean @default(true)
96
+
94
97
  createdAt DateTime @default(now())
95
98
  updatedAt DateTime @updatedAt
96
99
  }
@@ -147,6 +150,9 @@ model EventPrice {
147
150
  description String?
148
151
  event Event @relation(fields: [eventId], references: [id])
149
152
  eventId String
153
+
154
+ // Add relation to OrderItem
155
+ orderItems OrderItem[]
150
156
 
151
157
  createdAt DateTime @default(now())
152
158
  updatedAt DateTime @updatedAt
@@ -222,6 +228,8 @@ model ProviderCategory {
222
228
  description String?
223
229
  providers Provider[]
224
230
 
231
+ active Boolean @default(true)
232
+
225
233
  createdAt DateTime @default(now())
226
234
  updatedAt DateTime @updatedAt
227
235
  }
@@ -235,8 +243,13 @@ enum ProviderStatus {
235
243
  model Provider {
236
244
  id String @id @default(cuid())
237
245
  name String
246
+ email String?
238
247
  description String?
239
248
  image String?
249
+ phoneNumber String?
250
+ website String?
251
+ pricingDetails String?
252
+ docs Json?
240
253
  rating Float?
241
254
 
242
255
  address Address? @relation(fields: [addressId], references: [id])
@@ -281,4 +294,53 @@ model Favorite {
281
294
 
282
295
  createdAt DateTime @default(now())
283
296
  updatedAt DateTime @updatedAt
297
+ }
298
+
299
+ // Add new Order model
300
+ model Order {
301
+ id String @id @default(cuid())
302
+ user User @relation(fields: [userId], references: [id])
303
+ userId String
304
+
305
+ email String
306
+ status OrderStatus @default(PENDING)
307
+ totalAmount Float
308
+
309
+ items OrderItem[]
310
+
311
+ paymentIntentId String? @unique // For Stripe integration
312
+ paymentStatus PaymentStatus @default(PENDING)
313
+
314
+ createdAt DateTime @default(now())
315
+ updatedAt DateTime @updatedAt
316
+ }
317
+
318
+ // Add new OrderItem model
319
+ model OrderItem {
320
+ id String @id @default(cuid())
321
+ order Order @relation(fields: [orderId], references: [id])
322
+ orderId String
323
+
324
+ eventPrice EventPrice @relation(fields: [eventPriceId], references: [id])
325
+ eventPriceId String
326
+
327
+ quantity Int
328
+ unitPrice Float // Price at the time of purchase
329
+
330
+ createdAt DateTime @default(now())
331
+ updatedAt DateTime @updatedAt
332
+ }
333
+
334
+ enum OrderStatus {
335
+ PENDING
336
+ CONFIRMED
337
+ CANCELLED
338
+ REFUNDED
339
+ }
340
+
341
+ enum PaymentStatus {
342
+ PENDING
343
+ COMPLETED
344
+ FAILED
345
+ REFUNDED
284
346
  }