convertParam function doesn't handle arrays. When it converts an integer array property (prisma type is Int[]) it tries to parse it as a Number and it leads to undefined behaviour. I believe to fix that you need to override isArray method in the Property class and adjust convertParam accordingly.
|
export const convertParam = ( |
|
property: Property, |
|
fields: DMMF.Model['fields'], |
|
value: string | boolean | number | Record<string, any> | null | undefined, |
|
): string | boolean | number | Record<string, any> | null | undefined => { |
|
const type = property.type(); |
|
|
|
if (type === 'mixed') return value; |
|
if (type === 'number') { |
|
return safeParseNumber(value); |
|
} |
|
if (type === 'reference') { |
|
const foreignColumn = fields.find((field) => field.name === property.foreignColumnName()); |
|
if (!foreignColumn) return value; |
|
if (value === undefined || value === null) return value; |
|
|
|
const foreignColumnType = foreignColumn.type; |
|
if (foreignColumnType === 'String') return String(value); |
|
|
|
return safeParseNumber(value); |
|
} |
|
|
|
return value; |
|
}; |
As a temporary fix I have to patch convertParam with something like this:
if (Array.isArray(value)) return value.map((v) => convertParam(property, fields, v));
convertParamfunction doesn't handle arrays. When it converts an integer array property (prisma type isInt[]) it tries to parse it as aNumberand it leads to undefined behaviour. I believe to fix that you need to overrideisArraymethod in thePropertyclass and adjustconvertParamaccordingly.adminjs-prisma/src/utils/converters.ts
Lines 8 to 31 in 0cd6a63
As a temporary fix I have to patch
convertParamwith something like this: