File

src/user/user-following.controller.ts

Prefix

users

Index

Methods

Methods

Async getFollowingListByUsername
getFollowingListByUsername(username: string)
Decorators :
@Get('/:username/following')
@ApiOperation({operationId: 'getFollowingListByUsername', summary: 'Get list of following users by the provided username'})
@ApiNotFoundResponse({description: 'User not found'})
Parameters :
Name Type Optional
username string No
import { Controller, Get, Param } from "@nestjs/common";
import { ApiNotFoundResponse, ApiOperation, ApiTags } from "@nestjs/swagger";
import { UserService } from "./services/user.service";
import { DbUser } from "./user.entity";
import { UserFollowService } from "./user-follow.service";
import { DbUserToUserFollows } from "./entities/user-follows.entity";

@Controller("users")
@ApiTags("User service")
export class UserFollowingController {
  constructor(private readonly userService: UserService, private readonly userFollowService: UserFollowService) {}

  @Get("/:username/following")
  @ApiOperation({
    operationId: "getFollowingListByUsername",
    summary: "Get list of following users by the provided username",
  })
  @ApiNotFoundResponse({ description: "User not found" })
  async getFollowingListByUsername(@Param("username") username: string): Promise<DbUserToUserFollows[]> {
    const user: DbUser = await this.userService.tryFindUserOrMakeStub({ username });

    return this.userFollowService.findAllFollowingList(user.id);
  }
}

results matching ""

    No results matching ""