feature/app wipe my cal (#2496)

This commit is contained in:
alannnc authored and GitHub committed 2022-04-15 10:09:40 +00:00
1 parent 080f2bb845
commit c06d8164bc
6 files changed
+6 -12

No files matched your search

@@ -50,7 +50,6 @@ export default class AttendeeRequestRescheduledEmail extends OrganizerScheduledE
// @OVERRIDE // @OVERRIDE
protected getiCalEventAsString(): string | undefined { protected getiCalEventAsString(): string | undefined {
console.log("overriding");
const icsEvent = createEvent({ const icsEvent = createEvent({
start: dayjs(this.calEvent.startTime) start: dayjs(this.calEvent.startTime)
.utc() .utc()
@@ -56,7 +56,6 @@ export default class OrganizerRequestRescheduledEmail extends OrganizerScheduled
// @OVERRIDE // @OVERRIDE
protected getiCalEventAsString(): string | undefined { protected getiCalEventAsString(): string | undefined {
console.log("overriding");
const icsEvent = createEvent({ const icsEvent = createEvent({
start: dayjs(this.calEvent.startTime) start: dayjs(this.calEvent.startTime)
.utc() .utc()
@@ -23,7 +23,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
} }
let result = false; let result = false;
try { try {
console.log("try");
const { initialDate, endDate } = req.body; const { initialDate, endDate } = req.body;
const todayBookings = await prisma.booking.findMany({ const todayBookings = await prisma.booking.findMany({
@@ -37,6 +36,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
status: { status: {
in: [BookingStatus.ACCEPTED, BookingStatus.PENDING], in: [BookingStatus.ACCEPTED, BookingStatus.PENDING],
}, },
userId: req.session.user.id,
}, },
select: { select: {
id: true, id: true,
@@ -44,25 +44,23 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
status: true, status: true,
}, },
}); });
// const [booking] = todayBookings;
const q = queue({ results: [] }); const q = queue({ results: [] });
if (todayBookings.length > 0) { if (todayBookings.length > 0) {
todayBookings.forEach((booking) => todayBookings.forEach((booking) =>
q.push(() => { q.push(() => {
return Reschedule(booking.uid, "Can't do it"); return Reschedule(booking.uid, "");
}) })
); );
} }
const result = await q.start(); await q.start();
console.log({ result });
// result = !!(await Reschedule(booking.uid, "Can't do it"));
} catch (error: unknown) { } catch (error: unknown) {
if (error instanceof Error) { if (error instanceof Error) {
return res.status(500).json({ message: error.message }); return res.status(500).json({ message: error.message });
} }
return res.status(500); return res.status(500);
} }
return res.status(200).json({ success: result }); return res.status(200).json({ success: true });
}; };
function validate( function validate(
@@ -51,7 +51,7 @@ export const ConfirmDialog = (props: IConfirmDialogWipe) => {
const initialDate = today.startOf("day"); const initialDate = today.startOf("day");
const endDate = today.endOf("day"); const endDate = today.endOf("day");
const dateFormat = "ddd, MMM D, YYYY h:mm A"; const dateFormat = "ddd, MMM D, YYYY h:mm A";
console.log({ props });
const utils = trpc.useContext(); const utils = trpc.useContext();
const rescheduleApi = useMutation( const rescheduleApi = useMutation(
@@ -49,7 +49,6 @@ export default class AttendeeRequestRescheduledEmail extends BaseTemplate {
// @OVERRIDE // @OVERRIDE
protected getiCalEventAsString(): string | undefined { protected getiCalEventAsString(): string | undefined {
console.log("overriding");
const icsEvent = createEvent({ const icsEvent = createEvent({
start: dayjs(this.calEvent.startTime) start: dayjs(this.calEvent.startTime)
.utc() .utc()
@@ -56,7 +56,6 @@ export default class OrganizerRequestRescheduledEmail extends BaseTemplate {
// @OVERRIDE // @OVERRIDE
protected getiCalEventAsString(): string | undefined { protected getiCalEventAsString(): string | undefined {
console.log("overriding");
const icsEvent = createEvent({ const icsEvent = createEvent({
start: dayjs(this.calEvent.startTime) start: dayjs(this.calEvent.startTime)
.utc() .utc()