This commit is contained in:
Dobromir Popov
2024-03-26 01:08:57 +02:00
parent 3fcdfc1347
commit acd776e988
37 changed files with 143 additions and 107 deletions

View File

@ -13,7 +13,7 @@ export const publisherSelectWithAvCount = {
select: {
availability: {
where: {
isactive: true
isActive: true
}
}
@ -40,7 +40,7 @@ export const publisherSelect = {
// endTime: true,
// dayOfMonth: true,
// dayofweek: true,
// isactive: true,
// isActive: true,
// count: 'Availability_count'
// }
// }

View File

@ -5,7 +5,7 @@ CREATE TABLE `Publisher` (
`lastName` VARCHAR(191) NOT NULL,
`email` VARCHAR(191) NOT NULL,
`phone` VARCHAR(191) NULL,
`isactive` BOOLEAN NOT NULL DEFAULT true,
`isActive` BOOLEAN NOT NULL DEFAULT true,
`age` INTEGER NULL,
UNIQUE INDEX `Publisher_email_key`(`email`),
@ -41,7 +41,7 @@ CREATE TABLE `Shift` (
`name` VARCHAR(191) NOT NULL,
`startTime` DATETIME(3) NOT NULL,
`endTime` DATETIME(3) NOT NULL,
`isactive` BOOLEAN NOT NULL DEFAULT true,
`isActive` BOOLEAN NOT NULL DEFAULT true,
`requiresTransport` BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (`id`)
@ -52,7 +52,7 @@ CREATE TABLE `Location` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(191) NOT NULL,
`address` VARCHAR(191) NOT NULL,
`isactive` BOOLEAN NOT NULL DEFAULT true,
`isActive` BOOLEAN NOT NULL DEFAULT true,
`dayofweek` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') NOT NULL,
PRIMARY KEY (`id`)

View File

@ -6,10 +6,10 @@
*/
-- AlterTable
ALTER TABLE `Availability` ADD COLUMN `isactive` BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE `Availability` ADD COLUMN `isActive` BOOLEAN NOT NULL DEFAULT true;
-- AlterTable
ALTER TABLE `CartEvent` ADD COLUMN `isactive` BOOLEAN NOT NULL DEFAULT true,
ALTER TABLE `CartEvent` ADD COLUMN `isActive` BOOLEAN NOT NULL DEFAULT true,
ADD COLUMN `locationId` INTEGER NOT NULL,
ADD COLUMN `shiftDuration` INTEGER NOT NULL;

View File

@ -18,7 +18,7 @@ CREATE TABLE `Assignment` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`shiftId` INTEGER NOT NULL,
`publisherId` INTEGER NOT NULL,
`isactive` BOOLEAN NOT NULL DEFAULT true,
`isActive` BOOLEAN NOT NULL DEFAULT true,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

View File

@ -1,11 +1,11 @@
/*
Warnings:
- You are about to drop the column `isactive` on the `assignment` table. All the data in the column will be lost.
- You are about to drop the column `isActive` on the `assignment` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE `Assignment` DROP COLUMN `isactive`,
ALTER TABLE `Assignment` DROP COLUMN `isActive`,
ADD COLUMN `isTentative` BOOLEAN NOT NULL DEFAULT false;
-- AlterTable

View File

@ -0,0 +1,15 @@
/*
Warnings:
- You are about to drop the column `isTentative` on the `Assignment` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE `Assignment`
ADD COLUMN `isBySystem` BOOLEAN NOT NULL DEFAULT false;
UPDATE `Assignment` SET `isBySystem` = isTentative;
ALTER TABLE `Assignment` DROP COLUMN `isTentative`,
-- AlterTable
ALTER TABLE `Report` ADD COLUMN `type` ENUM('ServiceReport', 'Experience', 'Feedback_Problem', 'Feedback_Suggestion', 'Feedback') NOT NULL DEFAULT 'ServiceReport';

View File

@ -81,13 +81,21 @@ enum PublisherType {
SpecialPioneer_Missionary
}
enum ReportType {
ServiceReport
Experience
Feedback_Problem
Feedback_Suggestion
Feedback
}
model Publisher {
id String @id @default(cuid())
firstName String
lastName String
email String @unique
phone String?
isactive Boolean @default(true)
isActive Boolean @default(true)
isImported Boolean @default(false)
isTrained Boolean @default(false)
age Int?
@ -124,7 +132,7 @@ model Availability {
weekOfMonth Int?
startTime DateTime
endTime DateTime
isactive Boolean @default(true)
isActive Boolean @default(true)
type AvailabilityType @default(Weekly)
isWithTransportIn Boolean @default(false)
isWithTransportOut Boolean @default(false)
@ -143,7 +151,7 @@ model CartEvent {
shiftDuration Int
shifts Shift[]
dayofweek DayOfWeek
isactive Boolean @default(true)
isActive Boolean @default(true)
location Location @relation(fields: [locationId], references: [id])
locationId Int
eventType EventType @default(PW_Cart)
@ -160,7 +168,7 @@ model Shift {
name String
startTime DateTime
endTime DateTime
isactive Boolean @default(true)
isActive Boolean @default(true)
requiresTransport Boolean @default(false)
notes String?
//date DateTime
@ -177,7 +185,7 @@ model Assignment {
shiftId Int
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
publisherId String
isTentative Boolean @default(false) // if no availability for it, when importing previous schedules
isBySystem Boolean @default(false) // if no availability for it, when importing previous schedules
isConfirmed Boolean @default(false)
isWithTransport Boolean @default(false)
isMailSent Boolean @default(false)
@ -190,7 +198,7 @@ model Location {
id Int @id @default(autoincrement())
name String
address String
isactive Boolean @default(true)
isActive Boolean @default(true)
content String? @db.LongText
cartEvents CartEvent[]
reports Report[]
@ -219,7 +227,8 @@ model Report {
returnVisitInfoCount Int?
conversationCount Int?
experienceInfo String? @db.LongText
experienceInfo String? @db.LongText
type ReportType @default(ServiceReport)
@@map("Report")
}

View File

@ -30,7 +30,7 @@ INSERT INTO
`id`,
`name`,
`address`,
`isactive`
`isActive`
)
VALUES (
1,
@ -57,7 +57,7 @@ INSERT INTO
`startTime`,
`endTime`,
`dayofweek`,
`isactive`,
`isActive`,
`locationId`,
`shiftDuration`,
`eventType`,
@ -147,7 +147,7 @@ VALUES (
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */
;
-- INSERT INTO `cartevent` (`id`, `startTime`, `endTime`, `dayofweek`, `isactive`, `locationId`, `shiftDuration`, `eventType`, `numberOfPublishers`)
-- INSERT INTO `cartevent` (`id`, `startTime`, `endTime`, `dayofweek`, `isActive`, `locationId`, `shiftDuration`, `eventType`, `numberOfPublishers`)
-- VALUES
-- (2, '2023-12-27 07:00:33.174', '2023-12-27 16:00:33.174', 'Tuesday', 1, 2, 90, 'PW_Cart', 4),
-- (3, '2023-12-28 07:00:33.174', '2023-12-28 16:00:33.174', 'Wednesday', 1, 3, 90, 'PW_Cart', 4),