Skip to content

Commit

Permalink
Merging develop into main for 2.18.0-prerelease (#2789)
Browse files Browse the repository at this point in the history
* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix spell
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* separate npm and yarn builds
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* about page
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix README.md
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix README.md
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix compare documents

Signed-off-by: Stepan Kiryakov <[email protected]>

* update GHGP policy [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* [2400] add lock files to containers
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* replace npm with yarn
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix wizard circular dependency

Signed-off-by: Artem Buslaev <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* pass assignedTo props

Signed-off-by: Artem Buslaev <[email protected]>

* update ghgp policy [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* fix error response

Signed-off-by: simvalery <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* upd redd policies [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix task wrong schema redirect

Signed-off-by: Artem Buslaev <[email protected]>

* added delete schema validator

Signed-off-by: Artem Buslaev <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* limit page log size

Signed-off-by: simvalery <[email protected]>

* fix limit

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix export tool

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix import error messages

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix logs saving

Signed-off-by: simvalery <[email protected]>

* fix lint

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix port

Signed-off-by: simvalery <[email protected]>

* fix remove limit

Signed-off-by: simvalery <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix block validation

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix error message

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix watch tasks

Signed-off-by: simvalery <[email protected]>

* fix import artifacts

Signed-off-by: Stepan Kiryakov <[email protected]>

* bump version

Signed-off-by: simvalery <[email protected]>

* fix readonly schemas

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix system schemas

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix progress list overflow

Signed-off-by: simvalery <[email protected]>

* add tags

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* Update timestamp of ACM0003

* Update readme.md of AMS-IIID

* Update readme.md AMS-III.AR

* Update readMe.md AMS.IIG

* Update README.md GoldStandard AR

* Update README.md Verra ARR timestamp

* Update readMe.md VM0042 timestamp

* Update README.md VM0017 Timestamp

* Update readme.md Verra timestamps

* fix tools config

* fix import tags

* fix compare dialog

* update swagger

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix lint

Signed-off-by: Stepan Kiryakov <[email protected]>

* upd verra redd 1 [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* bump version

Signed-off-by: simvalery <[email protected]>

* increase hedera test timeout

Signed-off-by: simvalery <[email protected]>

* update tool

Signed-off-by: Stepan Kiryakov <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix lint

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* update tool

Signed-off-by: Stepan Kiryakov <[email protected]>

* schema hidden fields

Signed-off-by: simvalery <[email protected]>

* bump hashgraph sdk

Signed-off-by: simvalery <[email protected]>

* update import\export\validation

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* update compare tool

Signed-off-by: Stepan Kiryakov <[email protected]>

* GITBOOK-1: added icon

* GITBOOK-4: Added structure

* fix unknown field bug

Signed-off-by: simvalery <[email protected]>

* Create readme.md for AMS-III.BB

* Rename readme of AMS-III BB

* Update readme.md of Methodology Library

* Update readme.md of Methodology Library

* GITBOOK-5: Added Multi Policy Diff UI and API

* GITBOOK-6: Search Policy UI and API

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* GITBOOK-7: Document Comparison UI and APIs added

* GITBOOK-8: Tools UI added

* fix bug

Signed-off-by: Stepan Kiryakov <[email protected]>

* GITBOOK-9: removed fixing issues section

* fix bug

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix import

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix artifacts

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix hidden

Signed-off-by: simvalery <[email protected]>

* fix lint

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix hidden required

Signed-off-by: simvalery <[email protected]>

* fix hidden required

Signed-off-by: simvalery <[email protected]>

* field type dropdown

Signed-off-by: simvalery <[email protected]>

* GITBOOK-10: tools api

* GITBOOK-11: Tools APIs added

* retire implementation

Signed-off-by: Artem Buslaev <[email protected]>

* retire contracts

Signed-off-by: Artem Buslaev <[email protected]>

* [skip ci] Add swagger.yaml

* implemented new contract wipe for wipe block

Signed-off-by: Artem Buslaev <[email protected]>

* fix token count in retire vc

Signed-off-by: Artem Buslaev <[email protected]>

* fix contract explorer

Signed-off-by: Artem Buslaev <[email protected]>

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* fix schema configuration errors

Signed-off-by: Artem Buslaev <[email protected]>

* fix contract sync

Signed-off-by: Artem Buslaev <[email protected]>

* fix jwt mailformed

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-12: GHGP V2 policy added

* fix get token serials

Signed-off-by: Artem Buslaev <[email protected]>

* migration 2.17.0

Signed-off-by: Artem Buslaev <[email protected]>

* set access contract as abstract

Signed-off-by: Artem Buslaev <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* [skip ci] Add swagger.yaml

* added visibility depends on permissions in contract

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-13: Updated IPFS timestamps

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix not unique serials

Signed-off-by: Artem Buslaev <[email protected]>

* fix unique serials issue

Signed-off-by: Artem Buslaev <[email protected]>

* fix reject wiper request

Signed-off-by: Artem Buslaev <[email protected]>

* remove required flag for description while contract importing

Signed-off-by: Artem Buslaev <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix contract

Signed-off-by: Artem Buslaev <[email protected]>

* remove unnecessary console logs

Signed-off-by: Artem Buslaev <[email protected]>

* token expiration

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* fix refresh page events

Signed-off-by: simvalery <[email protected]>

* fix tests

Signed-off-by: simvalery <[email protected]>

* fix tests

Signed-off-by: simvalery <[email protected]>

* fix test

Signed-off-by: simvalery <[email protected]>

* fix user registration

Signed-off-by: simvalery <[email protected]>

* incrase test timeout

Signed-off-by: simvalery <[email protected]>

* fix user retire loading

Signed-off-by: Artem Buslaev <[email protected]>

* use ubuntu 20.04 workflow

Signed-off-by: simvalery <[email protected]>

* update

Signed-off-by: Stepan Kiryakov <[email protected]>

* container directive

Signed-off-by: simvalery <[email protected]>

* fix lint

Signed-off-by: Stepan Kiryakov <[email protected]>

* log for sync tasks

Signed-off-by: Artem Buslaev <[email protected]>

* fix synchronization task for docker

Signed-off-by: Artem Buslaev <[email protected]>

* re-run task while error

Signed-off-by: Artem Buslaev <[email protected]>

* fix retire notification

Signed-off-by: Artem Buslaev <[email protected]>

* fix lint

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-15: AMS III.BB

* fix schema pagination

Signed-off-by: Artem Buslaev <[email protected]>

* fix tag permission

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* [skip ci] Add swagger.yaml

* fixes

Signed-off-by: simvalery <[email protected]>

* fixes

Signed-off-by: simvalery <[email protected]>

* fix schemas

Signed-off-by: Stepan Kiryakov <[email protected]>

* remove deprecated wizard endpoint

Signed-off-by: Artem Buslaev <[email protected]>

* [skip ci] Add swagger.yaml

* fix search

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix token update

Signed-off-by: simvalery <[email protected]>

* bump version

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* update css

Signed-off-by: Stepan Kiryakov <[email protected]>

* fix logout error

Signed-off-by: simvalery <[email protected]>

* fix logout error

Signed-off-by: simvalery <[email protected]>

---------

Signed-off-by: Stepan Kiryakov <[email protected]>
Signed-off-by: simvalery <[email protected]>
Signed-off-by: Artem Buslaev <[email protected]>
Co-authored-by: Stepan Kiryakov <[email protected]>
Co-authored-by: envision-ci-agent <[email protected]>
Co-authored-by: Artem Buslaev <[email protected]>
Co-authored-by: prernaadev01 <[email protected]>
  • Loading branch information
5 people authored Oct 24, 2023
1 parent acfe6fe commit 3974315
Show file tree
Hide file tree
Showing 1,263 changed files with 39,059 additions and 9,000 deletions.
1 change: 1 addition & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
buildAndTest:
runs-on: ubuntu-latest
container: ubuntu
# services:
# hashicorpvault:
# image: vault
Expand Down
1 change: 1 addition & 0 deletions Methodology Library/CDM/CDM AMS-III.BB/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

42 changes: 24 additions & 18 deletions Methodology Library/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,35 @@ This folder contains sub folders for each Methodology and their authors (with ma
- Agricultural soils of Western Australia
4. Tolam Earth - OCI
5. Improved Cookstove - OCI
6. Tamuwa VER
7. KrypC GCC
8. eWaste Policy - KrypC(Coming soon)
9. TBA-X (Coming soon)
10. TBA-X (Coming soon)
11. TBA-D (Coming soon)
12. Carbontricity (Coming soon)
13. VN (Coming soon)
14. Evercity (Coming soon)
15. Zeru.Earth (Coming soon)
6. GCC - KrypC
7. Gold Standard Afforestation / Reforestation - Envision
8. CDM AMS-II.G - Envision
9. CDM AMS-III.AR - Envision
10. CDM AMS-III.BB - Envision
11. CDM AMS-III.D - Envision
12. CDM AR-ACM0003 - Envision
13. CDM AMS-I.C (Coming Soon)
14. CDM ACM0001 (Coming Soon)
15. CDM ACM0002 (Coming Soon)
16. CDM AMS-III.F (Coming Soon)
17. CDM ACM0006 (Coming Soon)
18. CDM ACM0018 (Coming Soon)
19. CDM AMS-III.AV (Coming Soon)
20. CDM AMS-III.H (Coming Soon)
21. CDM AMS-I.F (Coming Soon)
22. CDM ACM0007 (Coming Soon)
23. CDM AMS-I.A (Coming Soon)
24. CDM AMS-II.J (Coming Soon)

### Emission Policies

1. GHG Methodology - Remote Workflow - Envision
2. Tymlez - CET & CRU
2. CET & CRU - Tymlez
3. GHG Scope II - Atma
4. GHGP Product Standard - Avery Dennison (Coming soon)
5. E-Mission (Coming soon)
6. RDA - Serapis (Coming soon)
7. GHGP Corporate Standard (Coming soon)
8. EPA CFR 40 p75 (Coming soon)
9. GHGP Data Center Guidance (Coming soon)
10. GHG calcs for NFTGrade (Coming soon)
4. GHGP Corporate Standard - Envision
5. GHGP Product Standard - Avery Dennison (Coming soon)
6. E-Mission (Coming soon)
7. EPA CFR 40 p75 - Serapis (Coming soon)


[IREC](https://github.com/hashgraph/guardian/tree/main/Methodology%20Library/iREC)
Expand Down
7 changes: 4 additions & 3 deletions analytics-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.17.0",
"@guardian/interfaces": "^2.17.0",
"@guardian/common": "^2.18.0-prerelease",
"@guardian/interfaces": "^2.18.0-prerelease",
"@nestjs/common": "^9.4.1",
"@nestjs/core": "^9.4.1",
"@nestjs/jwt": "^10.0.3",
Expand Down Expand Up @@ -76,5 +76,6 @@
"start": "node dist/index.js",
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ui-service.xml"
},
"version": "2.17.0"
"version": "2.18.0-prerelease",
"stableVersion": "2.17.0"
}
7 changes: 4 additions & 3 deletions api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"author": "Envision Blockchain Solutions <[email protected]>",
"dependencies": {
"@guardian/common": "^2.17.0",
"@guardian/interfaces": "^2.17.0",
"@guardian/common": "^2.18.0-prerelease",
"@guardian/interfaces": "^2.18.0-prerelease",
"@nestjs/common": "^9.4.1",
"@nestjs/core": "^9.4.1",
"@nestjs/jwt": "^10.0.3",
Expand Down Expand Up @@ -77,5 +77,6 @@
"start": "node dist/index.js",
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ui-service.xml"
},
"version": "2.17.0"
"version": "2.18.0-prerelease",
"stableVersion": "2.17.0"
}
30 changes: 29 additions & 1 deletion api-gateway/src/api/service/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export class AccountApi {
return await users.getUserByToken(token) as any;
} catch (error) {
new Logger().error(error, ['API_GATEWAY']);
throw new HttpException(error.message, HttpStatus.UNAUTHORIZED);
return null;
// throw new HttpException(error.message, HttpStatus.UNAUTHORIZED);
}

}
Expand Down Expand Up @@ -168,6 +169,33 @@ export class AccountApi {
}
}

@ApiOperation({
summary: 'Returns access token.',
description: 'Returns access token.'
})
@ApiOkResponse({
description: 'Successful operation.',
// schema: {
// $ref: getSchemaPath(AccountsResponseDTO),
// },
})
@Post('access-token')
async getAccessToken(@Body() body: any): Promise<any> {
try {
const {refreshToken} = body;
const users = new Users();
const {accessToken} = await users.generateNewAccessToken(refreshToken);
if (!accessToken) {
throw new HttpException('UNAUTHORIZED', HttpStatus.UNAUTHORIZED);
}
return {
accessToken
}
} catch (e) {
throw new HttpException('UNAUTHORIZED', HttpStatus.UNAUTHORIZED);
}
}

/**
* Accounts
*/
Expand Down
220 changes: 219 additions & 1 deletion api-gateway/src/api/service/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import {
CompareModulesDTO,
ComparePoliciesDTO,
CompareSchemasDTO,
SearchPoliciesDTO
SearchPoliciesDTO,
FilterToolsDTO,
CompareToolsDTO
} from '@middlewares/validation/schemas';

const ONLY_SR = ' Only users with the Standard Registry role are allowed to make the request.'
Expand Down Expand Up @@ -388,6 +390,86 @@ export class AnalyticsApi {
}
}

/**
* Compare tools
*/
@Post('/compare/tools')
@ApiSecurity('bearerAuth')
@ApiOperation({
summary: 'Compare tools.',
description: 'Compare tools.' + ONLY_SR,
})
@ApiBody({
description: 'Filters.',
required: true,
type: FilterToolsDTO,
examples: {
Filter1: {
value: {
toolId1: '000000000000000000000001',
toolId2: '000000000000000000000002'
}
},
Filter2: {
value: {
toolIds: ['000000000000000000000001', '000000000000000000000002'],
}
}
}
})
@ApiOkResponse({
description: 'Successful operation.',
type: CompareToolsDTO
})
@ApiUnauthorizedResponse({
description: 'Unauthorized.',
})
@ApiForbiddenResponse({
description: 'Forbidden.',
})
@ApiInternalServerErrorResponse({
description: 'Internal server error.',
type: InternalServerErrorDTO
})
@HttpCode(HttpStatus.OK)
async compareTools(@Body() body, @Req() req): Promise<any> {
const guardians = new Guardians();
const toolId1 = body ? body.toolId1 : null;
const toolId2 = body ? body.toolId2 : null;
const toolIds = body ? body.toolIds : null;
const eventsLvl = body ? body.eventsLvl : null;
const propLvl = body ? body.propLvl : null;
const childrenLvl = body ? body.childrenLvl : null;
const idLvl = body ? body.idLvl : null;
const user = req.user;
if (!user) {
throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
}

let ids: string[];
if (toolId1 && toolId2) {
ids = [toolId1, toolId2];
} else if (Array.isArray(toolIds) && toolIds.length > 1) {
ids = toolIds;
}
if (!ids) {
throw new HttpException('Invalid parameters', HttpStatus.UNPROCESSABLE_ENTITY);
}
try {
return await guardians.compareTools(
user,
null,
ids,
eventsLvl,
propLvl,
childrenLvl,
idLvl
);
} catch (error) {
throw new HttpException(error.message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}

/**
* Compare policies (CSV)
*/
Expand Down Expand Up @@ -688,4 +770,140 @@ export class AnalyticsApi {
throw new HttpException(error.message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}

/**
* Compare tools (CSV)
*/
@Post('/compare/tools/export')
@ApiSecurity('bearerAuth')
@ApiOperation({
summary: 'Compare tools.',
description: 'Compare tools.' + ONLY_SR,
})
@ApiBody({
description: 'Filters.',
required: true,
type: FilterToolsDTO,
examples: {
Filter1: {
value: {
toolId1: '000000000000000000000001',
toolId2: '000000000000000000000002'
}
},
Filter2: {
value: {
toolIds: ['000000000000000000000001', '000000000000000000000002'],
}
}
}
})
@ApiOkResponse({
description: 'Successful operation.',
type: String
})
@ApiUnauthorizedResponse({
description: 'Unauthorized.',
})
@ApiForbiddenResponse({
description: 'Forbidden.',
})
@ApiInternalServerErrorResponse({
description: 'Internal server error.',
type: InternalServerErrorDTO
})
@HttpCode(HttpStatus.OK)
async compareToolsExport(@Body() body, @Req() req): Promise<any> {
const guardians = new Guardians();
const type = req.query ? req.query.type : null;
const toolId1 = body ? body.toolId1 : null;
const toolId2 = body ? body.toolId2 : null;
const toolIds = body ? body.toolIds : null;
const eventsLvl = body ? body.eventsLvl : null;
const propLvl = body ? body.propLvl : null;
const childrenLvl = body ? body.childrenLvl : null;
const idLvl = body ? body.idLvl : null;
const user = req.user;
if (!user) {
throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
}
let ids: string[];
if (toolId1 && toolId2) {
ids = [toolId1, toolId2];
} else if (Array.isArray(toolIds) && toolIds.length > 1) {
ids = toolIds;
}
if (!ids) {
throw new HttpException('Invalid parameters', HttpStatus.UNPROCESSABLE_ENTITY);
}
try {
return await guardians.compareTools(
user,
type,
ids,
eventsLvl,
propLvl,
childrenLvl,
idLvl
);
} catch (error) {
throw new HttpException(error.message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}

/**
* Search same blocks
*/
@Post('/search/blocks')
@ApiSecurity('bearerAuth')
@ApiOperation({
summary: 'Search same blocks.',
description: 'Search same blocks.' + ONLY_SR,
})
@ApiBody({
description: 'Filters.',
required: true,
type: FilterSearchPoliciesDTO,
examples: {
Filter: {
value: {
uuid: '',
config: {}
}
}
}
})
@ApiOkResponse({
description: 'Successful operation.',
type: SearchPoliciesDTO,
})
@ApiUnauthorizedResponse({
description: 'Unauthorized.',
})
@ApiForbiddenResponse({
description: 'Forbidden.',
})
@ApiInternalServerErrorResponse({
description: 'Internal server error.',
type: InternalServerErrorDTO
})
@HttpCode(HttpStatus.OK)
async searchBlocks(@Body() body, @Req() req): Promise<any> {
await checkPermission(UserRole.STANDARD_REGISTRY)(req.user);
const guardians = new Guardians();
const id = body ? body.id : null;
const config = body ? body.config : null;
const user = req.user;
if (!user) {
throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
}
if (!id || !config) {
throw new HttpException('Invalid parameters', HttpStatus.UNPROCESSABLE_ENTITY);
}
try {
return await guardians.searchBlocks(config, id, user);
} catch (error) {
throw new HttpException(error.message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
Loading

0 comments on commit 3974315

Please sign in to comment.