Skip to content

Commit

Permalink
Merge pull request #657 from energywebfoundation/SWTCH-2330_rm_claim_…
Browse files Browse the repository at this point in the history
…by_subjects_endpoint

SWTCH-2330 Remove claims by subjects endpoint
  • Loading branch information
JGiter authored Jul 6, 2023
2 parents ca0183f + 34b62d2 commit b161015
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 46 deletions.
20 changes: 0 additions & 20 deletions docs/api/classes/modules_claim_claim_controller.ClaimController.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
- [getByRequesterDid](modules_claim_claim_controller.ClaimController.md#getbyrequesterdid)
- [getByRevokerDid](modules_claim_claim_controller.ClaimController.md#getbyrevokerdid)
- [getBySubject](modules_claim_claim_controller.ClaimController.md#getbysubject)
- [getBySubjects](modules_claim_claim_controller.ClaimController.md#getbysubjects)
- [getByUserDid](modules_claim_claim_controller.ClaimController.md#getbyuserdid)
- [getDidsOfNamespace](modules_claim_claim_controller.ClaimController.md#getdidsofnamespace)
- [getIssuedClaimsBySubjects](modules_claim_claim_controller.ClaimController.md#getissuedclaimsbysubjects)
Expand Down Expand Up @@ -187,25 +186,6 @@ ___

___

### getBySubjects

**getBySubjects**(`«destructured»`, `isAccepted?`, `namespace?`, `user?`): `Promise`<[`RoleClaim`](modules_claim_entities_roleClaim_entity.RoleClaim.md)[]\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `«destructured»` | [`DIDsQuery`](modules_claim_entities_roleClaim_entity.DIDsQuery.md) |
| `isAccepted?` | `boolean` |
| `namespace?` | `string` |
| `user?` | `string` |

#### Returns

`Promise`<[`RoleClaim`](modules_claim_entities_roleClaim_entity.RoleClaim.md)[]\>

___

### getByUserDid

**getByUserDid**(`did`, `user?`): `Promise`<[`RoleClaim`](modules_claim_entities_roleClaim_entity.RoleClaim.md)[]\>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/claim/claim.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ describe('ClaimsController', () => {
});
});

it('`/by/subjects` should return only claim related to authenticated user', async () => {
it.skip('`/by/subjects` should return only claim related to authenticated user', async () => {
const requester = randomDID();
const foreignRequester = randomDID();
const [ownedClaim] = await Promise.all([
Expand Down Expand Up @@ -573,7 +573,7 @@ describe('ClaimsController', () => {
it('should be able to specify rejection reason', async () => {
didMock.mockReturnValueOnce(requesterDID);
await testHttpServer
.get(`/v1/claim/by/subjects?subjects=${requesterDID}`)
.get(`/v1/claim/subject/${requesterDID}`)
.expect(200)
.expect((res) => {
expect(res.body).toBeInstanceOf(Array);
Expand Down
24 changes: 0 additions & 24 deletions src/modules/claim/claim.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,30 +451,6 @@ export class ClaimController {
return this.claimService.getDidOfClaimsOfNamespace(namespace, accepted);
}

@UsePipes(new ValidationPipe({ transform: true }))
@Get('/by/subjects')
@ApiQuery({
name: 'subjects',
required: true,
description: 'DIDs whose claims are being requested',
})
@ApiTags('Claims')
@ApiOperation({
summary: 'returns claims requested for given DIDs',
})
public async getBySubjects(
@Query() { subjects }: DIDsQuery,
@Query('isAccepted', BooleanPipe) isAccepted?: boolean,
@Query('namespace') namespace?: string,
@User() user?: string
) {
return this.claimService.getBySubjects({
subjects,
filters: { isAccepted, namespace },
currentUser: user,
});
}

@UsePipes(new ValidationPipe({ transform: true, whitelist: true }))
@Post('/issued')
@ApiExcludeEndpoint()
Expand Down

0 comments on commit b161015

Please sign in to comment.