wisdom #2

Merged
yogiedigital merged 126 commits from wisdom into main 2025-10-20 03:26:33 +00:00
Showing only changes of commit 8fca2d3cd2 - Show all commits

View File

@@ -28,9 +28,7 @@ class DeviceService {
// Get device by code // Get device by code
static async getDeviceByCode(code) { static async getDeviceByCode(code) {
const device = await getDeviceByCodeDb(code); const device = await getDeviceByCodeDb(code);
if (!device) { if (!device) throw new ErrorHandler(404, 'Device not found');
throw new ErrorHandler(404, 'Device not found');
}
return device; return device;
} }
@@ -40,7 +38,7 @@ class DeviceService {
data.created_by = userId; data.created_by = userId;
// cek kode unik // Cek kode unik
const existingDevice = await getDeviceByCodeDb(data.device_code); const existingDevice = await getDeviceByCodeDb(data.device_code);
if (existingDevice) { if (existingDevice) {
throw new ErrorHandler(400, 'Device code already exists'); throw new ErrorHandler(400, 'Device code already exists');
@@ -63,8 +61,6 @@ class DeviceService {
const updatedDevice = await updateDeviceDb(id, data); const updatedDevice = await updateDeviceDb(id, data);
await updateDeviceDb(id, data);
return { return {
message: 'Device updated successfully', message: 'Device updated successfully',
data: updatedDevice, data: updatedDevice,