Skip to content

Commit

Permalink
Fix bigInt array entity being treated as a big int (#1252)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname authored Aug 16, 2022
1 parent d4a0666 commit 52eadba
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/node/src/utils/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,20 @@ export function modelsTypeToModelAttributes(
if (field.type === 'BigInt') {
columnOption.get = function () {
const dataValue = this.getDataValue(field.name);
if (field.isArray) {
return dataValue ? dataValue.map((v) => BigInt(v)) : null;
}
return dataValue ? BigInt(dataValue) : null;
};
columnOption.set = function (val: unknown) {
this.setDataValue(field.name, val?.toString());
if (field.isArray) {
this.setDataValue(
field.name,
(val as unknown[])?.map((v) => v.toString()),
);
} else {
this.setDataValue(field.name, val?.toString());
}
};
}
if (field.type === 'Bytes') {
Expand Down

0 comments on commit 52eadba

Please sign in to comment.