fix(backend): avoid useless alias

This commit is contained in:
Acid Chicken (硫酸鶏) 2024-05-29 18:02:18 +09:00
parent 45f38094b9
commit 68e1c615cc
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99
1 changed files with 2 additions and 0 deletions

View File

@ -97,6 +97,8 @@ export const miRepository = {
},
async insertOne(entity, findOptions?) {
const queryBuilder = this.createQueryBuilder().insert().values(entity).returning('*');
// @ts-expect-error -- protected
queryBuilder.expressionMap.mainAlias!.name = queryBuilder.getMainTableName();
const columnNames = this.createTableColumnNames(queryBuilder);
const builder = this.createQueryBuilder().addCommonTableExpression(queryBuilder, 'cte', { columnNames });
builder.expressionMap.mainAlias!.tablePath = 'cte';