mirror of
https://github.com/Such-Software/medusa-plugin-blog.git
synced 2026-10-17 05:32:06 +02:00
add relations to blog post GET endpoint
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# Change Log
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Add relations to blog post GET endpoint
|
||||
|
||||
## 0.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-blog",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"description": "Basic blog for Medusa",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
+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