mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-08 16:59:08 +00:00
FEAT: Managers
This commit is contained in:
@@ -20,7 +20,12 @@ import {
|
||||
import { PERMISSIONS } from 'src/authentication/permissions.enum';
|
||||
import { User } from 'src/authentication/user.decorator';
|
||||
import { ValidationPipe } from '../../pipes/object-validation.pipe';
|
||||
import { GetConnectionsRes, UpdateConnectionDto } from './dtos/connection';
|
||||
import {
|
||||
ConnectionDetailsRes,
|
||||
ConnectionRes,
|
||||
ConnectionsRes,
|
||||
UpdateConnectionDto,
|
||||
} from './dtos/connection';
|
||||
import { CreateConnectionDto } from './dtos/connection';
|
||||
|
||||
@ApiTags('connections')
|
||||
@@ -42,14 +47,15 @@ export class ConnectionController {
|
||||
async createConnection(
|
||||
@User() user,
|
||||
@Body(new ValidationPipe()) body: CreateConnectionDto,
|
||||
) {
|
||||
): Promise<ConnectionRes> {
|
||||
this.logger.info('/connections - Create Connection');
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
|
||||
const response: any = await this.clientService.createConnection({
|
||||
body,
|
||||
info: { user_id, customer_id, customer_name },
|
||||
const response: any = await this.clientService.createConnection(body, {
|
||||
user_id,
|
||||
customer_id,
|
||||
customer_name,
|
||||
});
|
||||
|
||||
return response;
|
||||
@@ -59,17 +65,19 @@ export class ConnectionController {
|
||||
// @RequireAllPermissions(Permissions.CONNECTIONS.CREATE)
|
||||
async updateConnection(
|
||||
@User() user,
|
||||
@Headers('Dadosfera-Lang') language,
|
||||
@Param('id') id,
|
||||
@Headers('Dadosfera-Lang') language: string,
|
||||
@Param('id') id: string,
|
||||
@Body(new ValidationPipe()) body: UpdateConnectionDto,
|
||||
) {
|
||||
): Promise<ConnectionRes> {
|
||||
this.logger.info('/connections - Update Connection');
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
|
||||
const response: any = await this.clientService.updateConnection({
|
||||
body: { ...body, id },
|
||||
info: { user_id, customer_id, customer_name, language },
|
||||
const response: any = await this.clientService.updateConnection(id, body, {
|
||||
user_id,
|
||||
customer_id,
|
||||
customer_name,
|
||||
language,
|
||||
});
|
||||
|
||||
return response;
|
||||
@@ -77,7 +85,10 @@ export class ConnectionController {
|
||||
|
||||
@Delete('/:id')
|
||||
// @RequireAllPermissions(Permissions.CONNECTIONS.CREATE)
|
||||
async deleteConnection(@User() user, @Param('id') id) {
|
||||
async deleteConnection(
|
||||
@User() user,
|
||||
@Param('id') id: string,
|
||||
): Promise<ConnectionRes> {
|
||||
this.logger.info('/connections - Delete Connection');
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
@@ -96,7 +107,7 @@ export class ConnectionController {
|
||||
@User() user,
|
||||
@Headers('Dadosfera-Lang') language,
|
||||
@Query() queries,
|
||||
): Promise<GetConnectionsRes> {
|
||||
): Promise<ConnectionsRes> {
|
||||
this.logger.info('/connections - Get All Connection');
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
@@ -116,7 +127,7 @@ export class ConnectionController {
|
||||
@User() user,
|
||||
@Headers('Dadosfera-Lang') language,
|
||||
@Param('id') id,
|
||||
) {
|
||||
): Promise<ConnectionRes> {
|
||||
this.logger.info('/connections - Get Connection');
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
@@ -131,7 +142,10 @@ export class ConnectionController {
|
||||
|
||||
@Get('/:id/details')
|
||||
// @RequireAllPermissions(Permissions.CONNECTIONS.CREATE)
|
||||
async getConnectionDetails(@User() user, @Param('id') id) {
|
||||
async getConnectionDetails(
|
||||
@User() user,
|
||||
@Param('id') id,
|
||||
): Promise<ConnectionDetailsRes> {
|
||||
this.logger.info('/connections - Get Connection Details');
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
|
||||
Reference in New Issue
Block a user