mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 20:14:54 +00:00
Merge branch 'dev'
This commit is contained in:
@ -426,10 +426,18 @@ export class SceneService {
|
|||||||
}
|
}
|
||||||
async getAllIcons() {
|
async getAllIcons() {
|
||||||
try {
|
try {
|
||||||
const icons = await this.sceneIconRepository.find();
|
const icons = await this.sceneIconRepository.find({
|
||||||
return icons;
|
where: { iconType: SceneIconType.Other },
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove duplicates based on 'icon' property
|
||||||
|
const uniqueIcons = icons.filter(
|
||||||
|
(icon, index, self) =>
|
||||||
|
index === self.findIndex((t) => t.icon === icon.icon),
|
||||||
|
);
|
||||||
|
|
||||||
|
return uniqueIcons;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Improved error handling
|
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
{
|
{
|
||||||
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
|||||||
Reference in New Issue
Block a user