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:
1 parent
8228503fa2
commit
2ebc3da98a
1 file changed
+5
-2
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user