mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-01 12:39:08 +00:00
Find All
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import {
|
||||
AuthSignInRequest,
|
||||
AuthRefreshAccessTokenRequest,
|
||||
@@ -21,7 +22,9 @@ import {
|
||||
import { AuthClientService } from 'src/clients/auth/client.service';
|
||||
|
||||
import ErrorBuilder from '../../utils/ErrorBuilder';
|
||||
import { LoginDto } from './dtos/login';
|
||||
|
||||
@ApiTags('auth')
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private authClient: AuthClientService) {}
|
||||
@@ -45,7 +48,7 @@ export class AuthController {
|
||||
|
||||
@Post('sign-in')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async signIn(@Body() { username, password, totp }: AuthSignInRequest) {
|
||||
async signIn(@Body() { username, password, totp }: LoginDto) {
|
||||
console.log(`/auth`, 'SignIn');
|
||||
|
||||
const tokens = await this.authClient
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class LoginDto {
|
||||
@ApiProperty()
|
||||
username: string;
|
||||
|
||||
@ApiProperty()
|
||||
password: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
totp: string;
|
||||
}
|
||||
@@ -11,15 +11,22 @@ import {
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { ApiConsumes, ApiTags } from '@nestjs/swagger';
|
||||
import { ConnectorManager } from '@victorradael/protospack-v2';
|
||||
import {
|
||||
ApiBasicAuth,
|
||||
ApiBearerAuth,
|
||||
ApiConsumes,
|
||||
ApiOAuth2,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { ConnectorClientService } from 'src/clients/connector/client.service';
|
||||
import { AddTagDto } from './dtos/add-tag';
|
||||
import { CreateConnectorDto } from './dtos/create-connector';
|
||||
import { GetAllDto } from './dtos/get-all';
|
||||
import { RemoveTagDto } from './dtos/remove-tag';
|
||||
import { UpdateDto } from './dtos/update';
|
||||
|
||||
@ApiTags('connectors')
|
||||
@ApiBearerAuth()
|
||||
@Controller('connectors')
|
||||
export class ConnectorController {
|
||||
constructor(private connectorClientService: ConnectorClientService) {}
|
||||
@@ -32,22 +39,19 @@ export class ConnectorController {
|
||||
@Body() body: CreateConnectorDto,
|
||||
) {
|
||||
console.log(`/upload`, 'Upload Connector Route');
|
||||
console.log(file, body);
|
||||
|
||||
// const response = await this.connectorClientService.uploadConnector({
|
||||
// file: fileField.file,
|
||||
// connector: body.connector,
|
||||
// });
|
||||
const response = await this.connectorClientService.uploadConnector({
|
||||
file,
|
||||
connector: body,
|
||||
});
|
||||
|
||||
// console.log('X', response);
|
||||
console.log('X', response);
|
||||
|
||||
// return response;
|
||||
return response;
|
||||
}
|
||||
|
||||
@Get('/')
|
||||
async getAllConnectors(
|
||||
@Body() body: ConnectorManager.Messages.GetAllConnectorsRequest,
|
||||
) {
|
||||
@Post('/all')
|
||||
async getAllConnectors(@Body() body: GetAllDto) {
|
||||
console.log(`/upload`, 'Upload Connector Route');
|
||||
const { filters, search } = body;
|
||||
|
||||
@@ -56,9 +60,11 @@ export class ConnectorController {
|
||||
search,
|
||||
});
|
||||
|
||||
const connectors = JSON.parse(response.connectors).connectors;
|
||||
|
||||
return {
|
||||
message: response.message,
|
||||
connector: { ...JSON.parse(response.connector) },
|
||||
connectors,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class GetAllDto {
|
||||
@ApiProperty()
|
||||
search: string;
|
||||
|
||||
@ApiProperty()
|
||||
filters: object;
|
||||
}
|
||||
Reference in New Issue
Block a user