HM-110. Научили свагер работать с токенами
This commit is contained in:
@ -13,7 +13,7 @@ const initAdmin = async () => {
|
||||
password: String,
|
||||
is_admin: Boolean,
|
||||
});
|
||||
|
||||
|
||||
const Model = mongoose.model('users', schema);
|
||||
await Model.deleteOne({login: 'admin'});
|
||||
const salt = await bcrypt.genSalt(10);
|
||||
@ -33,6 +33,11 @@ async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
const options = new DocumentBuilder()
|
||||
.addSecurity('apiKey', {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
name: 'Authorization',
|
||||
})
|
||||
.setTitle('Auth API')
|
||||
.setDescription('API для авторизации приложений и работы с пользователями')
|
||||
.setVersion('1.0.0')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import {Controller, Get, Req, Post, Options, Header, Delete, HttpCode, Put} from '@nestjs/common';
|
||||
|
||||
import {ApiResponse, ApiTags, ApiParam, ApiBody} from '@nestjs/swagger';
|
||||
import {ApiResponse, ApiTags, ApiParam, ApiBody, ApiSecurity} from '@nestjs/swagger';
|
||||
import {
|
||||
ALLOW_ORIGIN_ALL,
|
||||
ALLOW_METHOD,
|
||||
@ -37,6 +37,7 @@ import {
|
||||
} from './users.responses';
|
||||
import {AuthService} from 'src/auth/auth.service';
|
||||
|
||||
@ApiSecurity('apiKey')
|
||||
@Controller(USERS_CONTROLLER)
|
||||
@ApiTags(USERS_CONTROLLER)
|
||||
export class UsersController {
|
||||
|
||||
Reference in New Issue
Block a user