title: How to return all the subsections that belong to particular section?
body: <p>I'm using Nestjs for my backend and I'm trying to create an api call that return all the subsections for particular section but not sure how to do that so I would be really appreciated if I can get any help or suggestion.</p>
  <p>so if I do Get/subsection/167 (167 is the section Id) then I will get all the subsections for that particular section.</p>
  <p>Entity</p>
  <pre><code>    @PrimaryGeneratedColumn({
          type: &quot;int&quot;,
          name: &quot;Id&quot;,
      })
      id: number;
  
      @Column(&quot;nvarchar&quot;, {
          nullable: false,
          unique: true,
          name: &quot;Name&quot;
      })
      name: string;
  
      @Column(&quot;nvarchar&quot;, {
          nullable: false,
          name: &quot;ParentId&quot;
      })
      parentId: number;
  </code></pre>
  <p>Controller</p>
  <pre><code>    @Get('/subsection/:parentId')
      async getHelpSubSection(@Req() req, @Param() params):Promise&lt;HelpEntity[]&gt;{
          return this.helpService.getHelpbySubSection(req.user, params.id);
      }
  </code></pre>
  <p>Service</p>
  <pre><code>  constructor(@InjectRepository(HelpEntity) private readonly helpRepo: Repository&lt;HelpEntity&gt;,
  
      async getHelpbySubSection(gmid: string, id: number) : Promise&lt;any&gt;{
          let check = await this.checkIfAdmin(gmid);
          if (!check) {
              throw new HttpException('Unauthorized', 401);
          } else {
              const res = await this.helpRepo.findOne()
              if (!res) {
                  throw new NotFoundException(`This ID: ${id} is not found`)
              }
              return res;
          }
      }
  </code></pre>
  <p>In my database all my parent section has NULL in ParentId.</p>
  <p><a href="https://i.stack.imgur.com/PGFQT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PGFQT.png" alt="enter image description here" /></a></p>