chore: improve mikro orm serializer circular ref and link serialization (#9411)
This commit is contained in:
@@ -22,7 +22,7 @@ export function getModuleService(
|
||||
)
|
||||
}
|
||||
|
||||
return class LinkService extends LinkModuleService<unknown> {
|
||||
return class LinkService extends LinkModuleService {
|
||||
override __joinerConfig(): ModuleJoinerConfig {
|
||||
return joinerConfig_ as ModuleJoinerConfig
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ type InjectedDependencies = {
|
||||
[Modules.EVENT_BUS]?: IEventBusModuleService
|
||||
}
|
||||
|
||||
export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
export default class LinkModuleService implements ILinkModule {
|
||||
protected baseRepository_: DAL.RepositoryService
|
||||
protected readonly linkService_: LinkService<TLink>
|
||||
protected readonly linkService_: LinkService<any>
|
||||
protected readonly eventBusModuleService_?: IEventBusModuleService
|
||||
protected readonly entityName_: string
|
||||
protected readonly serviceName_: string
|
||||
@@ -151,7 +151,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
|
||||
const rows = await this.linkService_.list(filters, config, sharedContext)
|
||||
|
||||
return await this.baseRepository_.serialize<object[]>(rows)
|
||||
return rows.map((row) => row.toJSON())
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
@@ -170,7 +170,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return [await this.baseRepository_.serialize<object[]>(rows), count]
|
||||
return [rows.map((row) => row.toJSON()), count]
|
||||
}
|
||||
|
||||
@InjectTransactionManager(shouldForceTransaction, "baseRepository_")
|
||||
@@ -219,7 +219,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
}))
|
||||
)
|
||||
|
||||
return await this.baseRepository_.serialize<object[]>(links)
|
||||
return links.map((row) => row.toJSON())
|
||||
}
|
||||
|
||||
@InjectTransactionManager(shouldForceTransaction, "baseRepository_")
|
||||
@@ -244,7 +244,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
|
||||
const links = await this.linkService_.dismiss(data, sharedContext)
|
||||
|
||||
return await this.baseRepository_.serialize<object[]>(links)
|
||||
return links.map((row) => row.toJSON())
|
||||
}
|
||||
|
||||
@InjectTransactionManager(shouldForceTransaction, "baseRepository_")
|
||||
|
||||
+1
-4
@@ -4,8 +4,8 @@ import { PaymentModuleService } from "@services"
|
||||
import { moduleIntegrationTestRunner } from "medusa-test-utils"
|
||||
import {
|
||||
createPaymentCollections,
|
||||
createPaymentSessions,
|
||||
createPayments,
|
||||
createPaymentSessions,
|
||||
} from "../../../__fixtures__"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
@@ -519,9 +519,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
|
||||
data: {},
|
||||
status: "authorized",
|
||||
authorized_at: expect.any(Date),
|
||||
payment_collection: expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
}),
|
||||
payment_collection_id: expect.any(String),
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user