mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Make bigint into number instead of string
This commit is contained in:
@@ -78,15 +78,16 @@ export const fixEditedLocality = (editedLocality: EditDataType<LocalityDetailsTy
|
||||
lau_date: new Date(lau.lau_date!),
|
||||
}))
|
||||
}
|
||||
if (editedLocality.now_ls) {
|
||||
editedLocality.now_ls = editedLocality.now_ls.map(now_ls => ({
|
||||
...now_ls,
|
||||
com_species: {
|
||||
...now_ls.com_species,
|
||||
body_mass: now_ls.com_species.body_mass, // TODO FIX ? null : BigInt(now_ls.com_species.body_mass!),
|
||||
},
|
||||
}))
|
||||
}
|
||||
// TODO: see if we have to turn these into bigint or if writing number to db is ok.
|
||||
// if (editedLocality.now_ls) {
|
||||
// editedLocality.now_ls = editedLocality.now_ls.map(now_ls => ({
|
||||
// ...now_ls,
|
||||
// com_species: {
|
||||
// ...now_ls.com_species,
|
||||
// body_mass: now_ls.com_species.body_mass,
|
||||
// },
|
||||
// }))
|
||||
// }
|
||||
return editedLocality
|
||||
}
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ export const sleep = async (ms: number) => new Promise(resolve => setTimeout(res
|
||||
|
||||
export const fixBigInt = (obj: object | null) =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
obj === null ? null : JSON.stringify(obj, (_key, value) => (typeof value === 'bigint' ? value.toString() : value))
|
||||
obj === null ? null : JSON.stringify(obj, (_key, value) => (typeof value === 'bigint' ? Number(value) : value))
|
||||
|
||||
Reference in New Issue
Block a user