mirror of
https://github.com/Such-Software/medusa-plugin-blog.git
synced 2026-10-23 06:28:32 +02:00
add relations to blog post GET endpoint
This commit is contained in:
+14
-1
@@ -85,13 +85,26 @@ export default class BlogService extends TransactionBaseService {
|
||||
async getBlogPosts() {
|
||||
/* @ts-ignore */
|
||||
const blogPostRepository = this.activeManager_.withRepository(this.blogPostRepository_)
|
||||
return await blogPostRepository.find()
|
||||
return await blogPostRepository.find({
|
||||
relations: {
|
||||
category: true,
|
||||
tags: true,
|
||||
products: true,
|
||||
collections: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async getBlogPostsByCategory(category_id) {
|
||||
/* @ts-ignore */
|
||||
const blogPostRepository = this.activeManager_.withRepository(this.blogPostRepository_)
|
||||
return await blogPostRepository.find({
|
||||
relations: {
|
||||
category: true,
|
||||
tags: true,
|
||||
products: true,
|
||||
collections: true
|
||||
},
|
||||
where: { category_id }
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user