chore(): improve cart operations + Mikro orm 6.4.16 (#13712)

* chore(): Mikro orm 6.4.16

* Create small-ghosts-draw.md

* update config

* update config

* fix delete

* update config

* update workflows

* order improvements

* test pricing quuery

* test pricing quuery

* configurable connection options

* configurable connection options

* configurable connection options

* Update packages/modules/pricing/src/models/price.ts

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-10-10 08:58:19 +02:00
committed by GitHub
parent 76bf364440
commit c54c5ed6de
23 changed files with 481 additions and 288 deletions

View File

@@ -98,7 +98,12 @@ export async function mikroOrmCreateConnection(
filters: database.filters ?? {},
useBatchInserts: true,
useBatchUpdates: true,
implicitTransactions: false,
ignoreUndefinedInQuery: true,
batchSize: 100,
metadataCache: {
enabled: true,
},
assign: {
convertCustomTypes: true,
},

View File

@@ -436,20 +436,23 @@ export function mikroOrmBaseRepositoryFactory<const T extends object>(
.getKnexQuery()
.toSQL()
const where = [
whereSqlInfo.sql.split("where ")[1],
whereSqlInfo.bindings,
] as [string, any[]]
return await (manager.getTransactionContext() ?? manager.getKnex())
const builder = (manager.getTransactionContext() ?? manager.getKnex())
.queryBuilder()
.from(this.tableName)
.delete()
.where(manager.getKnex().raw(...where))
.returning("id")
.then((rows: { id: string }[]) => {
return rows.map((row: { id: string }) => row.id)
})
const hasWhere = whereSqlInfo.sql.includes("where ")
if (hasWhere) {
const where = [
whereSqlInfo.sql.split("where ")[1],
whereSqlInfo.bindings,
] as [string, any[]]
builder.where(manager.getKnex().raw(...where))
}
return await builder.returning("id").then((rows: { id: string }[]) => {
return rows.map((row: { id: string }) => row.id)
})
}
async find(