From 2ebc3da98a34f422475efcf27573cd6d6b7bde6e Mon Sep 17 00:00:00 2001 From: Neutron <120790871+Shiva953@users.noreply.github.com> Date: Mon, 12 Jun 2023 18:49:30 +0530 Subject: [PATCH] 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 --- docs/content/development/entities/create.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/content/development/entities/create.md b/docs/content/development/entities/create.md index 502214873a..a432a4b2a0 100644 --- a/docs/content/development/entities/create.md +++ b/docs/content/development/entities/create.md @@ -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() } }