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

Should have an upsert method supporting natural keys #77

Closed
thgreasi opened this issue May 10, 2019 · 0 comments · Fixed by #81
Closed

Should have an upsert method supporting natural keys #77

thgreasi opened this issue May 10, 2019 · 0 comments · Fixed by #81

Comments

@thgreasi
Copy link
Contributor

We can implement a method even before pine support for this is added, but doing a POST and if it fails change it to an PATCH with the natural key props as a filter.

pine.upsert({
	resource: 'device_tag',
	id: {
		device: deviceId,
		tag_key: 'testTag',
	},
	body: {
		value: 'testValue',
	},
});

Eventually when pine supports this, the OData query might look like:

PUT /device_env_var(device=$device,tag_key=$tag_key) {value: '$value'}
thgreasi added a commit that referenced this issue Jun 7, 2019
This is marked as major, since we now need a
Promise implementation that also supports `.catch`.

Resolves: #77
Change-type: major
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
thgreasi added a commit that referenced this issue Jun 18, 2019
This is marked as major, since we now need a
Promise implementation that also supports `.catch`.

Resolves: #77
Change-type: major
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
thgreasi added a commit that referenced this issue Jun 28, 2019
Resolves: #77
Change-type: minor
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
thgreasi added a commit that referenced this issue Jul 12, 2019
Detect unique constrain errors by 409 statusCodes.
Because of this, the upsert() method is only
supported when Pinejs ^10.19.0 is used.

Resolves: #77
Change-type: minor
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
thgreasi added a commit that referenced this issue Jul 12, 2019
Detects unique constrain errors by 409 statusCodes.
Because of this, the upsert() method is only
supported when Pinejs ^10.19.0 is used.

Resolves: #77
Change-type: minor
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
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 a pull request may close this issue.

1 participant