How to use the @tsed/swagger.ReturnsArray function in @tsed/swagger

To help you get started, we’ve selected a few @tsed/swagger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / integration / typeorm / src / controllers / users / UsersCtrl.ts View on Github external
import {User} from "../../entity/User";
import {UsersService} from "../../services/UsersService";

@Controller("/users")
export class UsersCtrl {

  constructor(private usersService: UsersService) {
  }

  @Post("/")
  create(@BodyParams() user: User): Promise {
    return this.usersService.create(user);
  }

  @Get("/")
  @ReturnsArray(User)
  async getList(): Promise {
    return this.usersService.find();
  }
}
github TypedProject / ts-express-decorators / examples / getting-started / src / controllers / calendars / CalendarsCtrl.ts View on Github external
@Post("/:id")
  @Returns(Calendar)
  async update(@PathParams("id") @Required() id: string,
               @BodyParams() @Required() calendar: CreateCalendar): Promise {
    return this.calendarsService.update({id, ...calendar});
  }

  @Delete("/")
  @Status(204)
  async remove(@BodyParams("id") @Required() id: string): Promise {
    await this.calendarsService.remove(id);
  }

  @Get("/")
  @ReturnsArray(Calendar)
  async getAllCalendars() {
    return this.calendarsService.query();
  }
}