add subspace relation

This commit is contained in:
hannathkadher
2024-11-05 12:25:42 +04:00
parent cde9e8b602
commit b572143f04

View File

@ -100,7 +100,7 @@ export class SubspaceDeviceService {
if (!device.subspace || device.subspace.uuid !== subspace.uuid) { if (!device.subspace || device.subspace.uuid !== subspace.uuid) {
throw new HttpException( throw new HttpException(
'Device is not associated with the specified subspace', `Device ${deviceUuid} is not associated with the specified subspace ${subSpaceUuid} `,
HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST,
); );
} }
@ -169,6 +169,7 @@ export class SubspaceDeviceService {
private async findDevice(deviceUuid: string) { private async findDevice(deviceUuid: string) {
const device = await this.deviceRepository.findOne({ const device = await this.deviceRepository.findOne({
where: { uuid: deviceUuid }, where: { uuid: deviceUuid },
relations: ['subspace'],
}); });
if (!device) { if (!device) {
this.throwNotFound('Device', deviceUuid); this.throwNotFound('Device', deviceUuid);