-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/add-mAttachTenant #31
Conversation
My bad, I forgot to write the documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import action should returns the list of success and errors to allows the users to act accordingly and modify the input.
For example if every sensors cannot be attached to tenants for some reason, the one who could should still be attached and proper response should be sent to user.
This will allows to import a CSV, having some sensor attached but errors with others, correct the errors lines and re-import the same CSV to import the corrected lines.
Trying to re-attach a sensor to the same tenant should then not be considered as an error.
Finally, a strict
option could be interesting to throw an error if any of the line contains an error (the errors must be checked before import)
You can look at omniscient code for an example:
Co-authored-by: Michele Leo <[email protected]>
Co-authored-by: Michele Leo <[email protected]>
Co-authored-by: Michele Leo <[email protected]>
Co-authored-by: Michele Leo <[email protected]>
Co-authored-by: Michele Leo <[email protected]>
Co-authored-by: Michele Leo <[email protected]>
Co-authored-by: Adrien Maret <[email protected]>
Co-authored-by: Adrien Maret <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a Laius about the format ? Users will be interested to know that they can use CSV for example (it's a very bankable feature in avv)
doc/1/guides/sensors/index.md
Outdated
@@ -110,6 +110,12 @@ Sensors can be attached to tenant by using the [device-manager/sensor:attach](/k | |||
|
|||
When attached, the sensor document is copied inside the `sensors` collection of the tenant index. | |||
|
|||
## Attach to multiple tenant | |||
|
|||
Multiple differents Sensors can also be attached to multiple defferents tenant by using the [device-manager/sensor:attach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/mattach-tenant) API action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple differents Sensors can also be attached to multiple defferents tenant by using the [device-manager/sensor:attach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/mattach-tenant) API action. | |
Multiple different Sensors can also be attached to multiple different tenant by using the [device-manager/sensor:mAttach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/m-attach-tenant) API action. |
The file name must be changed accordingly
'sensors', | ||
sensor._id, | ||
{ assetId }); | ||
const writeMany = async (start: number, end: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clever design 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last change and LGTM 👍
doc/1/guides/sensors/index.md
Outdated
@@ -112,9 +112,11 @@ When attached, the sensor document is copied inside the `sensors` collection of | |||
|
|||
## Attach to multiple tenant | |||
|
|||
Multiple differents Sensors can also be attached to multiple defferents tenant by using the [device-manager/sensor:attach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/mattach-tenant) API action. | |||
Multiple different Sensors can also be attached to multiple defferents tenant by using the [device-manager/sensor:mAttach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/mAttach) API action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File name should be in kebab-case
(while API action is in camelCase
)
Multiple different Sensors can also be attached to multiple defferents tenant by using the [device-manager/sensor:mAttach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/mAttach) API action. | |
Multiple different Sensors can also be attached to multiple defferents tenant by using the [device-manager/sensor:mAttach](/kuzzle-iot-platform/device-manager/1/controllers/sensor/m-attach) API action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update files accordingly 👍
lib/controllers/SensorController.ts
Outdated
@@ -41,6 +45,10 @@ export class SensorController extends CRUDController { | |||
handler: this.attachTenant.bind(this), | |||
http: [{ verb: 'put', path: 'device-manager/:index/sensors/:_id/_attach' }] | |||
}, | |||
mAttachTenant: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, the action name is mAttach
or mAttachTenant
at the end ? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stick to mAttach, sorry about that
Co-authored-by: Adrien Maret <[email protected]>
Co-authored-by: Adrien Maret <[email protected]>
Co-authored-by: Adrien Maret <[email protected]>
LGTM 👍 |
Co-authored-by: Adrien Maret <[email protected]>
Add mAttachTenant methods