How to use nest-swagger - 10 common examples

To help you get started, we’ve selected a few nest-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 vellengs / nestx-server / packages / base / src / controllers / users.controller.ts View on Github external
Result,
  RolesGuard,
  LoggingInterceptor
} from "nestx-common";
import {
  KeyValueDto,
  CreateUserReq,
  EditUserReq,
  EditProfileReq,
  UsersOfRole,
  UserRes,
  ChangePasswordReq
} from "./../dto";
import { Tags } from "nest-swagger";

@Tags("core")
@Controller("user")
@UseGuards(AuthGuard("jwt"), RolesGuard)
@UseInterceptors(LoggingInterceptor)
export class UsersController {
  constructor(private readonly usersService: UsersService) {}

  @Get("profile")
  async profile(@Req() request: any): Promise {
    const user = request.user;
    const instance = this.usersService.getProfile(user);
    return instance;
  }

  @Post()
  async create(@Body() user: CreateUserReq): Promise {
    return this.usersService.create(plainToClass(CreateUserReq, user));
github vellengs / nestx / packages / servers / nestx-base / src / controllers / users.controller.ts View on Github external
Result,
  RolesGuard,
  LoggingInterceptor
} from "nestx-common";
import {
  KeyValueDto,
  CreateUserReq,
  EditUserReq,
  EditProfileReq,
  UsersOfRole,
  UserRes,
  ChangePasswordReq
} from "./../dto";
import { Tags } from "nest-swagger";

@Tags("core")
@Controller("user")
@UseGuards(AuthGuard("jwt"), RolesGuard)
@UseInterceptors(LoggingInterceptor)
export class UsersController {
  constructor(private readonly usersService: UsersService) {}

  @Get("profile")
  async profile(@Req() request: any): Promise {
    const user = request.user;
    const instance = this.usersService.getProfile(user);
    return instance;
  }

  @Post()
  async create(@Body() user: CreateUserReq): Promise {
    return this.usersService.create(plainToClass(CreateUserReq, user));
github vellengs / nestx / packages / server / src / core / controllers / users.controller.ts View on Github external
Result,
  RolesGuard,
  LoggingInterceptor,
} from './../../common';
import {
  KeyValueDto,
  CreateUserReq,
  EditUserReq,
  EditProfileReq,
  UsersOfRole,
  UserRes,
  ChangePasswordReq,
} from './../dto';
import { Tags } from 'nest-swagger';

@Tags('core')
@Controller('user')
@UseGuards(AuthGuard('jwt'), RolesGuard)
@UseInterceptors(LoggingInterceptor)
export class UsersController {
  constructor(private readonly usersService: UsersService) {}

  @Get('profile')
  async profile(@Req() request: any): Promise {
    const user = request.user;
    const instance = this.usersService.getProfile(user);
    return instance;
  }

