fix - noms produits

This commit is contained in:
cedric committed 2022-12-03 15:19:37 +01:00
1 parent cce6fa777d
commit 3d8f792d7e
12 files changed
+18 -136

No files matched your search

@@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Gain" ADD COLUMN "disponible" BOOLEAN NOT NULL DEFAULT true;
@@ -1,9 +0,0 @@
/*
Warnings:
- You are about to drop the column `disponible` on the `Gain` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Gain" DROP COLUMN "disponible",
ADD COLUMN "actif" BOOLEAN NOT NULL DEFAULT true;
@@ -1,31 +0,0 @@
/*
Warnings:
- You are about to alter the column `prixTtc` on the `Produit` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`.
- You are about to drop the `Post` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `Profile` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Post" DROP CONSTRAINT "Post_authorId_fkey";
-- DropForeignKey
ALTER TABLE "Profile" DROP CONSTRAINT "Profile_userId_fkey";
-- DropIndex
DROP INDEX "Gain_userId_key";
-- AlterTable
ALTER TABLE "Produit" ALTER COLUMN "prixTtc" SET DATA TYPE INTEGER;
-- AlterTable
ALTER TABLE "users" ADD COLUMN "address" TEXT,
ADD COLUMN "phoneNumber" TEXT,
ADD COLUMN "surname" TEXT,
ADD COLUMN "zipCode" TEXT;
-- DropTable
DROP TABLE "Post";
-- DropTable
DROP TABLE "Profile";
@@ -1,9 +0,0 @@
/*
Warnings:
- The `phoneNumber` column on the `users` table would be dropped and recreated. This will lead to data loss if there is data in the column.
*/
-- AlterTable
ALTER TABLE "users" DROP COLUMN "phoneNumber",
ADD COLUMN "phoneNumber" INTEGER;
@@ -1,9 +0,0 @@
/*
Warnings:
- The `zipCode` column on the `users` table would be dropped and recreated. This will lead to data loss if there is data in the column.
*/
-- AlterTable
ALTER TABLE "users" DROP COLUMN "zipCode",
ADD COLUMN "zipCode" INTEGER;
@@ -35,6 +35,10 @@ CREATE TABLE "sessions" (
CREATE TABLE "users" (
"id" SERIAL NOT NULL,
"name" TEXT,
"surname" TEXT,
"address" TEXT,
"zipCode" INTEGER,
"phoneNumber" INTEGER,
"email" TEXT,
"email_verified" TIMESTAMP(3),
"image" TEXT,
@@ -45,26 +49,6 @@ CREATE TABLE "users" (
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Post" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT,
"published" BOOLEAN NOT NULL DEFAULT false,
"authorId" INTEGER,
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Profile" (
"id" SERIAL NOT NULL,
"bio" TEXT,
"userId" INTEGER NOT NULL,
CONSTRAINT "Profile_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "TicketsRestants" (
"id" SERIAL NOT NULL,
@@ -80,6 +64,7 @@ CREATE TABLE "Gain" (
"dateRetrait" TIMESTAMP(3),
"produitId" INTEGER,
"userId" INTEGER,
"actif" BOOLEAN NOT NULL DEFAULT true,
CONSTRAINT "Gain_pkey" PRIMARY KEY ("id")
);
@@ -89,7 +74,7 @@ CREATE TABLE "Produit" (
"id" SERIAL NOT NULL,
"actif" BOOLEAN,
"nomProduit" TEXT,
"prixTtc" DECIMAL(65,30),
"prixTtc" INTEGER,
CONSTRAINT "Produit_pkey" PRIMARY KEY ("id")
);
@@ -110,15 +95,9 @@ CREATE UNIQUE INDEX "sessions_session_token_key" ON "sessions"("session_token");
-- CreateIndex
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Profile_userId_key" ON "Profile"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "Gain_codeCadeau_key" ON "Gain"("codeCadeau");
-- CreateIndex
CREATE UNIQUE INDEX "Gain_userId_key" ON "Gain"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "verificationtokens_token_key" ON "verificationtokens"("token");
@@ -131,12 +110,6 @@ ALTER TABLE "accounts" ADD CONSTRAINT "accounts_user_id_fkey" FOREIGN KEY ("user
-- AddForeignKey
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Profile" ADD CONSTRAINT "Profile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Gain" ADD CONSTRAINT "Gain_produitId_fkey" FOREIGN KEY ("produitId") REFERENCES "Produit"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+2 -2
View File
@@ -18,8 +18,8 @@ export const generateGains = async () => {
//crétion d'un id de produit de façon pondérée
let weightedRandomGain = chance.weighted([
Cadeaux.CoffretDecouvert69,
Cadeaux.CoffretDecouvert39,
Cadeaux.GrandCoffretDecouverte,
Cadeaux.CoffretDecouverte,
Cadeaux.TheSignature,
Cadeaux.TheDetox,
Cadeaux.Infuseur],
+5 -5
View File
@@ -2,23 +2,23 @@ import { Prisma } from "@prisma/client";
export const produitsData: Prisma.ProduitCreateInput[] = [
{
nomProduit: 'coffret découverte à 69€',
nomProduit: 'Grand coffret découverte',
prixTtc: 69,
},
{
nomProduit: 'coffret découverte à 39€',
nomProduit: 'Coffret découverte',
prixTtc: 39,
},
{
nomProduit: 'thé signature',
nomProduit: 'Thé signature',
prixTtc: 10,
},
{
nomProduit: 'thé détox',
nomProduit: 'Thé détox',
prixTtc: 6,
},
{
nomProduit: 'infuseur à thé',
nomProduit: 'Infuseur à thé',
prixTtc: 3,
}]