fix: fix T-2879 (#3330)

This commit is contained in:
YANG QIA 2024-01-05 20:12:30 +08:00 committed by GitHub
parent c102655317
commit 33c690b877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,15 +46,10 @@ type QueryParams = Partial<{
}>;
export const postProcess = async (ctx: Context, next: Next) => {
const { sequelize } = ctx.db;
const dialect = sequelize.getDialect();
const { data, fieldMap } = ctx.action.params.values as {
data: any[];
fieldMap: { [source: string]: { type?: string } };
};
switch (dialect) {
case 'postgres':
// https://github.com/sequelize/sequelize/issues/4550
ctx.body = data.map((record) => {
const result = {};
Object.entries(record).forEach(([key, value]) => {
@ -71,10 +66,6 @@ export const postProcess = async (ctx: Context, next: Next) => {
});
return result;
});
break;
default:
ctx.body = data;
}
await next();
};