Refactored a bunch of shit
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m57s
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m57s
This commit is contained in:
@@ -60,6 +60,13 @@ export const POST: APIRoute = async ({
|
||||
return new Response("Unauthorized", { status: 401 });
|
||||
}
|
||||
|
||||
// Destructive status changes require owner/admin
|
||||
const destructiveStatuses = ["void"];
|
||||
const isAdminOrOwner = membership.role === "owner" || membership.role === "admin";
|
||||
if (destructiveStatuses.includes(status) && !isAdminOrOwner) {
|
||||
return new Response("Only owners and admins can void invoices", { status: 403 });
|
||||
}
|
||||
|
||||
try {
|
||||
await db
|
||||
.update(invoices)
|
||||
|
||||
Reference in New Issue
Block a user