notwatermango / ngantri-web

Simple queueing app for customers and merchants
1 stars 1 forks source link

implement send notification to user #76

Open notwatermango opened 1 year ago

notwatermango commented 1 year ago

will do research later

src\server\api\routers\ticket.ts

  callTicketCustomer: protectedProcedure
    .input(
      z.object({
        ticketId: z.string(),
      })
    )
    .mutation(async ({ input: { ticketId }, ctx }) => {
      await ctx.prisma.ticket.update({
        where: {
          id: ticketId,
        },
        data: {
          status: 4, // call customer
        },
      });
      // TODO: notify customer maybe here
    }),

src\pages\merchant\queue.tsx

  const handleCallCustomer = async (ticketId: string) => {
    await callCustomer.mutateAsync({
      ticketId,
    });
    // TODO: notify customer maybe here
    await refetch();
  };
notwatermango commented 1 year ago

will use onesignal SDK

notwatermango commented 1 year ago

can't get it to work 💀 postpone for later