add Messages table and availability dateOfEntry

This commit is contained in:
Dobromir Popov
2024-03-05 15:26:41 +02:00
parent a9d7df7262
commit e22d121f0f
5 changed files with 24 additions and 4 deletions

View File

@ -11,5 +11,5 @@ TELEGRAM_BOT=true
SSL_KEY=./certificates/localhost-key.pem SSL_KEY=./certificates/localhost-key.pem
SSL_CERT=./certificates/localhost.pem SSL_CERT=./certificates/localhost.pem
# DATABASE_URL=mysql://root:Zelen0ku4e@192.168.0.10:3306/cart_dev DATABASE_URL=mysql://root:Zelen0ku4e@192.168.0.10:3306/cart_dev
DATABASE_URL=mysql://cart:cartpw@localhost:3306/cart # DATABASE_URL=mysql://cart:cartpw@localhost:3306/cart

View File

@ -109,7 +109,7 @@ next start
export OPENAI_API_KEY=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 # personal export OPENAI_API_KEY=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 # personal
export OPENAI_API_KEY=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 # dev-bro export OPENAI_API_KEY=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 # dev-bro
# -------------update PRISMA schema/sync database ------------------------ # # ----------------------------------------------update PRISMA schema/sync database ----------------------------------------------- #
# prisma migrate dev --create-only # prisma migrate dev --create-only
npx prisma generate npx prisma generate
npx prisma migrate dev --name fix_nextauth_schema --create-only npx prisma migrate dev --name fix_nextauth_schema --create-only

View File

@ -193,6 +193,7 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
repeatWeekly: doRepeat, repeatWeekly: doRepeat,
dayOfMonth: doRepeat ? null : startTime.getDate(), dayOfMonth: doRepeat ? null : startTime.getDate(),
endDate: doRepeat ? repeatUntil : null, endDate: doRepeat ? repeatUntil : null,
dateOfEntry: new Date(),
}; };
} }
@ -207,6 +208,7 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
availability.repeatWeekly = doRepeat; availability.repeatWeekly = doRepeat;
availability.dayOfMonth = doRepeat ? null : availability.startTime.getDate(); availability.dayOfMonth = doRepeat ? null : availability.startTime.getDate();
availability.endDate = doRepeat ? repeatUntil : null; availability.endDate = doRepeat ? repeatUntil : null;
availability.dateOfEntry = new Date();
return availability; return availability;
} }

View File

@ -0,0 +1,18 @@
-- AlterTable
ALTER TABLE `Availability` ADD COLUMN `dateOfEntry` DATETIME(3) NULL;
-- CreateTable
CREATE TABLE `Message` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`publisherId` VARCHAR(191) NOT NULL,
`date` DATETIME(3) NOT NULL,
`content` VARCHAR(191) NOT NULL,
`isRead` BOOLEAN NOT NULL DEFAULT false,
`isPublic` BOOLEAN NOT NULL DEFAULT false,
`type` ENUM('Email', 'SMS', 'Push', 'InApp') NOT NULL DEFAULT 'Email',
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `Message` ADD CONSTRAINT `Message_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -133,7 +133,7 @@ model Availability {
repeatWeekly Boolean? // New field to indicate weekly repetition // until now dayofweek was used for repetition when dayOfMonth is null repeatWeekly Boolean? // New field to indicate weekly repetition // until now dayofweek was used for repetition when dayOfMonth is null
repeatFrequency Int? // New field to indicate repetition frequency repeatFrequency Int? // New field to indicate repetition frequency
endDate DateTime? // New field for the end date of repetition endDate DateTime? // New field for the end date of repetition
//dateOfEntry DateTime? //NEW v1.0.1 trade storage for intuintivity dateOfEntry DateTime? //NEW v1.0.1 trade storage for intuintivity
} }
model CartEvent { model CartEvent {