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:
@@ -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