From 8902e0dafbb2390cec4002a9b8cf9f9d0783a843 Mon Sep 17 00:00:00 2001 From: Sonali Shakya Date: Tue, 14 Jan 2025 18:36:47 +0530 Subject: [PATCH] Migration + Template fix --- .../migration.sql | 77 --------- .../seeding/Retail_searchByCatalog.json | 152 +++++++++--------- 2 files changed, 79 insertions(+), 150 deletions(-) delete mode 100644 deeplink-generator/prisma/migrations/20250113062321_init_13_01_25/migration.sql diff --git a/deeplink-generator/prisma/migrations/20250113062321_init_13_01_25/migration.sql b/deeplink-generator/prisma/migrations/20250113062321_init_13_01_25/migration.sql deleted file mode 100644 index bc1b672..0000000 --- a/deeplink-generator/prisma/migrations/20250113062321_init_13_01_25/migration.sql +++ /dev/null @@ -1,77 +0,0 @@ --- CreateEnum -CREATE TYPE "TemplateStage" AS ENUM ('DRAFT', 'REVIEW', 'SUBMITTED', 'PUBLISHED'); - --- CreateEnum -CREATE TYPE "UsecaseStage" AS ENUM ('DRAFT', 'REVIEW', 'SUBMITTED', 'PUBLISHED'); - --- CreateTable -CREATE TABLE "Template" ( - "id" TEXT NOT NULL DEFAULT substr(gen_random_uuid()::text, 1, 16), - "name" TEXT, - "description" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "value" JSONB NOT NULL, - "templateStage" "TemplateStage" NOT NULL, - "usecaseCategoryId" TEXT, - "usecaseSubcategoryId" TEXT, - - CONSTRAINT "Template_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Usecase" ( - "id" TEXT NOT NULL DEFAULT substr(gen_random_uuid()::text, 1, 16), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "value" JSONB NOT NULL, - "templateId" TEXT NOT NULL, - "name" TEXT, - "description" TEXT, - "creatorName" TEXT, - "qrPdfLink" TEXT, - "usecaseStage" "UsecaseStage" NOT NULL, - - CONSTRAINT "Usecase_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "UsecaseCategory" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - - CONSTRAINT "UsecaseCategory_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "UsecaseSubcategory" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "usecaseCategoryId" TEXT NOT NULL, - - CONSTRAINT "UsecaseSubcategory_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Template_usecaseCategoryId_usecaseSubcategoryId_idx" ON "Template"("usecaseCategoryId", "usecaseSubcategoryId"); - --- CreateIndex -CREATE UNIQUE INDEX "Template_usecaseCategoryId_usecaseSubcategoryId_key" ON "Template"("usecaseCategoryId", "usecaseSubcategoryId"); - --- CreateIndex -CREATE UNIQUE INDEX "UsecaseCategory_name_key" ON "UsecaseCategory"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "UsecaseSubcategory_name_key" ON "UsecaseSubcategory"("name"); - --- AddForeignKey -ALTER TABLE "Template" ADD CONSTRAINT "Template_usecaseCategoryId_fkey" FOREIGN KEY ("usecaseCategoryId") REFERENCES "UsecaseCategory"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Template" ADD CONSTRAINT "Template_usecaseSubcategoryId_fkey" FOREIGN KEY ("usecaseSubcategoryId") REFERENCES "UsecaseSubcategory"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Usecase" ADD CONSTRAINT "Usecase_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "UsecaseSubcategory" ADD CONSTRAINT "UsecaseSubcategory_usecaseCategoryId_fkey" FOREIGN KEY ("usecaseCategoryId") REFERENCES "UsecaseCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/deeplink-generator/seeding/Retail_searchByCatalog.json b/deeplink-generator/seeding/Retail_searchByCatalog.json index b99855b..4310566 100644 --- a/deeplink-generator/seeding/Retail_searchByCatalog.json +++ b/deeplink-generator/seeding/Retail_searchByCatalog.json @@ -1,77 +1,83 @@ { - "name": "SearchByCatalog", - "description": "Template to return an entire catalog for a particular seller", - "value": { - "context": { - "domain": { - "type": "string", - "filler": "user", - "enum": [ - { - "name": "Grocery", - "value": "ONDC:RET10" - }, - { - "name": "Fashion", - "value": "ONDC:RET12" - }, - { - "name": "BPC", - "value": "ONDC:RET13" - } - ], - "onChange": "updateCategoryValues" - }, - "action": "search", - "country": { - "filler": "pg", - "type": "string" - }, - "city": { - "filler": "pg", - "type": "string" - }, - "core_version": "1.2.0", - "bap_id": { - "filler": "pg", - "type": "string" - }, - "bap_uri": { - "filler": "pg", - "type": "string" - }, - "bpp_id": { - "filler": "user", - "type": "string" - }, - "bpp_uri": { - "filler": "user", - "type": "string" - }, - "transaction_id": { - "filler": "pg", - "type": "string" - }, - "message_id": { - "filler": "pg", - "type": "string" - }, - "timestamp": { - "filler": "pg", - "type": "string" - }, - "ttl": "PT30S" + "name": "SearchByCatalog", + "description": "Template to return an entire catalog for a particular seller", + "value": { + "context": { + "domain": { + "type": "string", + "filler": "user", + "enum": [ + { + "name": "Grocery", + "value": "ONDC:RET10" + }, + { + "name": "Fashion", + "value": "ONDC:RET12" + }, + { + "name": "BPC", + "value": "ONDC:RET13" + } + ], + "onChange": "updateCategoryValues" }, - "message": { - "intent": { - "payment": { - "@ondc/org/buyer_app_finder_fee_type": "percent", - "@ondc/org/buyer_app_finder_fee_amount": "5" - } + "action": "search", + "country": { + "filler": "pg", + "type": "string" + }, + "city": { + "filler": "pg", + "type": "string" + }, + "core_version": "1.2.0", + "bap_id": { + "filler": "pg", + "type": "string" + }, + "bap_uri": { + "filler": "pg", + "type": "string" + }, + "bpp_id": { + "filler": "user", + "type": "string" + }, + "bpp_uri": { + "filler": "user", + "type": "string" + }, + "transaction_id": { + "filler": "pg", + "type": "string" + }, + "message_id": { + "filler": "pg", + "type": "string" + }, + "timestamp": { + "filler": "pg", + "type": "string" + }, + "ttl": "PT30S" + }, + "message": { + "intent": { + "provider": { + "id": { + "filler": "user", + "type": "string" } + }, + "payment": { + "@ondc/org/buyer_app_finder_fee_type": "percent", + "@ondc/org/buyer_app_finder_fee_amount": "5" } - }, - "templateStage": "SUBMITTED", - "category": "Retail", - "subCategory": "Seller-Catalog Search" - } \ No newline at end of file + } + } + }, + "templateStage": "SUBMITTED", + "category": "Retail", + "subCategory": "Seller-Catalog Search" +}