@adventurelabs/scout-core 1.4.88 → 1.4.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/parts.js +4 -3
- package/package.json +1 -1
package/dist/helpers/parts.js
CHANGED
|
@@ -107,9 +107,10 @@ export const get_parts_by_status = get_parts_by_lifecycle;
|
|
|
107
107
|
* @param newPart - Part data to create
|
|
108
108
|
*/
|
|
109
109
|
export async function create_part(client, newPart) {
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
// part is scoped to exactly one of a device or a herd.
|
|
111
|
+
const scope_count = [newPart.device_id, newPart.herd_id].filter((scope) => scope != null).length;
|
|
112
|
+
if (scope_count !== 1) {
|
|
113
|
+
return IWebResponse.error("exactly one of device_id or herd_id is required").to_compatible();
|
|
113
114
|
}
|
|
114
115
|
if (!newPart.serial_number) {
|
|
115
116
|
return IWebResponse.error("Serial number is required").to_compatible();
|