fix: fix T-2879 (#3330)
This commit is contained in:
parent
c102655317
commit
33c690b877
@ -46,15 +46,10 @@ type QueryParams = Partial<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
export const postProcess = async (ctx: Context, next: Next) => {
|
export const postProcess = async (ctx: Context, next: Next) => {
|
||||||
const { sequelize } = ctx.db;
|
|
||||||
const dialect = sequelize.getDialect();
|
|
||||||
const { data, fieldMap } = ctx.action.params.values as {
|
const { data, fieldMap } = ctx.action.params.values as {
|
||||||
data: any[];
|
data: any[];
|
||||||
fieldMap: { [source: string]: { type?: string } };
|
fieldMap: { [source: string]: { type?: string } };
|
||||||
};
|
};
|
||||||
switch (dialect) {
|
|
||||||
case 'postgres':
|
|
||||||
// https://github.com/sequelize/sequelize/issues/4550
|
|
||||||
ctx.body = data.map((record) => {
|
ctx.body = data.map((record) => {
|
||||||
const result = {};
|
const result = {};
|
||||||
Object.entries(record).forEach(([key, value]) => {
|
Object.entries(record).forEach(([key, value]) => {
|
||||||
@ -71,10 +66,6 @@ export const postProcess = async (ctx: Context, next: Next) => {
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ctx.body = data;
|
|
||||||
}
|
|
||||||
await next();
|
await next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user