diff --git a/.env b/.env index c3383e9..5264b41 100644 --- a/.env +++ b/.env @@ -51,7 +51,7 @@ TWITTER_SECRET= # EMAIL_BYPASS_TO=mwitnessing@gmail.com EMAIL_SENDER='"ССС" ' # EMAIL_SERVER=smtp://8ec69527ff2104:c7bc05f171c96c@smtp.mailtrap.io:2525 -EMAIL_FROM=noreply@mwitnessing.com +# ?EMAIL_FROM=noreply@mwitnessing.com EMAIL_SERVICE=mailtrap # MAILTRAP_HOST_BULK=bulk.smtp.mailtrap.io diff --git a/.env.test b/.env.test index 52a165f..94abc74 100644 --- a/.env.test +++ b/.env.test @@ -17,6 +17,7 @@ AUTH0_ISSUER=https://dev-wkzi658ckibr1amv.us.auth0.com # GOOGLE_ID=926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com # GOOGLE_SECRET=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 +EMAIL_SERVICE=mailtrap MAILTRAP_HOST_BULK=bulk.smtp.mailtrap.io MAILTRAP_HOST=live.smtp.mailtrap.io MAILTRAP_USER=api diff --git a/_doc/ToDo.md b/_doc/ToDo.md index 9c1c7b1..e49b6d1 100644 --- a/_doc/ToDo.md +++ b/_doc/ToDo.md @@ -208,3 +208,11 @@ store replacement test email problem with my repeating availability3 + relax add/remove transport for publishers + +fix published schedule to cover end of the week + +имейлите - ОК +графика - синк - ОК +вестителите от Фабио - +потребителите с двойни имейли - diff --git a/pages/api/index.ts b/pages/api/index.ts index 9df5799..d10c112 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -337,7 +337,7 @@ export default async function handler(req, res) { let updated = await prisma.shift.updateMany({ where: { startTime: { - gte: new Date(monthInfo.firstMonday.getFullYear(), monthInfo.firstMonday.getMonth(), 1), + gte: new Date(monthInfo.firstMonday.getFullYear(), monthInfo.firstMonday.getMonth(), monthInfo.firstMonday.getDate()), lt: new Date(monthInfo.lastSunday.getFullYear(), monthInfo.lastSunday.getMonth() + 1, 1), } }, diff --git a/pages/api/schedule.ts b/pages/api/schedule.ts index 087ce81..6585a62 100644 --- a/pages/api/schedule.ts +++ b/pages/api/schedule.ts @@ -73,17 +73,20 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) if (req.method === 'GET') { - // const { year, month } = req.query; + const { year, month } = req.query; - // let monthIndex = parseInt(month as string) - 1; - // const monthInfo = common.getMonthDatesInfo(new Date(year, month, 1)); - // let fromDate = monthInfo.firstMonday; - // const toDate = monthInfo.lastSunday; + //ToDo: maybe we don't need that anymore as we are publishing the shifts and show all published shifts let fromDate = new Date(); fromDate.setDate(fromDate.getDate() - 1); fromDate.setHours(0, 0, 0, 0); - let toDate = new Date(fromDate); - toDate.setDate(toDate.getDate() + 40); + if (year && month) { + fromDate = new Date(parseInt(year as string), parseInt(month as string) - 1, 1); + } + const monthInfo = common.getMonthDatesInfo(fromDate); + //let toDate = new Date(monthInfo.lastSunday); + if (year && month) { + fromDate = monthInfo.firstMonday; + } try { @@ -93,7 +96,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) isPublished: true, startTime: { gte: fromDate, - lt: toDate, + //lt: toDate, }, }, orderBy: { diff --git a/pages/cart/calendar/schedule.tsx b/pages/cart/calendar/schedule.tsx index bf58876..63c99df 100644 --- a/pages/cart/calendar/schedule.tsx +++ b/pages/cart/calendar/schedule.tsx @@ -22,7 +22,8 @@ const SchedulePage = () => { useEffect(() => { const fetchHtmlContent = async () => { try { - const response = await axiosInstance.get('/api/schedule?year=2024&month=1', { responseType: 'text' }); + // const response = await axiosInstance.get('/api/schedule?year=2024&month=1', { responseType: 'text' }); + const response = await axiosInstance.get('/api/schedule', { responseType: 'text' }); setHtmlContent(response.data); // Set the fetched HTML content in state } catch (error) { console.error("Failed to fetch schedule:", error);