Skip to content

Commit

Permalink
refactor: post to ipfs as string
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Jul 17, 2023
1 parent 14149b1 commit 930ab1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ___

| Name | Type |
| :------ | :------ |
| `credential` | `Record`<`string`, `unknown`\> |
| `credential` | `string` |

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion e2e/ipfs/ipfs.testSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const ipfsModuleTestSuite = () => {
const { text: cid } = await request(app.getHttpServer())
.post(`/v1/ipfs/`)
.set('Cookie', requester.cookies)
.send(claimData)
.send(JSON.stringify(claimData))
.expect(HttpStatus.CREATED);

const claimPinned = new Promise<void>((resolve) => {
Expand Down
9 changes: 5 additions & 4 deletions src/modules/ipfs/ipfs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export class IPFSController {
@ApiTags('IPFS')
@ApiOperation({
summary: 'Returns content from IPFS Store',
description: 'Returns data identified by the provided content identifier (cid). This can be used, for example, to resolve credentials linked in the service endpoint of a DID document.',
description:
'Returns data identified by the provided content identifier (cid). This can be used, for example, to resolve credentials linked in the service endpoint of a DID document.',
})
@ApiParam({ name: 'cid', type: 'string', required: true })
public async get(@Param('cid', CIDPipe) cid: CID): Promise<string> {
Expand All @@ -34,13 +35,13 @@ export class IPFSController {
@ApiTags('IPFS')
@ApiBody({
type: 'string',
description: 'Stringified credential',
description: 'Stringified content',
})
@ApiOperation({
summary: 'Saves content in IPFS',
description: 'Saves content in IPFS and returns its CID',
})
public async save(@Body() credential: Record<string, unknown>) {
return this.ipfsService.save(JSON.stringify(credential));
public async save(@Body() credential: string) {
return this.ipfsService.save(credential);
}
}

0 comments on commit 930ab1c

Please sign in to comment.