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

Kzlprd 166 upsert assets #323

Merged
merged 3 commits into from
Jan 9, 2024
Merged

Kzlprd 166 upsert assets #323

merged 3 commits into from
Jan 9, 2024

Conversation

Leagian
Copy link

@Leagian Leagian commented Dec 29, 2023

What does this PR do ?

This PR adds an upsert method in the AssetService. The upsert method is designed to update an existing asset with new metadata, or create a new asset if one does not already exist with the specified assetId.

How should this be manually tested?

npm run test:functional

Other changes

Boyscout

@Leagian Leagian changed the base branch from master to 2-dev December 29, 2023 15:19
Copy link
Contributor

@fmauNeko fmauNeko left a comment

Choose a reason for hiding this comment

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

Could you add some tests too, please ?

lib/modules/asset/AssetService.ts Outdated Show resolved Hide resolved
lib/modules/asset/AssetService.ts Outdated Show resolved Hide resolved
lib/modules/asset/AssetService.ts Outdated Show resolved Hide resolved
lib/modules/asset/AssetService.ts Show resolved Hide resolved
lib/modules/asset/AssetService.ts Show resolved Hide resolved
upsert: {
handler: this.upsert.bind(this),
http: [
{ path: "device-manager/:engineId/assets/:_id", verb: "post" },
Copy link
Contributor

Choose a reason for hiding this comment

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

This path does not reflect the behaviour of this action

Copy link
Author

Choose a reason for hiding this comment

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

I used POST by following this : https://docs.kuzzle.io/core/2/api/controllers/document/upsert/
Should I change it to PUT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, you are right I though the path was the same as the update action, but nvm it's okay :)

Copy link
Author

Choose a reason for hiding this comment

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

no problem !

@Leagian Leagian self-assigned this Jan 9, 2024
@Leagian Leagian merged commit 2bfa312 into 2-dev Jan 9, 2024
3 checks passed
@Leagian Leagian deleted the KZLPRD-166-upsert-assets branch January 9, 2024 09:41
sebtiz13 pushed a commit that referenced this pull request Jan 9, 2024
github-actions bot pushed a commit that referenced this pull request Jan 9, 2024
# [2.4.0-beta.10](v2.4.0-beta.9...v2.4.0-beta.10) (2024-01-09)

### Bug Fixes

* **assetsGroups:** disable checkRights on impersonate ([#325](#325)) ([eaa3edc](eaa3edc))

### Features

* **asset:** add upsert method ([#323](#323)) ([5f87787](5f87787))
github-actions bot pushed a commit that referenced this pull request Jan 11, 2024
# [2.4.0-temp-ci-debug.1](v2.3.2...v2.4.0-temp-ci-debug.1) (2024-01-11)

### Bug Fixes

* **asset_migration:** fixes multiple assets migration and optimize ([fd546cf](fd546cf))
* **assetsGroups:** disable checkRights on impersonate ([#325](#325)) ([eaa3edc](eaa3edc))
* **assets:** migrate tenant only if user is admin ([c24f942](c24f942))
* **assetsMigrateTenant:** add type for frontend and fix admin only ([e249f13](e249f13))
* **ci:** correct github token in ci ([a5a6b69](a5a6b69))
* copy-version script ([72b5e49](72b5e49))
* correct KuzzleRequest for pipes ([ef932d1](ef932d1))
* **export:** correct scroll in getNamedMeasures ([05fe4fd](05fe4fd))
* improve get internal devices documents ([03ccb29](03ccb29))
* **migrateTenant:** clear groups of newly created assets ([79f6a5a](79f6a5a))
* **npm:** fix repository url ([514dc59](514dc59))
* update semantic-release ([380c8b3](380c8b3))

### Features

* **asset:** add upsert method ([#323](#323)) ([5f87787](5f87787))
* **assets:** assets migrate tenant ([5f05101](5f05101))
* digitaltwin exports ([#315](#315)) ([aab65af](aab65af))
* **digitalTwin:** allow to modify mapping from application ([#322](#322)) ([89d375a](89d375a))
* **digitalTwin:** implement generic document pipes triggers ([#321](#321)) ([60a21fc](60a21fc))
* improve export ([#316](#316)) ([51db84a](51db84a))
* **measures:** add lastMeasuredAt on DigitalTwin ([#314](#314)) ([05b8a53](05b8a53))
github-actions bot pushed a commit that referenced this pull request Jan 11, 2024
# [2.4.0-temp-ci-debug.1](v2.3.2...v2.4.0-temp-ci-debug.1) (2024-01-11)

### Bug Fixes

* **asset_migration:** fixes multiple assets migration and optimize ([fd546cf](fd546cf))
* **assetsGroups:** disable checkRights on impersonate ([#325](#325)) ([eaa3edc](eaa3edc))
* **assets:** migrate tenant only if user is admin ([c24f942](c24f942))
* **assetsMigrateTenant:** add type for frontend and fix admin only ([e249f13](e249f13))
* **ci:** correct github token in ci ([a5a6b69](a5a6b69))
* copy-version script ([72b5e49](72b5e49))
* correct KuzzleRequest for pipes ([ef932d1](ef932d1))
* **export:** correct scroll in getNamedMeasures ([05fe4fd](05fe4fd))
* improve get internal devices documents ([03ccb29](03ccb29))
* **migrateTenant:** clear groups of newly created assets ([79f6a5a](79f6a5a))
* **npm:** fix repository url ([514dc59](514dc59))
* update semantic-release ([380c8b3](380c8b3))

### Features

* **asset:** add upsert method ([#323](#323)) ([5f87787](5f87787))
* **assets:** assets migrate tenant ([5f05101](5f05101))
* digitaltwin exports ([#315](#315)) ([aab65af](aab65af))
* **digitalTwin:** allow to modify mapping from application ([#322](#322)) ([89d375a](89d375a))
* **digitalTwin:** implement generic document pipes triggers ([#321](#321)) ([60a21fc](60a21fc))
* improve export ([#316](#316)) ([51db84a](51db84a))
* **measures:** add lastMeasuredAt on DigitalTwin ([#314](#314)) ([05b8a53](05b8a53))
github-actions bot pushed a commit that referenced this pull request Jan 11, 2024
# [2.4.0-temp-ci-debug.1](v2.3.2...v2.4.0-temp-ci-debug.1) (2024-01-11)

### Bug Fixes

* **asset_migration:** fixes multiple assets migration and optimize ([fd546cf](fd546cf))
* **assetsGroups:** disable checkRights on impersonate ([#325](#325)) ([eaa3edc](eaa3edc))
* **assets:** migrate tenant only if user is admin ([c24f942](c24f942))
* **assetsMigrateTenant:** add type for frontend and fix admin only ([e249f13](e249f13))
* **ci:** correct github token in ci ([a5a6b69](a5a6b69))
* copy-version script ([72b5e49](72b5e49))
* correct KuzzleRequest for pipes ([ef932d1](ef932d1))
* **export:** correct scroll in getNamedMeasures ([05fe4fd](05fe4fd))
* improve get internal devices documents ([03ccb29](03ccb29))
* **migrateTenant:** clear groups of newly created assets ([79f6a5a](79f6a5a))
* **npm:** fix repository url ([514dc59](514dc59))
* update semantic-release ([380c8b3](380c8b3))

### Features

* **asset:** add upsert method ([#323](#323)) ([5f87787](5f87787))
* **assets:** assets migrate tenant ([5f05101](5f05101))
* digitaltwin exports ([#315](#315)) ([aab65af](aab65af))
* **digitalTwin:** allow to modify mapping from application ([#322](#322)) ([89d375a](89d375a))
* **digitalTwin:** implement generic document pipes triggers ([#321](#321)) ([60a21fc](60a21fc))
* improve export ([#316](#316)) ([51db84a](51db84a))
* **measures:** add lastMeasuredAt on DigitalTwin ([#314](#314)) ([05b8a53](05b8a53))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants