docs : fix variable assignment and importing PostRepository (#4286)

* fix variable assignment and import in step-5

* update with postRepository_ suffix for flexibility and avoiding name conflicts

* fixed ESLint Errors
This commit is contained in:
Neutron
2023-06-12 18:49:30 +05:30
committed by GitHub
parent 8228503fa2
commit 2ebc3da98a

View File

@@ -136,18 +136,21 @@ You can access your custom entity data in the database in services or subscriber
```ts
import { TransactionBaseService } from "@medusajs/medusa"
import PostRepository from "../repositories/post"
class PostService extends TransactionBaseService {
protected readonly postRepository_: typeof PostRepository
constructor({ postRepository, manager }) {
super({ postRepository, manager })
this.postRepository = postRepository
this.postRepository_ = postRepository
this.manager_ = manager
}
async list() {
const postRepo = this.manager_
.withRepository(this.postRepository)
.withRepository(this.postRepository_)
return await postRepo.find()
}
}