Files
smarthome/api/controller/device.log.controller.js
2024-03-23 14:56:45 +03:00

30 lines
606 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const configs = require("../configs");
const Library = require("../library");
const logSave = async (
token,
device_id,
remote_name,
remote_type,
operating_type
) => {
if (token === configs.verifyToken) {
try {
const result = await Library.saveDeviceLog(
device_id,
remote_name,
remote_type,
operating_type
);
return result;
} catch (error) {
throw new Error("Mongodb'ye kaydedilirken hata oluştu (log.controller)");
}
} else {
throw new Error("Hatalı token (log.controller)");
}
};
module.exports = { logSave };