1
0
Fork 0
mirror of synced 2024-07-13 18:26:06 +12:00

Allow null strings (#12298)

* Allow null strings

* Don't update null to blank

* Save empty as null

* Make blank string map to null

* Add mappings for BigInt

* Fix unit tests
This commit is contained in:
melohagan 2023-11-23 09:53:35 +00:00 committed by GitHub
parent 778104d6e6
commit 0e93717f1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View file

@ -426,7 +426,7 @@ describe.each([
const saved = (await loadRow(id, table._id!)).body
expect(saved.stringUndefined).toBe(undefined)
expect(saved.stringNull).toBe("")
expect(saved.stringNull).toBe(null)
expect(saved.stringString).toBe("i am a string")
expect(saved.numberEmptyString).toBe(null)
expect(saved.numberNull).toBe(null)

View file

@ -46,23 +46,23 @@ export const TYPE_TRANSFORM_MAP: any = {
parse: parseArrayString,
},
[FieldTypes.STRING]: {
"": "",
[null]: "",
"": null,
[null]: null,
[undefined]: undefined,
},
[FieldTypes.BARCODEQR]: {
"": "",
[null]: "",
"": null,
[null]: null,
[undefined]: undefined,
},
[FieldTypes.FORMULA]: {
"": "",
[null]: "",
"": null,
[null]: null,
[undefined]: undefined,
},
[FieldTypes.LONGFORM]: {
"": "",
[null]: "",
"": null,
[null]: null,
[undefined]: undefined,
},
[FieldTypes.NUMBER]: {
@ -71,6 +71,11 @@ export const TYPE_TRANSFORM_MAP: any = {
[undefined]: undefined,
parse: n => parseFloat(n),
},
[FieldTypes.BIGINT]: {
"": null,
[null]: null,
[undefined]: undefined,
},
[FieldTypes.DATETIME]: {
"": null,
[undefined]: undefined,