Chore/link module serialization (#11643)

This commit is contained in:
Adrien de Peretti
2025-02-28 13:19:21 +01:00
committed by GitHub
parent c50487ccab
commit 228b7b608d
2 changed files with 13 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/link-modules": patch
---
Chore/link module serialization

View File

@@ -135,7 +135,7 @@ export default class LinkModuleService implements ILinkModule {
)
}
return entry[0]
return (await this.baseRepository_.serialize(entry[0])) as unknown
}
@InjectManager()
@@ -150,7 +150,7 @@ export default class LinkModuleService implements ILinkModule {
const rows = await this.linkService_.list(filters, config, sharedContext)
return rows.map((row) => row.toJSON())
return (await this.baseRepository_.serialize(rows)) as unknown[]
}
@InjectManager()
@@ -163,13 +163,15 @@ export default class LinkModuleService implements ILinkModule {
config.take = null
}
const [rows, count] = await this.linkService_.listAndCount(
let [rows, count] = await this.linkService_.listAndCount(
filters,
config,
sharedContext
)
return [rows.map((row) => row.toJSON()), count]
rows = (await this.baseRepository_.serialize(rows)) as unknown[]
return [rows, count]
}
@InjectTransactionManager()
@@ -218,7 +220,7 @@ export default class LinkModuleService implements ILinkModule {
}))
)
return links.map((row) => row.toJSON())
return (await this.baseRepository_.serialize(links)) as unknown[]
}
@InjectTransactionManager()
@@ -243,7 +245,7 @@ export default class LinkModuleService implements ILinkModule {
const links = await this.linkService_.dismiss(data, sharedContext)
return links.map((row) => row.toJSON())
return (await this.baseRepository_.serialize(links)) as unknown[]
}
@InjectTransactionManager()