- {item.id} {item.isactive}
+ {item.id} {item.isActive}
|
{item.publisher.lastName}, {item.publisher.firstName}
@@ -133,14 +133,14 @@ export const getServerSideProps = async (context) => {
const role = session?.user.role;
console.log("server role: " + role);
- var queryUrl = process.env.NEXTAUTH_URL + "/api/data/availabilities?select=id,name,isactive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id";
+ var queryUrl = process.env.NEXTAUTH_URL + "/api/data/availabilities?select=id,name,isActive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id";
if (role === UserRole.USER || context.query.my) {
queryUrl += `&where={"publisherId":"${session?.user.id}"}`;
} else if (role == UserRole.ADMIN) {
if (context.query.id) {
queryUrl += `&where={"publisherId":"${context.query.id}"}`;
} else {
- queryUrl += `&where={"isactive":true}`;
+ queryUrl += `&where={"isActive":true}`;
}
}
var resp = await axios.get(
diff --git a/pages/cart/calendar/index.tsx b/pages/cart/calendar/index.tsx
index a3f5746..77b2d4a 100644
--- a/pages/cart/calendar/index.tsx
+++ b/pages/cart/calendar/index.tsx
@@ -100,7 +100,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
console.log("Setting date to '" + date.toLocaleDateString() + "' from '" + selectedDate.toLocaleDateString() + "'. ISO: " + date.toISOString(), "locale ISO:", common.getISODateOnly(date));
if (isCheckboxChecked) {
console.log(`getting unassigned publishers for ${common.getMonthName(date.getMonth())} ${date.getFullYear()}`);
- const { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=getUnassignedPublishers&date=${dateStr}&select=id,firstName,lastName,isactive,desiredShiftsPerMonth`);
+ const { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=getUnassignedPublishers&date=${dateStr}&select=id,firstName,lastName,isActive,desiredShiftsPerMonth`);
setAvailablePubs(availablePubsForDate);
}
else {
@@ -108,7 +108,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
try {
const { data: shiftsForDate } = await axiosInstance.get(`/api/?action=getShiftsForDay&date=${dateStr}`);
setShifts(shiftsForDate);
- let { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=filterPublishers&assignments=true&availabilities=true&date=${dateStr}&select=id,firstName,lastName,isactive,desiredShiftsPerMonth`);
+ let { data: availablePubsForDate } = await axiosInstance.get(`/api/?action=filterPublishers&assignments=true&availabilities=true&date=${dateStr}&select=id,firstName,lastName,isActive,desiredShiftsPerMonth`);
availablePubsForDate.forEach(pub => {
pub.canTransport = pub.availabilities.some(av =>
@@ -172,8 +172,8 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
// currentMonthAssignments and previousMonthAssignments properties
// Sort publishers based on availability and then by assignment counts.
const sortedPubs = updatedPubs.sort((a, b) => {
- if (a.isactive !== b.isactive) {
- return a.isactive ? -1 : 1;
+ if (a.isActive !== b.isActive) {
+ return a.isActive ? -1 : 1;
}
// First, sort by isselected.
if (a.isSelected !== b.isSelected) {
@@ -355,7 +355,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
const newAssignment = {
publisher: { connect: { id: publisher.id } },
shift: { connect: { id: shiftId } },
- isactive: true,
+ isActive: true,
isConfirmed: true
};
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
@@ -669,7 +669,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
// Determine border class if selected
const selectedBorderClass = pub.isSelected ? 'border-blue-400 border-b-4' : '';
// Determine opacity class
- const activeOpacityClass = pub.isactive ? '' : 'opacity-25';
+ const activeOpacityClass = pub.isActive ? '' : 'opacity-25';
return (
@@ -878,20 +878,20 @@ export const getServerSideProps = async (context) => {
const url = `/api/data/shifts?where={"startTime":{"$and":[{"$gte":"${common.getISODateOnly(firstDayOfMonth)}","$lt":"${common.getISODateOnly(lastDayOfMonth)}"}]}}`;
const prismaClient = common.getPrismaClient();
- // let events = await prismaClient.cartEvent.findMany({ where: { isactive: true } });
+ // let events = await prismaClient.cartEvent.findMany({ where: { isActive: true } });
// events = events.map(event => ({
// ...event,
// // Convert Date objects to ISO strings
// startTime: event.startTime.toISOString(),
// endTime: event.endTime.toISOString(),
// }));
- const { data: events } = await axios.get(`/api/data/cartevents?where={"isactive":true}`);
+ const { data: events } = await axios.get(`/api/data/cartevents?where={"isActive":true}`);
//const { data: shifts } = await axios.get(url);
// get all shifts for the month, including assigments
let shifts = await prismaClient.shift.findMany({
where: {
- isactive: true,
+ isActive: true,
startTime: {
gte: firstDayOfMonth,
//lt: lastDayOfMonth
diff --git a/pages/cart/cartevents/index.tsx b/pages/cart/cartevents/index.tsx
index c5006c1..0396d9f 100644
--- a/pages/cart/cartevents/index.tsx
+++ b/pages/cart/cartevents/index.tsx
@@ -69,7 +69,7 @@ export default function CartEventPage({ items, locations }: ICartEventPageProps)
{item.shiftDuration}
|
- {item.isactive ? "Yes" : "No"}
+ {item.isActive ? "Yes" : "No"}
|
+
+
+
diff --git a/pages/dash.tsx b/pages/dash.tsx
index c5f8ced..71718db 100644
--- a/pages/dash.tsx
+++ b/pages/dash.tsx
@@ -86,7 +86,7 @@ async function getAvailabilities(userId) {
select: {
id: true,
name: true,
- isactive: true,
+ isActive: true,
isFromPreviousAssignment: true,
dayofweek: true,
dayOfMonth: true,
@@ -121,7 +121,7 @@ async function getAvailabilities(userId) {
shiftId Int
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
publisherId String
- isactive Boolean @default(true)
+ isActive Boolean @default(true)
isConfirmed Boolean @default(false)
isWithTransport Boolean @default(false)
Report Report[]
@@ -133,7 +133,7 @@ async function getAvailabilities(userId) {
},
select: {
id: true,
- isTentative: true,
+ isBySystem: true,
isConfirmed: true,
isWithTransport: true,
shift: {
diff --git a/prisma/bl/subqueries.js b/prisma/bl/subqueries.js
index ab557e0..44f977f 100644
--- a/prisma/bl/subqueries.js
+++ b/prisma/bl/subqueries.js
@@ -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'
// }
// }
\ No newline at end of file
diff --git a/prisma/migrations/20221130072538_updates/migration.sql b/prisma/migrations/20221130072538_updates/migration.sql
index 239a224..978530e 100644
--- a/prisma/migrations/20221130072538_updates/migration.sql
+++ b/prisma/migrations/20221130072538_updates/migration.sql
@@ -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`)
diff --git a/prisma/migrations/20221201223336_/migration.sql b/prisma/migrations/20221201223336_/migration.sql
index 90fe9cb..446e110 100644
--- a/prisma/migrations/20221201223336_/migration.sql
+++ b/prisma/migrations/20221201223336_/migration.sql
@@ -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;
diff --git a/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql b/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql
index a466b86..cd87cb8 100644
--- a/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql
+++ b/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql
@@ -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;
diff --git a/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql b/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql
index 0d0703e..55bc254 100644
--- a/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql
+++ b/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql
@@ -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
diff --git a/prisma/migrations/20240325214807_misc_renames/migration.sql b/prisma/migrations/20240325214807_misc_renames/migration.sql
new file mode 100644
index 0000000..2a2f6e7
--- /dev/null
+++ b/prisma/migrations/20240325214807_misc_renames/migration.sql
@@ -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';
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 2ea7b1f..91b56e0 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -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")
}
diff --git a/prisma/seed.sql b/prisma/seed.sql
index f64a4f5..6261a5c 100644
--- a/prisma/seed.sql
+++ b/prisma/seed.sql
@@ -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),
diff --git a/server.js b/server.js
index bfd1b44..f420718 100644
--- a/server.js
+++ b/server.js
@@ -259,7 +259,7 @@ nextApp
var shifts = await prisma.shift.findMany({
where: {
- isactive: true,
+ isActive: true,
startTime: {
gte: fromDate,
lt: toDate,
@@ -410,7 +410,7 @@ nextApp
var publishers = await prisma.publisher.findMany({
where: {
- isactive: true,
+ isActive: true,
email: {
not: "",
},
diff --git a/src/helpers/data.js b/src/helpers/data.js
index 7c0916b..af888ce 100644
--- a/src/helpers/data.js
+++ b/src/helpers/data.js
@@ -147,7 +147,7 @@ async function getAvailabilities(userId) {
select: {
id: true,
name: true,
- isactive: true,
+ isActive: true,
isFromPreviousAssignment: true,
dayofweek: true,
dayOfMonth: true,
@@ -182,7 +182,7 @@ async function getAvailabilities(userId) {
shiftId Int
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
publisherId String
- isactive Boolean @default(true)
+ isActive Boolean @default(true)
isConfirmed Boolean @default(false)
isWithTransport Boolean @default(false)
Report Report[]
@@ -194,7 +194,7 @@ async function getAvailabilities(userId) {
},
select: {
id: true,
- isTentative: true,
+ isBySystem: true,
isConfirmed: true,
isWithTransport: true,
shift: {
diff --git a/src/helpers/excel.js b/src/helpers/excel.js
index 40f2f1c..fd361bc 100644
--- a/src/helpers/excel.js
+++ b/src/helpers/excel.js
@@ -323,21 +323,21 @@ exports.processEvents = async function (events, year, monthNumber, progressCallb
}
var shifts = await prisma.shift.findMany({
where: {
- isactive: true,
+ isActive: true,
startTime: {
gte: monthDatesInfo.firstMonday,
lt: monthDatesInfo.lastSunday,
},
}
});
- var locations = await prisma.location.findMany({ where: { isactive: true, } });
+ var locations = await prisma.location.findMany({ where: { isActive: true, } });
- var cartEvents = await prisma.cartEvent.findMany({ where: { isactive: true, } });
+ var cartEvents = await prisma.cartEvent.findMany({ where: { isActive: true, } });
var publishers = await prisma.publisher.findMany({
- where: { isactive: true, },
+ where: { isActive: true, },
include: {
- availabilities: { where: { isactive: true, }, },
+ availabilities: { where: { isActive: true, }, },
assignments: { include: { shift: true, }, },
},
});
@@ -472,7 +472,7 @@ exports.processEvents = async function (events, year, monthNumber, progressCallb
email: name.toLowerCase().replace(/ /g, "."), // + "@gmail.com"
firstName: firstname,
lastName: lastname,
- isactive: true,
+ isActive: true,
isImported: true,
// role: "EXTERNAL",
};
@@ -492,7 +492,7 @@ exports.processEvents = async function (events, year, monthNumber, progressCallb
// endTime: endTime,
// name: `от предишен график, ${publisher.firstName} ${publisher.lastName}`,
// isFromPreviousAssignment: true,
- // isactive: true,
+ // isActive: true,
// },
// });
// console.log(`Created WEEKLY availability with ID ${availability.id} for date '${date.toDateString()}' and publisher '${publisher.firstName} ${publisher.lastName}'`);
diff --git a/src/sql/dev-test.sql b/src/sql/dev-test.sql
index d7fe46b..09a3621 100644
--- a/src/sql/dev-test.sql
+++ b/src/sql/dev-test.sql
@@ -11,7 +11,7 @@ SELECT DISTINCT Publisher.*
FROM Publisher
INNER JOIN Availability ON Availability.publisherId = Publisher.id
WHERE
- Availability.isactive = true
+ Availability.isActive = true
AND ( (
Availability.dayOfMonth IS NOT NULL
AND Availability.startTime <= '2023-03-30 13:00:00'
@@ -30,7 +30,7 @@ SELECT DISTINCT Publisher.*
FROM Publisher
INNER JOIN Availability ON Availability.publisherId = Publisher.id
WHERE
- Availability.isactive = true
+ Availability.isActive = true
AND (Availability.dayOfMonth = 5) clfuyo33e005aknvchf1wm3bu All publishers: 121;
(118) unique,
|