mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-27 07:00:06 +00:00
Authentication middleware implementation on Gateway + Documentation implementation w/ auth
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
import axios from 'axios';
|
||||
require("dotenv").config();
|
||||
import { RestInputsService } from './rest-inputs.service';
|
||||
import { CreateInputGrpcClientDto } from 'src/inputs/dto/create-input-grpc-client.dto';
|
||||
import { UpdateInputGrpcClientDto } from 'src/inputs/dto/update-input-grpc-client.dto';
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete, Put, Headers } from '@nestjs/common';
|
||||
import { AuthenticateController } from 'src/utils/Authenticate';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { CreateRestInputDto } from './dto/create-rest-input.dto';
|
||||
import { UpdateRestInputDto } from './dto/update-rest-input.dto';
|
||||
import { testConnectionDTO } from './dto/testConnection.dto';
|
||||
|
||||
|
||||
|
||||
@ApiTags('Inputs')
|
||||
@ApiBearerAuth()
|
||||
@Controller('input')
|
||||
export class RestInputsController {
|
||||
constructor(private readonly restInputsService: RestInputsService) {}
|
||||
|
||||
@Get('/test-auth/')
|
||||
async testauth(){
|
||||
return "Auth Success"
|
||||
}
|
||||
|
||||
|
||||
@Post('/test-connection/')
|
||||
async testConnection(@Body() body){
|
||||
async testConnection(@Body() body:testConnectionDTO){
|
||||
|
||||
const authController = new AuthenticateController()
|
||||
const accessToken = await authController.authenticate()
|
||||
@@ -33,7 +42,7 @@ export class RestInputsController {
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Body() body: CreateInputGrpcClientDto){
|
||||
async create(@Body() body: CreateRestInputDto){
|
||||
|
||||
const authController = new AuthenticateController()
|
||||
const accessToken = await authController.authenticate()
|
||||
@@ -92,7 +101,7 @@ export class RestInputsController {
|
||||
|
||||
@Put(':id')
|
||||
async update(
|
||||
@Body() body: UpdateInputGrpcClientDto,
|
||||
@Body() body: UpdateRestInputDto,
|
||||
@Param() id: string,
|
||||
){
|
||||
const authController = new AuthenticateController()
|
||||
|
||||
Reference in New Issue
Block a user