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

@ -143,7 +143,7 @@ export default async function handler(req, res) {
case "getUnassignedPublishers":
//let monthInfo = common.getMonthDatesInfo(date);
let allPubs = await filterPublishers("id,firstName,lastName,email,isactive".split(","), "", date, true, true, false);
let allPubs = await filterPublishers("id,firstName,lastName,email,isActive".split(","), "", date, true, true, false);
let unassignedPubs = allPubs.filter(pub => pub.currentMonthAssignments == 0 && pub.availabilities.length > 0);
res.status(200).json(unassignedPubs);
break;
@ -690,7 +690,7 @@ async function replaceInAssignment(oldPublisherId, newPublisherId, shiftId) {
data: {
publisherId: newPublisherId,
isConfirmed: false,
isTentative: true,
isBySystem: true,
isMailSent: false
}
});

View File

@ -89,7 +89,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const shifts = await prisma.shift.findMany({
where: {
isactive: true,
isActive: true,
startTime: {
gte: fromDate,
lt: toDate,

View File

@ -68,7 +68,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
case "test":
var data = prisma.shift.findMany({
where: {
isactive: true
isActive: true
}
});
@ -110,7 +110,7 @@ async function GenerateSchedule(axios: Axios, date: string, copyFromPreviousMont
}
console.log("finding shifts for previous 3 months for statistics (between " + new Date(monthInfo.date.getFullYear(), monthInfo.date.getMonth() - 3, 1).toISOString() + " and " + monthInfo.firstDay.toISOString() + ")");
const { data: events } = await axios.get(`/api/data/cartevents?where={"isactive":{"$eq":true}}`);
const { data: events } = await axios.get(`/api/data/cartevents?where={"isActive":{"$eq":true}}`);
//// let [shiftsLastMonth, publishers] = await getShiftsAndPublishersForPreviousMonths(lastMonthInfo);
//use filterPublishers from /pages/api/data/index.ts to get publishers with stats
@ -308,7 +308,7 @@ async function GenerateSchedule(axios: Axios, date: string, copyFromPreviousMont
assignments: 'true',
availabilities: 'true',
date: common.getISODateOnly(shiftStart),
select: 'id,firstName,lastName,isactive,desiredShiftsPerMonth'
select: 'id,firstName,lastName,isActive,desiredShiftsPerMonth'
});
let allAvailablePublishers = (await axios.get(`/api/?${queryParams.toString()}`)).data;
let availablePublishers = allAvailablePublishers;
@ -616,12 +616,12 @@ async function ImportShiftsFromDocx(axios: Axios) {
// prisma.publisher.findMany({
// where: {
// isactive: true,
// isActive: true,
// },
// include: {
// availabilities: {
// where: {
// isactive: true,
// isActive: true,
// },
// },
// assignments: {