Skip to content

Commit

Permalink
fix migration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
IObert committed Nov 5, 2024
1 parent 2cc516c commit f193963
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default function BroadcastPopoverContent({
"Content-Type": "application/json",
},
body: JSON.stringify({
event: eventSlug,
message,
}),
}).then((res) => {
Expand Down
51 changes: 0 additions & 51 deletions src/app/api/broadcast/route.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/app/api/event/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { Privilege, getAuthenticatedRole } from "@/middleware";
import { revalidatePath } from "next/cache";

export async function POST(request: Request) {
const [headersList, json] = await Promise.all([headers(), request.json()]);
const { event } = json;
const [headersList, event] = await Promise.all([headers(), request.json()]);
const role = getAuthenticatedRole(headersList.get("Authorization") || "");
const isAdmin = Privilege.ADMIN === role;

Expand Down
5 changes: 2 additions & 3 deletions src/app/api/order/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { pushToSyncList } from "@/lib/twilio";
import { Privilege, getAuthenticatedRole } from "@/middleware";

export async function POST(request: Request) {
const [headersList, json] = await Promise.all([headers(), request.json()]);
const { data } = json;
const [headersList, data] = await Promise.all([headers(), request.json()]);
const role = getAuthenticatedRole(headersList.get("Authorization") || "");

const isPrivileged = [
Expand Down Expand Up @@ -33,7 +32,7 @@ export async function POST(request: Request) {
}

try {
const newOrder = await pushToSyncList(data.event, data.order);
await pushToSyncList(data.event, data.order);
} catch (e: any) {
console.error(e);
return new Response(e.message, { status: 500, statusText: e.message });
Expand Down

0 comments on commit f193963

Please sign in to comment.