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