mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-12 18:09:08 +00:00
Update Protospack Name and Network Config
This commit is contained in:
@@ -3,10 +3,12 @@ import {
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Headers,
|
||||
Inject,
|
||||
Param,
|
||||
Patch,
|
||||
Post,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { NetworkConfigService } from './network-config.service';
|
||||
import { DadosferaLogger } from 'dadosfera-logs';
|
||||
@@ -33,12 +35,23 @@ export class NetworkConfigController {
|
||||
}
|
||||
@Get()
|
||||
@ApiOkResponse({ type: FindAllNetworkConfigsRes })
|
||||
async findAllNetworkConfigs(@User() user: RequestUser) {
|
||||
async findAllNetworkConfigs(
|
||||
@User() user: RequestUser,
|
||||
@Headers('Dadosfera-Lang') language,
|
||||
@Query() queries,
|
||||
) {
|
||||
this.logger.info('GET /network-config', {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.networkConfigService.findAllNetworkConfigs(user.customer_name);
|
||||
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
const { search, size, page, ...filters } = queries;
|
||||
|
||||
return this.networkConfigService.findAllNetworkConfigs({
|
||||
body: { search, size, page, filters },
|
||||
info: { user_id, customer_id, customer_name, language },
|
||||
});
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@@ -54,6 +67,24 @@ export class NetworkConfigController {
|
||||
return this.networkConfigService.findNetworkConfigById(id);
|
||||
}
|
||||
|
||||
@Get(':id/details')
|
||||
@ApiOkResponse({ type: FindAllNetworkConfigsRes })
|
||||
async findNetworkConfigByIdDetails(
|
||||
@User() user: RequestUser,
|
||||
@Headers('Dadosfera-Lang') language,
|
||||
@Param('id') id: string,
|
||||
) {
|
||||
this.logger.info('GET /network-config/:id', {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.networkConfigService.findNetworkConfigByIdDetails(id, {
|
||||
customer_name: user.customer_name,
|
||||
customer_id: user.customer_id,
|
||||
language,
|
||||
});
|
||||
}
|
||||
|
||||
@Post()
|
||||
@ApiOkResponse({ type: CreateNetworkConfigRes })
|
||||
async createNetworkConfigs(
|
||||
@@ -64,10 +95,10 @@ export class NetworkConfigController {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.networkConfigService.createNetworkConfig(
|
||||
body,
|
||||
user.customer_name,
|
||||
);
|
||||
return this.networkConfigService.createNetworkConfig(body, {
|
||||
customer_name: user.customer_name,
|
||||
customer_id: user.customer_id,
|
||||
});
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@@ -97,6 +128,9 @@ export class NetworkConfigController {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.networkConfigService.deleteNetworkConfig(network_config_id);
|
||||
return this.networkConfigService.deleteNetworkConfig(network_config_id, {
|
||||
customer_name: user.customer_name,
|
||||
customer_id: user.customer_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user