  @Post()
  async create(@Body() user: CreateUserReq): Promise {
    return this.usersService.create(plainToClass(CreateUserReq, user));
github vellengs / nestx / packages / server / src / core / controllers / settings.controller.ts View on Github external
import {
  KeyValueDto,
  CreateSettingReq,
  EditSettingReq,
  SettingsGroup,
  SettingRes,
} from './../dto';
import { Tags } from 'nest-swagger';
import {
  ResultList,
  NullableParseIntPipe,
  RolesGuard,
  LoggingInterceptor,
} from './../../common';

@Tags('core')
@Controller('setting')
@UseGuards(AuthGuard('jwt'), RolesGuard)
@UseInterceptors(LoggingInterceptor)
export class SettingsController {
  constructor(private readonly settingService: SettingsService) {}

  @Post()
  async create(@Body() entry: CreateSettingReq) {
    return this.settingService.create(plainToClass(CreateSettingReq, entry));
  }

  @Put()
  async update(@Body() entry: EditSettingReq): Promise {
    return this.settingService.update(plainToClass(EditSettingReq, entry));
  }
github vellengs / nestx / packages / servers / nestx-base / src / controllers / settings.controller.ts View on Github external
import {
  KeyValueDto,
  CreateSettingReq,
  EditSettingReq,
  SettingsGroup,
  SettingRes
} from "./../dto";
import { Tags } from "nest-swagger";
import {
  ResultList,
  NullableParseIntPipe,
  RolesGuard,
  LoggingInterceptor
} from "nestx-common";

@Tags("core")
@Controller("setting")
@UseGuards(AuthGuard("jwt"), RolesGuard)
@UseInterceptors(LoggingInterceptor)
export class SettingsController {
  constructor(private readonly settingService: SettingsService) {}

  @Post()
  async create(@Body() entry: CreateSettingReq) {
    return this.settingService.create(plainToClass(CreateSettingReq, entry));
  }

  @Put()
  async update(@Body() entry: EditSettingReq): Promise {
    return this.settingService.update(plainToClass(EditSettingReq, entry));
  }
github vellengs / nestx-server / packages / cms / src / controllers / media.controller.ts View on Github external
Body
} from "@nestjs/common";
import { Tags } from "nest-swagger";
import { MediaService } from "./media.service";
import {
  CreateMediaDto,
  MediaRes,
  EditMediaDto,
  UploadRes,
  UploadMultipleRes,
  MediaFile
} from "../dto";
import { NullableParseIntPipe, ResultList, KeyValue } from "nestx-common";
import { Media } from "../interfaces";
import { FilesInterceptor, FileInterceptor } from "@nestjs/platform-express";
@Tags("cms")
@Controller("media")
export class MediaController {
  constructor(private readonly service: MediaService) {}

  @Get("search")
  async search(
    @Query("keyword") keyword?: string,
    @Query("value") value?: string
  ): Promise {
    return this.service.search(keyword, value);
  }

  @Post("upload")
  @UseInterceptors(FileInterceptor("file"))
  async uploadFile(@UploadedFile() file: MediaFile): Promise {
    return {
github vellengs / nestx / packages / servers / nestx-cms / src / controllers / photo.controller.ts View on Github external
Controller,
  Get,
  Query,
  Post,
  Put,
  Delete,
  Param,
  Body
} from "@nestjs/common";
import { Tags } from "nest-swagger";
import { PhotoService } from "./photo.service";
import { CreatePhotoDto, PhotoRes, EditPhotoDto } from "./../dto";
import { NullableParseIntPipe, ResultList, KeyValue } from "nestx-common";
import { Photo } from "../interfaces";

@Tags("cms")
@Controller("photo")
export class PhotoController {
  constructor(private readonly service: PhotoService) {}

  @Get("search")
  async search(
    @Query("keyword") keyword?: string,
    @Query("value") value?: string
  ): Promise {
    return this.service.search(keyword, value);
  }

  @Post()
  async create(@Body() entry: CreatePhotoDto): Promise {
    return this.service.create(entry);
  }
github vellengs / nestx / packages / server / dist / cms / controllers / page.controller.js View on Github external
__decorate([
    common_1.Delete(':id'),
    __param(0, common_1.Param('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], PageController.prototype, "remove", null);
__decorate([
    common_1.Get(':id'),
    __param(0, common_1.Param('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], PageController.prototype, "findOne", null);
PageController = __decorate([
    nest_swagger_1.Tags('cms'),
    common_1.Controller('page'),
    __metadata("design:paramtypes", [page_service_1.PageService])
], PageController);
exports.PageController = PageController;
//# sourceMappingURL=page.controller.js.map
github vellengs / nestx / packages / server / dist / cms / controllers / photo.controller.js View on Github external
__decorate([
    common_1.Delete(':id'),
    __param(0, common_1.Param('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], PhotoController.prototype, "remove", null);
__decorate([
    common_1.Get(':id'),
    __param(0, common_1.Param('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], PhotoController.prototype, "findOne", null);
PhotoController = __decorate([
    nest_swagger_1.Tags('cms'),
    common_1.Controller('photo'),
    __metadata("design:paramtypes", [photo_service_1.PhotoService])
], PhotoController);
exports.PhotoController = PhotoController;
//# sourceMappingURL=photo.controller.js.map
github vellengs / nestx / packages / server / src / cms / controllers / media.controller.ts View on Github external
} from '@nestjs/common';
import { Tags } from 'nest-swagger';
import { MediaService } from './media.service';
import {
  CreateMediaDto,
  MediaRes,
  EditMediaDto,
  UploadRes,
  UploadMultipleRes,
  MediaFile,
} from '../dto';
import { NullableParseIntPipe, ResultList } from '../../common';
import { Media } from '../interfaces';
import { KeyValueDto } from '../../core/dto';
import { FilesInterceptor, FileInterceptor } from '@nestjs/platform-express';
@Tags('cms')
@Controller('media')
export class MediaController {
  constructor(private readonly service: MediaService) {}

  @Get('search')
  async search(
    @Query('keyword') keyword?: string,
    @Query('value') value?: string,
  ): Promise {
    return this.service.search(keyword, value);
  }

  @Post('upload')
  @UseInterceptors(FileInterceptor('file'))
  async uploadFile(@UploadedFile() file: MediaFile): Promise {
    return {

nest-swagger

generate swagger for nestjs

MIT
Latest version published 5 years ago

Package Health Score

39 / 100
Full package analysis

Popular nest-swagger functions