mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
On empty list, return empty array. Instead of error
This commit is contained in:
@ -14,8 +14,6 @@ export class SceneIconSeeder {
|
||||
});
|
||||
|
||||
if (defaultSceneIconData.length <= 0) {
|
||||
console.log('Creating default scene icon...');
|
||||
|
||||
await this.createDefaultSceneIcon();
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -178,10 +178,7 @@ export class SceneService {
|
||||
});
|
||||
|
||||
if (!scenesData.length) {
|
||||
throw new HttpException(
|
||||
`No scenes found for space UUID ${spaceUuid} with showInHomePage ${showInHomePage} `,
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
const scenes = await Promise.all(
|
||||
|
@ -18,16 +18,13 @@ export class UserSpaceService {
|
||||
) {}
|
||||
|
||||
async getSpacesForUser(userUuid: string): Promise<BaseResponseDto> {
|
||||
const userSpaces = await this.userSpaceRepository.find({
|
||||
let userSpaces = await this.userSpaceRepository.find({
|
||||
where: { user: { uuid: userUuid } },
|
||||
relations: ['space', 'space.community'],
|
||||
});
|
||||
|
||||
if (!userSpaces || userSpaces.length === 0) {
|
||||
throw new HttpException(
|
||||
`No spaces found for user with ID ${userUuid}`,
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
userSpaces = [];
|
||||
}
|
||||
|
||||
return new SuccessResponseDto({
|
||||
|
Reference in New Issue
Block a user