mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-10 05:24:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d39affc61 | ||
|
|
5d045b675c | ||
|
|
bb61990f6e | ||
|
|
80442c509a |
@@ -125,16 +125,17 @@ export const PERMISSIONS_GROUPS = {
|
||||
'es-es': 'Crear Source',
|
||||
},
|
||||
},
|
||||
DELETE: {
|
||||
seqid: 38,
|
||||
claim: 'connection:delete',
|
||||
usage: PermissionUsages.PUBLIC,
|
||||
name: {
|
||||
'pt-br': 'Excluir Fonte',
|
||||
'en-us': 'Remove Source',
|
||||
'es-s': 'Eliminar Source',
|
||||
},
|
||||
},
|
||||
//TODO descomentar quando tiver ok o DELETE de conexões
|
||||
// DELETE: {
|
||||
// seqid: 38,
|
||||
// claim: 'connection:delete',
|
||||
// usage: PermissionUsages.PUBLIC,
|
||||
// name: {
|
||||
// 'pt-br': 'Excluir Fonte',
|
||||
// 'en-us': 'Remove Source',
|
||||
// 'es-s': 'Eliminar Source',
|
||||
// },
|
||||
// },
|
||||
UPDATE: {
|
||||
seqid: 39,
|
||||
claim: 'connection:update',
|
||||
@@ -165,16 +166,16 @@ export const PERMISSIONS_GROUPS = {
|
||||
'es-es': 'Crear VPN',
|
||||
},
|
||||
},
|
||||
DELETE: {
|
||||
seqid: 36,
|
||||
claim: 'network_config:delete',
|
||||
usage: PermissionUsages.PUBLIC,
|
||||
name: {
|
||||
'pt-br': 'Excluir VPN',
|
||||
'en-us': 'Remove VPN',
|
||||
'es-es': 'Eliminar VPN',
|
||||
},
|
||||
},
|
||||
// DELETE: {
|
||||
// seqid: 36,
|
||||
// claim: 'network_config:delete',
|
||||
// usage: PermissionUsages.PUBLIC,
|
||||
// name: {
|
||||
// 'pt-br': 'Excluir VPN',
|
||||
// 'en-us': 'Remove VPN',
|
||||
// 'es-es': 'Eliminar VPN',
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -103,29 +103,29 @@ export class ConnectionController {
|
||||
return response;
|
||||
}
|
||||
|
||||
@Delete('/:id')
|
||||
@RequireAllPermissions(connectionPermissions.DELETE)
|
||||
async deleteConnection(
|
||||
@User() user: RequestUser,
|
||||
@Param('id') id: string,
|
||||
): Promise<ConnectionRes> {
|
||||
this.logger.info('/connections - Delete Connection');
|
||||
// @Delete('/:id')
|
||||
// @RequireAllPermissions(connectionPermissions.DELETE)
|
||||
// async deleteConnection(
|
||||
// @User() user: RequestUser,
|
||||
// @Param('id') id: string,
|
||||
// ): Promise<ConnectionRes> {
|
||||
// this.logger.info('/connections - Delete Connection');
|
||||
|
||||
const { user_id, customer_id, customer_name, username } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
user_id,
|
||||
customer_id,
|
||||
customer_name,
|
||||
username,
|
||||
});
|
||||
// const { user_id, customer_id, customer_name, username } = user;
|
||||
// const metadata = PackTheMetadata({
|
||||
// user_id,
|
||||
// customer_id,
|
||||
// customer_name,
|
||||
// username,
|
||||
// });
|
||||
|
||||
const response: any = await this.clientService.deleteConnection({
|
||||
body: { id },
|
||||
metadata,
|
||||
});
|
||||
// const response: any = await this.clientService.deleteConnection({
|
||||
// body: { id },
|
||||
// metadata,
|
||||
// });
|
||||
|
||||
return response;
|
||||
}
|
||||
// return response;
|
||||
// }
|
||||
|
||||
@Get()
|
||||
async getAllConnections(
|
||||
|
||||
@@ -25,7 +25,10 @@ import {
|
||||
UpdateNetworkConfigRes,
|
||||
} from './dto/network-config';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum';
|
||||
import { RequireAllPermissions } from 'src/authentication/authentication.decorator';
|
||||
|
||||
const networkConfigPermissions = PERMISSIONS_GROUPS.NETWORK_CONFIG.permissions;
|
||||
@ApiTags('Network Config')
|
||||
@Controller('network-config')
|
||||
export class NetworkConfigController {
|
||||
@@ -92,6 +95,7 @@ export class NetworkConfigController {
|
||||
|
||||
@Post()
|
||||
@ApiOkResponse({ type: CreateNetworkConfigRes })
|
||||
@RequireAllPermissions(networkConfigPermissions.CREATE)
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@UseInterceptors(FileInterceptor('ovpn_file'))
|
||||
async createNetworkConfigs(
|
||||
@@ -111,36 +115,37 @@ export class NetworkConfigController {
|
||||
});
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@ApiOkResponse({ type: UpdateNetworkConfigRes })
|
||||
async updateNetworkConfig(
|
||||
@User() user: RequestUser,
|
||||
@Param('id') network_config_id: string,
|
||||
@Body() body: UpdateNetworkConfigReq,
|
||||
) {
|
||||
this.logger.info('PATCH /network-config/:id', {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.networkConfigService.updateNetworkConfig(
|
||||
body,
|
||||
network_config_id,
|
||||
);
|
||||
}
|
||||
// @Patch(':id')
|
||||
// @ApiOkResponse({ type: UpdateNetworkConfigRes })
|
||||
// @RequireAllPermissions(networkConfigPermissions.CREATE)
|
||||
// async updateNetworkConfig(
|
||||
// @User() user: RequestUser,
|
||||
// @Param('id') network_config_id: string,
|
||||
// @Body() body: UpdateNetworkConfigReq,
|
||||
// ) {
|
||||
// this.logger.info('PATCH /network-config/:id', {
|
||||
// user: user.user_id,
|
||||
// customer: user.customer_name,
|
||||
// });
|
||||
// return this.networkConfigService.updateNetworkConfig(
|
||||
// body,
|
||||
// network_config_id,
|
||||
// );
|
||||
// }
|
||||
|
||||
@Delete(':id')
|
||||
@ApiOkResponse({ type: DeleteNetworkConfigRes })
|
||||
async deleteNetworkConfig(
|
||||
@User() user: RequestUser,
|
||||
@Param('id') network_config_id: string,
|
||||
) {
|
||||
this.logger.info('DELETE /network-config', {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.networkConfigService.deleteNetworkConfig(network_config_id, {
|
||||
customer_name: user.customer_name,
|
||||
customer_id: user.customer_id,
|
||||
});
|
||||
}
|
||||
// @Delete(':id')
|
||||
// @ApiOkResponse({ type: DeleteNetworkConfigRes })
|
||||
// async deleteNetworkConfig(
|
||||
// @User() user: RequestUser,
|
||||
// @Param('id') network_config_id: string,
|
||||
// ) {
|
||||
// this.logger.info('DELETE /network-config', {
|
||||
// user: user.user_id,
|
||||
// customer: user.customer_name,
|
||||
// });
|
||||
// return this.networkConfigService.deleteNetworkConfig(network_config_id, {
|
||||
// customer_name: user.customer_name,
|
||||
// customer_id: user.customer_id,
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user