fix(): handle empty q filters - allow to query deleted records from graph API - staled_at fixes (#11544)

* fix(): Allow to query deleted records from graph API

* fix(): Allow to query deleted records from graph API

* handle empty q value

* update staled at sync

* rename integration tests file

* Create strong-houses-marry.md

* try to fix flacky tests

* fix pricing context

* update changeset

* update changeset

* fix import

* skip test for now

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-02-21 13:24:12 +01:00
committed by GitHub
parent cfffd55ae6
commit 065df75e7d
10 changed files with 239 additions and 131 deletions

View File

@@ -2,11 +2,13 @@ import {
Context,
Event,
IndexTypes,
QueryGraphFunction,
RemoteQueryFunction,
Subscriber,
} from "@medusajs/framework/types"
import {
MikroOrmBaseRepository as BaseRepository,
CommonEvents,
ContainerRegistrationKeys,
deepMerge,
InjectManager,
@@ -210,13 +212,20 @@ export class PostgresProvider implements IndexTypes.StorageProvider {
}
const { fields, alias } = schemaEntityObjectRepresentation
const { data: entityData } = await this.query_.graph({
const graphConfig: Parameters<QueryGraphFunction>[0] = {
entity: alias,
filters: {
id: ids,
},
fields: [...new Set(["id", ...fields])],
})
}
if (action === CommonEvents.DELETED || action === CommonEvents.DETACHED) {
graphConfig.withDeleted = true
}
const { data: entityData } = await this.query_.graph(graphConfig)
const argument = {
entity: schemaEntityObjectRepresentation.entity,