Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

$data.Decimal is converted incorrect when converting to database #286

Open
Malyngo opened this issue Feb 23, 2017 · 1 comment
Open

$data.Decimal is converted incorrect when converting to database #286

Malyngo opened this issue Feb 23, 2017 · 1 comment

Comments

@Malyngo
Copy link
Contributor

Malyngo commented Feb 23, 2017

Tested in Jaydata 1.5.10.
When have an entity with a decimal value and want to store that to the database (Post or Patch, doesn't matter), there is an error about a wrong format.

I looked into this and it's just that Jaydata is still using the old odata v3 encoding for that, where decimals were sent as a string. In v4 they should be sent as a number.

My fix for this currently is to add this line in my code to "hotpatch" this:

$data.oDataConverter.toDb['$data.Decimal'] = function (v: string) { return +v; };

It's this line in the oDataConverter that would need to be changed:
https://github.com/jaystack/jaydata/blob/development/src/Types/StorageProviders/oData/oDataConverter.js#L86

@ysmoradi
Copy link

#259

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants