Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
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));
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));
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));
}
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));
}
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 {
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);
}
__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
__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
} 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 {