mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-16 04:59:08 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b736cddf07 | ||
|
|
007f3911ff |
+7
-67
@@ -5461,66 +5461,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/customers/{id}/organization-info": {
|
|
||||||
"get": {
|
|
||||||
"operationId": "CustomersController_getOrganizationInfo",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"required": true,
|
|
||||||
"in": "path",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Organization information"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
"Customers"
|
|
||||||
],
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"put": {
|
|
||||||
"operationId": "CustomersController_updateOrganizationInfo",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"required": true,
|
|
||||||
"in": "path",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Organization information updated"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
"Customers"
|
|
||||||
],
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/catalog/data-asset/share/{id}": {
|
"/catalog/data-asset/share/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "ShareController_getShareDataAsset",
|
"operationId": "ShareController_getShareDataAsset",
|
||||||
@@ -8229,7 +8169,7 @@
|
|||||||
"companyName": {
|
"companyName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"personalSite": {
|
"companySite": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"mfaStatus": {
|
"mfaStatus": {
|
||||||
@@ -8264,7 +8204,7 @@
|
|||||||
"hierarchy",
|
"hierarchy",
|
||||||
"bio",
|
"bio",
|
||||||
"companyName",
|
"companyName",
|
||||||
"personalSite",
|
"companySite",
|
||||||
"mfaStatus",
|
"mfaStatus",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"updatedAt",
|
"updatedAt",
|
||||||
@@ -8404,7 +8344,7 @@
|
|||||||
"companyName": {
|
"companyName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"personalSite": {
|
"companySite": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"customer": {
|
"customer": {
|
||||||
@@ -8436,7 +8376,7 @@
|
|||||||
"hierarchy",
|
"hierarchy",
|
||||||
"bio",
|
"bio",
|
||||||
"companyName",
|
"companyName",
|
||||||
"personalSite",
|
"companySite",
|
||||||
"mfaStatus",
|
"mfaStatus",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"updatedAt",
|
"updatedAt",
|
||||||
@@ -8580,7 +8520,7 @@
|
|||||||
"bio": {
|
"bio": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"personalSite": {
|
"companySite": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"companyName": {
|
"companyName": {
|
||||||
@@ -8632,7 +8572,7 @@
|
|||||||
"companyName": {
|
"companyName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"personalSite": {
|
"companySite": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"mfaStatus": {
|
"mfaStatus": {
|
||||||
@@ -8660,7 +8600,7 @@
|
|||||||
"hierarchy",
|
"hierarchy",
|
||||||
"bio",
|
"bio",
|
||||||
"companyName",
|
"companyName",
|
||||||
"personalSite",
|
"companySite",
|
||||||
"mfaStatus",
|
"mfaStatus",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"updatedAt",
|
"updatedAt",
|
||||||
|
|||||||
Generated
+5
-4
@@ -17,7 +17,7 @@
|
|||||||
"@aws-sdk/signature-v4": "^3.370.0",
|
"@aws-sdk/signature-v4": "^3.370.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack": "2.5.3",
|
"@dadosfera/protospack": "2.5.3",
|
||||||
"@dadosfera/protospack-v2": "^3.38.0-beta.25",
|
"@dadosfera/protospack-v2": "3.38.0-beta.19",
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"@grpc/proto-loader": "^0.7.9",
|
"@grpc/proto-loader": "^0.7.9",
|
||||||
"@nestjs/cli": "^9.5.0",
|
"@nestjs/cli": "^9.5.0",
|
||||||
@@ -1744,9 +1744,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@dadosfera/protospack-v2": {
|
"node_modules/@dadosfera/protospack-v2": {
|
||||||
"version": "3.38.0-beta.25",
|
"version": "3.38.0-beta.19",
|
||||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.38.0-beta.25.tgz",
|
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.38.0-beta.19.tgz",
|
||||||
"integrity": "sha512-OsOl9hJezmtWlVy+2vl3qbWP5yHmLktJ01r5aL475lcfKJtzFPZieUT9ES87C1Emrqe21E6IM/BkJK2rm/aUiA==",
|
"integrity": "sha512-qevGunl1IKv4POa2hhXNaDpqlh/bvnq5Hxo6534OHYPZ//S+XcRZgTrxFnylK3+uoROM8epF3Mey5GwynxY7Tw==",
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
"@aws-sdk/signature-v4": "^3.370.0",
|
"@aws-sdk/signature-v4": "^3.370.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack": "2.5.3",
|
"@dadosfera/protospack": "2.5.3",
|
||||||
"@dadosfera/protospack-v2": "^3.38.0-beta.25",
|
"@dadosfera/protospack-v2": "3.38.0-beta.19",
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"@grpc/proto-loader": "^0.7.9",
|
"@grpc/proto-loader": "^0.7.9",
|
||||||
"@nestjs/cli": "^9.5.0",
|
"@nestjs/cli": "^9.5.0",
|
||||||
|
|||||||
@@ -136,32 +136,4 @@ export class CustomersController {
|
|||||||
const result = await this.customersService.getAccessDashboardUrl(user.customer_name, metadata);
|
const result = await this.customersService.getAccessDashboardUrl(user.customer_name, metadata);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/organization-info')
|
|
||||||
@Authenticated()
|
|
||||||
@RequireAllPermissions(PERMISSIONS_GROUPS.USERS.permissions.ADMIN)
|
|
||||||
@ApiOkResponse({ description: 'Organization information' })
|
|
||||||
async getOrganizationInfo(@Param('id') id: string) {
|
|
||||||
this.logger.info('getOrganizationInfo', { id });
|
|
||||||
return this.customersService.getOrganizationInfo(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Put(':id/organization-info')
|
|
||||||
@Authenticated()
|
|
||||||
@RequireAllPermissions(PERMISSIONS_GROUPS.USERS.permissions.ADMIN)
|
|
||||||
@HttpCode(HttpStatus.OK)
|
|
||||||
@ApiOkResponse({ description: 'Organization information updated' })
|
|
||||||
async updateOrganizationInfo(
|
|
||||||
@Param('id') id: string,
|
|
||||||
@Body() body: {
|
|
||||||
companyName: string;
|
|
||||||
companySite: string;
|
|
||||||
domain: string;
|
|
||||||
cnpj: string;
|
|
||||||
description: string;
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
return this.customersService.updateOrganizationInfo(id, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,57 +223,4 @@ export class CustomersService implements OnModuleInit {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateOrganizationInfo(
|
|
||||||
customerId: string,
|
|
||||||
data: {
|
|
||||||
companyName: string;
|
|
||||||
companySite: string;
|
|
||||||
domain: string;
|
|
||||||
cnpj: string;
|
|
||||||
description: string;
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
const result = await lastValueFrom(
|
|
||||||
this.customerService.OrganizationUpdate({
|
|
||||||
customerId,
|
|
||||||
companyName: data.companyName || '',
|
|
||||||
companySite: data.companySite || '',
|
|
||||||
domain: data.domain || '',
|
|
||||||
cnpj: data.cnpj || '',
|
|
||||||
description: data.description || '',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} catch (err) {
|
|
||||||
if (err.details === ErrorCodes.CUSTOMER.NOT_FOUND)
|
|
||||||
throw new HttpException(err.details, HttpStatus.NOT_FOUND);
|
|
||||||
else throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getOrganizationInfo(customerId: string) {
|
|
||||||
try {
|
|
||||||
const customerResponse = await lastValueFrom(
|
|
||||||
this.customerService.CustomerFindOneById({ id: customerId })
|
|
||||||
);
|
|
||||||
|
|
||||||
const customer = customerResponse.customer;
|
|
||||||
|
|
||||||
return {
|
|
||||||
companyName: customer.companyName || '',
|
|
||||||
companySite: customer.companySite || '',
|
|
||||||
domain: customer.domain || '',
|
|
||||||
cnpj: customer.cnpj || '',
|
|
||||||
description: customer.description || ''
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
if (err.details === ErrorCodes.CUSTOMER.NOT_FOUND)
|
|
||||||
throw new HttpException(err.details, HttpStatus.NOT_FOUND);
|
|
||||||
else throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
||||||
|
|
||||||
export class OrganizationUpdateRequest {
|
|
||||||
@ApiProperty()
|
|
||||||
name: string;
|
|
||||||
@ApiPropertyOptional()
|
|
||||||
companySite: string;
|
|
||||||
@ApiProperty()
|
|
||||||
domain: string;
|
|
||||||
@ApiPropertyOptional()
|
|
||||||
info: string;
|
|
||||||
@ApiPropertyOptional()
|
|
||||||
cnpj: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OrganizationResponse {
|
|
||||||
@ApiProperty()
|
|
||||||
name: string;
|
|
||||||
@ApiPropertyOptional()
|
|
||||||
companySite: string;
|
|
||||||
@ApiProperty()
|
|
||||||
domain: string;
|
|
||||||
@ApiPropertyOptional()
|
|
||||||
info: string;
|
|
||||||
@ApiPropertyOptional()
|
|
||||||
cnpj: string;
|
|
||||||
}
|
|
||||||
@@ -43,7 +43,7 @@ export class User {
|
|||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
companyName?: string;
|
companyName?: string;
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
personalSite?: string;
|
companySite?: string;
|
||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
customer?: Customer;
|
customer?: Customer;
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@@ -117,7 +117,7 @@ export class UpdateUserReq {
|
|||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
bio?: string;
|
bio?: string;
|
||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
personalSite?: string;
|
companySite?: string;
|
||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
companyName?: string;
|
companyName?: string;
|
||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export class UsersService implements OnModuleInit {
|
|||||||
name: updateUserDTO.name,
|
name: updateUserDTO.name,
|
||||||
bio: updateUserDTO.bio,
|
bio: updateUserDTO.bio,
|
||||||
companyName: updateUserDTO.companyName,
|
companyName: updateUserDTO.companyName,
|
||||||
personalSite: updateUserDTO.personalSite,
|
companySite: updateUserDTO.companySite,
|
||||||
customerId,
|
customerId,
|
||||||
id,
|
id,
|
||||||
metabaseUserId: undefined,
|
metabaseUserId: undefined,
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ export class ValidationPipe implements PipeTransform<any> {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
const object = plainToInstance(metatype, value);
|
const object = plainToInstance(metatype, value);
|
||||||
const errors = await validate(object);
|
const errors = await validate(object, {
|
||||||
|
forbidUnknownValues: false,
|
||||||
|
whitelist: true,
|
||||||
|
});
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
const errorMessages = errors.map((err) => err.constraints);
|
const errorMessages = errors.map((err) => err.constraints);
|
||||||
throw new BadRequestException(errorMessages);
|
throw new BadRequestException(errorMessages);
|
||||||
|
|||||||
Reference in New Issue
Block a user