From a20d394e0b2c8a10ad530f5de5860142d6d0d8c4 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 22 Jul 2026 17:03:13 +0200 Subject: [PATCH] Bugfix/improve error handling in access endpoints (#7392) * Improve error handling * Update changelog --- CHANGELOG.md | 6 ++++++ apps/api/src/app/access/access.controller.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac4ba04b5..3665b66ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Improved the error handling in the access endpoints (`POST` and `PUT`) to return `400 Bad Request` when granting access to a non-existent user + ## 3.31.0 - 2026-07-20 ### Changed diff --git a/apps/api/src/app/access/access.controller.ts b/apps/api/src/app/access/access.controller.ts index 35b1d485b..d692f358d 100644 --- a/apps/api/src/app/access/access.controller.ts +++ b/apps/api/src/app/access/access.controller.ts @@ -87,7 +87,7 @@ export class AccessController { } try { - return this.accessService.createAccess({ + return await this.accessService.createAccess({ alias: data.alias || undefined, granteeUser: data.granteeUserId ? { connect: { id: data.granteeUserId } } @@ -155,7 +155,7 @@ export class AccessController { } try { - return this.accessService.updateAccess({ + return await this.accessService.updateAccess({ data: { alias: data.alias, granteeUser: data.granteeUserId