@optimatech88/titomeet-shared-lib 1.0.20 → 1.0.21
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 +1 -1
- package/prisma/migrations/20250401154936_updates/migration.sql +79 -0
- package/prisma/migrations/20250401164742_added_orders/migration.sql +143 -0
- package/prisma/migrations/20250401072440_added_orderetable/migration.sql +0 -64
- package/prisma/migrations/20250401091313_added_event_id/migration.sql +0 -14
package/package.json
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- The values [PENDING,CANCELLED] on the enum `EventStatus` will be removed. If these variants are still used in the database, this will fail.
|
|
5
|
+
- You are about to drop the column `countryCode` on the `Address` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `latitude` on the `Address` table. All the data in the column will be lost.
|
|
7
|
+
- You are about to drop the column `longitude` on the `Address` table. All the data in the column will be lost.
|
|
8
|
+
- You are about to drop the column `type` on the `Address` table. All the data in the column will be lost.
|
|
9
|
+
- You are about to drop the column `addressId` on the `Provider` table. All the data in the column will be lost.
|
|
10
|
+
- You are about to drop the column `categoryId` on the `Provider` table. All the data in the column will be lost.
|
|
11
|
+
- You are about to drop the column `rating` on the `Provider` table. All the data in the column will be lost.
|
|
12
|
+
- You are about to drop the `Favorite` table. If the table is not empty, all the data it contains will be lost.
|
|
13
|
+
- You are about to drop the `ProviderCategory` table. If the table is not empty, all the data it contains will be lost.
|
|
14
|
+
- You are about to drop the `Review` table. If the table is not empty, all the data it contains will be lost.
|
|
15
|
+
- Made the column `city` on table `Address` required. This step will fail if there are existing NULL values in that column.
|
|
16
|
+
- Made the column `state` on table `Address` required. This step will fail if there are existing NULL values in that column.
|
|
17
|
+
- Made the column `postalCode` on table `Address` required. This step will fail if there are existing NULL values in that column.
|
|
18
|
+
|
|
19
|
+
*/
|
|
20
|
+
-- CreateEnum
|
|
21
|
+
CREATE TYPE "OrderStatus" AS ENUM ('PENDING', 'CONFIRMED', 'CANCELLED', 'REFUNDED');
|
|
22
|
+
|
|
23
|
+
-- CreateEnum
|
|
24
|
+
CREATE TYPE "PaymentStatus" AS ENUM ('PENDING', 'COMPLETED', 'FAILED', 'REFUNDED');
|
|
25
|
+
|
|
26
|
+
-- AlterEnum
|
|
27
|
+
BEGIN;
|
|
28
|
+
CREATE TYPE "EventStatus_new" AS ENUM ('DRAFT', 'PUBLISHED');
|
|
29
|
+
ALTER TABLE "Event" ALTER COLUMN "status" DROP DEFAULT;
|
|
30
|
+
ALTER TABLE "Event" ALTER COLUMN "status" TYPE "EventStatus_new" USING ("status"::text::"EventStatus_new");
|
|
31
|
+
ALTER TYPE "EventStatus" RENAME TO "EventStatus_old";
|
|
32
|
+
ALTER TYPE "EventStatus_new" RENAME TO "EventStatus";
|
|
33
|
+
DROP TYPE "EventStatus_old";
|
|
34
|
+
ALTER TABLE "Event" ALTER COLUMN "status" SET DEFAULT 'DRAFT';
|
|
35
|
+
COMMIT;
|
|
36
|
+
|
|
37
|
+
-- DropForeignKey
|
|
38
|
+
ALTER TABLE "Favorite" DROP CONSTRAINT "Favorite_eventId_fkey";
|
|
39
|
+
|
|
40
|
+
-- DropForeignKey
|
|
41
|
+
ALTER TABLE "Favorite" DROP CONSTRAINT "Favorite_userId_fkey";
|
|
42
|
+
|
|
43
|
+
-- DropForeignKey
|
|
44
|
+
ALTER TABLE "Provider" DROP CONSTRAINT "Provider_addressId_fkey";
|
|
45
|
+
|
|
46
|
+
-- DropForeignKey
|
|
47
|
+
ALTER TABLE "Provider" DROP CONSTRAINT "Provider_categoryId_fkey";
|
|
48
|
+
|
|
49
|
+
-- DropForeignKey
|
|
50
|
+
ALTER TABLE "Review" DROP CONSTRAINT "Review_providerId_fkey";
|
|
51
|
+
|
|
52
|
+
-- DropForeignKey
|
|
53
|
+
ALTER TABLE "Review" DROP CONSTRAINT "Review_userId_fkey";
|
|
54
|
+
|
|
55
|
+
-- DropIndex
|
|
56
|
+
DROP INDEX "EventCategory_name_key";
|
|
57
|
+
|
|
58
|
+
-- AlterTable
|
|
59
|
+
ALTER TABLE "Address" DROP COLUMN "countryCode",
|
|
60
|
+
DROP COLUMN "latitude",
|
|
61
|
+
DROP COLUMN "longitude",
|
|
62
|
+
DROP COLUMN "type",
|
|
63
|
+
ALTER COLUMN "city" SET NOT NULL,
|
|
64
|
+
ALTER COLUMN "state" SET NOT NULL,
|
|
65
|
+
ALTER COLUMN "postalCode" SET NOT NULL;
|
|
66
|
+
|
|
67
|
+
-- AlterTable
|
|
68
|
+
ALTER TABLE "Provider" DROP COLUMN "addressId",
|
|
69
|
+
DROP COLUMN "categoryId",
|
|
70
|
+
DROP COLUMN "rating";
|
|
71
|
+
|
|
72
|
+
-- DropTable
|
|
73
|
+
DROP TABLE "Favorite";
|
|
74
|
+
|
|
75
|
+
-- DropTable
|
|
76
|
+
DROP TABLE "ProviderCategory";
|
|
77
|
+
|
|
78
|
+
-- DropTable
|
|
79
|
+
DROP TABLE "Review";
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- A unique constraint covering the columns `[name]` on the table `EventCategory` will be added. If there are existing duplicate values, this will fail.
|
|
5
|
+
- Added the required column `categoryId` to the `Provider` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- AlterEnum
|
|
9
|
+
-- This migration adds more than one value to an enum.
|
|
10
|
+
-- With PostgreSQL versions 11 and earlier, this is not possible
|
|
11
|
+
-- in a single migration. This can be worked around by creating
|
|
12
|
+
-- multiple migrations, each migration adding only one value to
|
|
13
|
+
-- the enum.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
ALTER TYPE "EventStatus" ADD VALUE 'PENDING';
|
|
17
|
+
ALTER TYPE "EventStatus" ADD VALUE 'CANCELLED';
|
|
18
|
+
|
|
19
|
+
-- AlterTable
|
|
20
|
+
ALTER TABLE "Address" ADD COLUMN "countryCode" TEXT,
|
|
21
|
+
ADD COLUMN "latitude" DOUBLE PRECISION,
|
|
22
|
+
ADD COLUMN "longitude" DOUBLE PRECISION,
|
|
23
|
+
ADD COLUMN "type" TEXT NOT NULL DEFAULT 'suburb',
|
|
24
|
+
ALTER COLUMN "city" DROP NOT NULL,
|
|
25
|
+
ALTER COLUMN "state" DROP NOT NULL,
|
|
26
|
+
ALTER COLUMN "postalCode" DROP NOT NULL;
|
|
27
|
+
|
|
28
|
+
-- AlterTable
|
|
29
|
+
ALTER TABLE "EventCategory" ADD COLUMN "active" BOOLEAN NOT NULL DEFAULT true;
|
|
30
|
+
|
|
31
|
+
-- AlterTable
|
|
32
|
+
ALTER TABLE "Provider" ADD COLUMN "addressId" TEXT,
|
|
33
|
+
ADD COLUMN "categoryId" TEXT NOT NULL,
|
|
34
|
+
ADD COLUMN "docs" JSONB,
|
|
35
|
+
ADD COLUMN "email" TEXT,
|
|
36
|
+
ADD COLUMN "phoneNumber" TEXT,
|
|
37
|
+
ADD COLUMN "pricingDetails" TEXT,
|
|
38
|
+
ADD COLUMN "rating" DOUBLE PRECISION,
|
|
39
|
+
ADD COLUMN "website" TEXT;
|
|
40
|
+
|
|
41
|
+
-- CreateTable
|
|
42
|
+
CREATE TABLE "ProviderCategory" (
|
|
43
|
+
"id" TEXT NOT NULL,
|
|
44
|
+
"name" TEXT NOT NULL,
|
|
45
|
+
"description" TEXT,
|
|
46
|
+
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
47
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
48
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
49
|
+
|
|
50
|
+
CONSTRAINT "ProviderCategory_pkey" PRIMARY KEY ("id")
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
-- CreateTable
|
|
54
|
+
CREATE TABLE "Review" (
|
|
55
|
+
"id" TEXT NOT NULL,
|
|
56
|
+
"rating" DOUBLE PRECISION NOT NULL,
|
|
57
|
+
"comment" TEXT,
|
|
58
|
+
"providerId" TEXT NOT NULL,
|
|
59
|
+
"userId" TEXT NOT NULL,
|
|
60
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
61
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
62
|
+
|
|
63
|
+
CONSTRAINT "Review_pkey" PRIMARY KEY ("id")
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
-- CreateTable
|
|
67
|
+
CREATE TABLE "Favorite" (
|
|
68
|
+
"id" TEXT NOT NULL,
|
|
69
|
+
"userId" TEXT NOT NULL,
|
|
70
|
+
"eventId" TEXT NOT NULL,
|
|
71
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
72
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
73
|
+
|
|
74
|
+
CONSTRAINT "Favorite_pkey" PRIMARY KEY ("id")
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
-- CreateTable
|
|
78
|
+
CREATE TABLE "Order" (
|
|
79
|
+
"id" TEXT NOT NULL,
|
|
80
|
+
"userId" TEXT NOT NULL,
|
|
81
|
+
"eventId" TEXT NOT NULL,
|
|
82
|
+
"email" TEXT NOT NULL,
|
|
83
|
+
"status" "OrderStatus" NOT NULL DEFAULT 'PENDING',
|
|
84
|
+
"totalAmount" DOUBLE PRECISION NOT NULL,
|
|
85
|
+
"paymentIntentId" TEXT,
|
|
86
|
+
"paymentStatus" "PaymentStatus" NOT NULL DEFAULT 'PENDING',
|
|
87
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
88
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
89
|
+
|
|
90
|
+
CONSTRAINT "Order_pkey" PRIMARY KEY ("id")
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
-- CreateTable
|
|
94
|
+
CREATE TABLE "OrderItem" (
|
|
95
|
+
"id" TEXT NOT NULL,
|
|
96
|
+
"orderId" TEXT NOT NULL,
|
|
97
|
+
"eventPriceId" TEXT NOT NULL,
|
|
98
|
+
"quantity" INTEGER NOT NULL,
|
|
99
|
+
"unitPrice" DOUBLE PRECISION NOT NULL,
|
|
100
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
101
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
102
|
+
|
|
103
|
+
CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id")
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
-- CreateIndex
|
|
107
|
+
CREATE UNIQUE INDEX "ProviderCategory_name_key" ON "ProviderCategory"("name");
|
|
108
|
+
|
|
109
|
+
-- CreateIndex
|
|
110
|
+
CREATE UNIQUE INDEX "Order_paymentIntentId_key" ON "Order"("paymentIntentId");
|
|
111
|
+
|
|
112
|
+
-- CreateIndex
|
|
113
|
+
CREATE UNIQUE INDEX "EventCategory_name_key" ON "EventCategory"("name");
|
|
114
|
+
|
|
115
|
+
-- AddForeignKey
|
|
116
|
+
ALTER TABLE "Provider" ADD CONSTRAINT "Provider_addressId_fkey" FOREIGN KEY ("addressId") REFERENCES "Address"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
117
|
+
|
|
118
|
+
-- AddForeignKey
|
|
119
|
+
ALTER TABLE "Provider" ADD CONSTRAINT "Provider_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "ProviderCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
120
|
+
|
|
121
|
+
-- AddForeignKey
|
|
122
|
+
ALTER TABLE "Review" ADD CONSTRAINT "Review_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "Provider"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
123
|
+
|
|
124
|
+
-- AddForeignKey
|
|
125
|
+
ALTER TABLE "Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
126
|
+
|
|
127
|
+
-- AddForeignKey
|
|
128
|
+
ALTER TABLE "Favorite" ADD CONSTRAINT "Favorite_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
129
|
+
|
|
130
|
+
-- AddForeignKey
|
|
131
|
+
ALTER TABLE "Favorite" ADD CONSTRAINT "Favorite_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
132
|
+
|
|
133
|
+
-- AddForeignKey
|
|
134
|
+
ALTER TABLE "Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
135
|
+
|
|
136
|
+
-- AddForeignKey
|
|
137
|
+
ALTER TABLE "Order" ADD CONSTRAINT "Order_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
138
|
+
|
|
139
|
+
-- AddForeignKey
|
|
140
|
+
ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
141
|
+
|
|
142
|
+
-- AddForeignKey
|
|
143
|
+
ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_eventPriceId_fkey" FOREIGN KEY ("eventPriceId") REFERENCES "EventPrice"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -1,64 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- Added the required column `eventId` to the `Order` table without a default value. This is not possible if the table is not empty.
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE "Order" ADD COLUMN "eventId" TEXT NOT NULL;
|
|
9
|
-
|
|
10
|
-
-- AlterTable
|
|
11
|
-
ALTER TABLE "Provider" ALTER COLUMN "email" DROP NOT NULL;
|
|
12
|
-
|
|
13
|
-
-- AddForeignKey
|
|
14
|
-
ALTER TABLE "Order" ADD CONSTRAINT "Order_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|