mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-consumer.git
synced 2026-09-22 09:12:03 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac451fd601 | ||
|
|
6857fe0166 | ||
|
|
89a03e561a |
@@ -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"
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user