diff --git a/config/system-user-dev.json b/config/system-user-dev.json index 392cd37..dba11f2 100644 --- a/config/system-user-dev.json +++ b/config/system-user-dev.json @@ -1,6 +1,6 @@ { - "password": "mldYweOqZuC1X3hWOulN", + "password": "YsFhsCVCqussWyyLYUjM", "email": "system@system.com", - "id": "67fb37a215494c3f09dae5ed", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZmIzN2EyMTU0OTRjM2YwOWRhZTVlZCIsImlhdCI6MTc0NDUxNzAyNn0.HpNCWf8VXveKHIF32eLV9sf9G0QlTmLdLKzEp9BxOg4" + "id": "67ffbea61a8de3388f82c401", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZmZiZWE2MWE4ZGUzMzg4ZjgyYzQwMSIsImlhdCI6MTc0NDgxMzczNH0.a4wM-CfGudF40yi4lwTsnd_aDZHrRn87zjHYxFZmeC4" } \ No newline at end of file diff --git a/src/adapters/ipfs-files/index.js b/src/adapters/ipfs-files/index.js index be9afab..fde62ab 100644 --- a/src/adapters/ipfs-files/index.js +++ b/src/adapters/ipfs-files/index.js @@ -191,8 +191,11 @@ class IpfsFilesAdapter { throw new Error('No IPFS File Pin Service provider available yet.') } + const { page } = inObj + const rpcData = { - endpoint: 'getPins' + endpoint: 'getPins', + page } // Generate a UUID for the call. diff --git a/src/controllers/rest-api/ipfs/controller.js b/src/controllers/rest-api/ipfs/controller.js index 452c656..2076244 100644 --- a/src/controllers/rest-api/ipfs/controller.js +++ b/src/controllers/rest-api/ipfs/controller.js @@ -262,11 +262,11 @@ class IpfsRESTControllerLib { */ async getPins (ctx) { try { - // const { cid } = ctx.params + const { page } = ctx.params const ipfsFiles = this.adapters.ipfsFiles - const pinData = await ipfsFiles.getPins() + const pinData = await ipfsFiles.getPins({ page }) console.log('getPins() pinData: ', pinData) ctx.body = pinData diff --git a/src/controllers/rest-api/ipfs/index.js b/src/controllers/rest-api/ipfs/index.js index de003a6..3ece723 100644 --- a/src/controllers/rest-api/ipfs/index.js +++ b/src/controllers/rest-api/ipfs/index.js @@ -60,7 +60,7 @@ class IpfsRouter { this.router.get('/download/:cid', this.ipfsRESTController.downloadFile) this.router.get('/service', this.ipfsRESTController.getService) this.router.get('/file-info/:cid', this.ipfsRESTController.getFileInfo) - this.router.get('/pins', this.ipfsRESTController.getPins) + this.router.get('/pins/:page', this.ipfsRESTController.getPins) this.router.get('/cid2json/:cid', this.ipfsRESTController.cid2json) this.router.post('/pin-claim', this.ipfsRESTController.pinClaim) // Attach the Controller routes to the Koa app. diff --git a/test/unit/controllers/rest-api/ipfs/ipfs.rest.controller.unit.js b/test/unit/controllers/rest-api/ipfs/ipfs.rest.controller.unit.js index 8c8a1d0..8d83833 100644 --- a/test/unit/controllers/rest-api/ipfs/ipfs.rest.controller.unit.js +++ b/test/unit/controllers/rest-api/ipfs/ipfs.rest.controller.unit.js @@ -400,12 +400,14 @@ describe('#IPFS REST API', () => { assert.isTrue(ctx.body.success) }) }) + describe('#getPins', () => { it('should return 422 status on biz logic error', async () => { try { sandbox.stub(uut.adapters.ipfsFiles, 'getPins').throws(new Error('test error')) ctx.request.body = {} + ctx.params = { page: 1} await uut.getPins(ctx) @@ -421,12 +423,14 @@ describe('#IPFS REST API', () => { sandbox.stub(uut.adapters.ipfsFiles, 'getPins').resolves({ success: true }) ctx.request.body = {} + ctx.params = { page: 1} await uut.getPins(ctx) assert.isTrue(ctx.body.success) }) }) + describe('#cid2json', () => { it('should return 422 status on biz logic error', async () => { try {