Function to synchronize user

This commit is contained in:
Gabriel Rosa
2022-09-23 09:25:41 -03:00
parent c29cf5aee1
commit 7245942707
7 changed files with 37 additions and 11 deletions
+7 -7
View File
@@ -12,7 +12,7 @@
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "1.0.0-beta.4",
"@dadosfera/protospack-v2": "3.17.5",
"@dadosfera/protospack-v2": "3.17.6",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
@@ -1726,9 +1726,9 @@
}
},
"node_modules/@dadosfera/protospack-v2": {
"version": "3.17.5",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.5.tgz",
"integrity": "sha512-pVi9yCqCIngreW/z75jDqo7dladmN/z49K5m2vdd4ljS7yR21XicrCIg+YxSOwFga4wa3c8bI6WZ40Mp8ah8IA==",
"version": "3.17.6",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.6.tgz",
"integrity": "sha512-PuG2nWiCq7WWdHtWPBJVMDS6G2OggXT6rnBONGIRvUCpoBFI3MFTao2Z51Z8xVsV3HG79O9VyQnS4N+350Dtmw==",
"dependencies": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
@@ -12305,9 +12305,9 @@
}
},
"@dadosfera/protospack-v2": {
"version": "3.17.5",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.5.tgz",
"integrity": "sha512-pVi9yCqCIngreW/z75jDqo7dladmN/z49K5m2vdd4ljS7yR21XicrCIg+YxSOwFga4wa3c8bI6WZ40Mp8ah8IA==",
"version": "3.17.6",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.6.tgz",
"integrity": "sha512-PuG2nWiCq7WWdHtWPBJVMDS6G2OggXT6rnBONGIRvUCpoBFI3MFTao2Z51Z8xVsV3HG79O9VyQnS4N+350Dtmw==",
"requires": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
+1 -1
View File
@@ -27,7 +27,7 @@
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "1.0.0-beta.4",
"@dadosfera/protospack-v2": "3.17.5",
"@dadosfera/protospack-v2": "3.17.6",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
+11 -1
View File
@@ -504,7 +504,7 @@ export const PERMISSIONS_GROUPS = {
'es-es': 'Usuarios',
},
permissions: {
ADMIN: {
CONNECTIONS_MIGRATION: {
seqid: 40,
claim: 'dadosfera:connections-migration',
usage: PermissionUsages.INTERNAL,
@@ -514,6 +514,16 @@ export const PERMISSIONS_GROUPS = {
'es-es': 'connections-migration',
},
},
SYNC_USER: {
seqid: 41,
claim: 'dadosfera:sync-user',
usage: PermissionUsages.INTERNAL,
name: {
'pt-br': 'sync-user',
'en-us': 'sync-user',
'es-es': 'sync-user',
},
},
},
},
};
@@ -45,7 +45,9 @@ export class ConnectionController {
}
@Get('connections-migration')
@RequireAllPermissions(PERMISSIONS_GROUPS.DADOSFERA.permissions.ADMIN)
@RequireAllPermissions(
PERMISSIONS_GROUPS.DADOSFERA.permissions.CONNECTIONS_MIGRATION,
)
async synchronizeConnections(@Query('apply') apply: string) {
return this.clientService.synchronizeConnections(apply === 'true');
}
+8
View File
@@ -241,4 +241,12 @@ export class UsersController {
this.userService.setLanguage(language);
return await this.userService.updateUser(body, id, user.customer_id);
}
@Post('synchronize/:id')
@RequireAllPermissions(PERMISSIONS_GROUPS.DADOSFERA.permissions.SYNC_USER)
@ApiOkResponse({ type: UpdateUserRes })
async synchronizeUser(@User() user: RequestUser, @Param('id') id: string) {
this.logger.info('synchronizeUser', { user });
return await this.userService.synchronizeUser(id);
}
}
+6
View File
@@ -219,4 +219,10 @@ export class UsersService implements OnModuleInit {
async findAllCustomers() {
return await lastValueFrom(this.customersClientService.CustomerFindAll({}));
}
async synchronizeUser(userId: string) {
return await lastValueFrom(
this.usersClientService.INTERNAL_UserSynchronize({ userId }),
);
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long