mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-12 20:27:39 +02:00
Merge branch 'refactor/error_and_api_handling' of github.com:open-reception/appointment-booking-software into refactor/error_and_api_handling
This commit is contained in:
@@ -340,7 +340,7 @@ export const GET: RequestHandler = async ({ params, locals }) => {
|
||||
|
||||
// Check if user is authenticated
|
||||
if (!tenantId || !agentId || !absenceId) {
|
||||
return new ValidationError("Missing tenant, agent, or absence ID").toJson();
|
||||
throw new ValidationError("Missing tenant, agent, or absence ID");
|
||||
}
|
||||
|
||||
checkPermission(locals, tenantId);
|
||||
|
||||
@@ -116,7 +116,7 @@ export const PUT: RequestHandler = async ({ params, locals }) => {
|
||||
|
||||
// Check if user is authenticated
|
||||
if (!tenantId || !appointmentId) {
|
||||
throw new ValidationError("Tenant ID and appointment ID are required", 400);
|
||||
throw new ValidationError("Tenant ID and appointment ID are required");
|
||||
}
|
||||
|
||||
checkPermission(locals, tenantId);
|
||||
|
||||
@@ -322,7 +322,7 @@ export const POST: RequestHandler = async ({ params, request, locals }) => {
|
||||
const tenantId = params.id;
|
||||
|
||||
if (!tenantId) {
|
||||
return json({ error: "No tenant id given" }, { status: 400 });
|
||||
throw new ValidationError(ERRORS.TENANTS.NO_TENANT_ID);
|
||||
}
|
||||
|
||||
checkPermission(locals, tenantId, true);
|
||||
|
||||
Reference in New Issue
Block a user