Skip to content
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

ModelService upsert -> createOrReplace #286

Merged
merged 3 commits into from
Mar 29, 2023

Conversation

fmauNeko
Copy link
Contributor

What does this PR do ?

This PR changes the document.upsert calls in ModelService into document.createOrReplace calls, in order to match the behavior described in the documentation.

It also updates the related tests.

@fmauNeko fmauNeko requested a review from Aschen March 28, 2023 16:30
@fmauNeko fmauNeko self-assigned this Mar 28, 2023
@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration /language:javascript. As part of the setup process, we have scanned this repository and found 118 existing alerts. Please check the repository Security tab to see all alerts.

Copy link
Contributor

@Aschen Aschen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a test where you are removing a default value for a model.

Also, can you assign the PR to yourself and add appropriate headers please?

@fmauNeko
Copy link
Contributor Author

Done !

@fmauNeko fmauNeko requested a review from Aschen March 29, 2023 07:19
Comment on lines 295 to 307
response = await sdk.query({
controller: "device-manager/models",
action: "writeDevice",
body: {
model: "Zigbee",
measures: [
{ type: "temperature", name: "temperature" },
],
metadataMappings: {
network2: { type: "keyword" },
},
},
});

Check warning

Code scanning / CodeQL

Useless assignment to local variable

The value assigned to response here is unused.
Comment on lines 92 to 105
response = await sdk.query({
controller: "device-manager/models",
action: "writeAsset",
body: {
engineGroup: "commons",
model: "Plane",
metadataMappings: {
company2: { type: "keyword" },
},
measures: [
{ name: "position", type: "position" },
],
},
});

Check warning

Code scanning / CodeQL

Useless assignment to local variable

The value assigned to response here is unused.
@fmauNeko fmauNeko force-pushed the fix/model-controller-documentation-mismatch branch from e4ae6ec to b90db79 Compare March 29, 2023 07:51
@fmauNeko fmauNeko force-pushed the fix/model-controller-documentation-mismatch branch from b90db79 to 76980e9 Compare March 29, 2023 07:53
Copy link
Contributor

@Aschen Aschen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@fmauNeko fmauNeko merged commit e70cb69 into 2-dev Mar 29, 2023
@fmauNeko fmauNeko deleted the fix/model-controller-documentation-mismatch branch March 29, 2023 16:33
@Aschen Aschen mentioned this pull request Apr 17, 2023
Aschen added a commit that referenced this pull request Apr 17, 2023
# [2.2.0](https://github.com/kuzzleio/kuzzle-device-manager/releases/tag/2.2.0) (2023-04-17)


#### Bug fixes

- [ [#290](#290) ] Historize asset for each same measurements   ([tdislay](https://github.com/tdislay))
- [ [#288](#288) ] Full path nested metadata when create/update assets   ([OlivierCavadenti](https://github.com/OlivierCavadenti))
- [ [#286](#286) ] ModelService upsert -> createOrReplace   ([fmauNeko](https://github.com/fmauNeko))
- [ [#282](#282) ] Fix engine creation   ([Aschen](https://github.com/Aschen))

#### New features

- [ [#296](#296) ] Export measures to CSV   ([Aschen](https://github.com/Aschen))
- [ [#291](#291) ] Add type of measure linked in each links of asset measures.   ([OlivierCavadenti](https://github.com/OlivierCavadenti))

#### Enhancements

- [ [#295](#295) ] Export default mappings   ([Aschen](https://github.com/Aschen))
- [ [#293](#293) ] Allow JSONObject in metadata   ([Aschen](https://github.com/Aschen))
- [ [#287](#287) ] Update metadata in existing assets when the model is modified   ([fmauNeko](https://github.com/fmauNeko))
- [ [#283](#283) ] Store reason of discarded payloads   ([OlivierCavadenti](https://github.com/OlivierCavadenti))

#### Others

- [ [#289](#289) ] Split tsconfig for tests   ([fmauNeko](https://github.com/fmauNeko))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants