-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from Muzikie/feature/adapt-to-muzikie
Merge Feature/adapt-to-muzikie into development
- Loading branch information
Showing
73 changed files
with
3,225 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
services/blockchain-indexer/methods/dataService/controllers/audios.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { | ||
HTTP: { StatusCodes: { BAD_REQUEST } }, | ||
Exceptions: { ValidationException, InvalidParamsException }, | ||
} = require('lisk-service-framework'); | ||
|
||
const dataService = require('../../../shared/dataService'); | ||
|
||
const getAudios = async params => { | ||
const audios = { | ||
data: [], | ||
meta: {}, | ||
}; | ||
|
||
try { | ||
const response = await dataService.getAudios(params); | ||
if (response.data) audios.data = response.data; | ||
if (response.meta) audios.meta = response.meta; | ||
|
||
return audios; | ||
} catch (err) { | ||
let status; | ||
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS'; | ||
if (err instanceof ValidationException) status = BAD_REQUEST; | ||
if (status) return { status, data: { error: err.message } }; | ||
throw err; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
getAudios, | ||
}; |
31 changes: 31 additions & 0 deletions
31
services/blockchain-indexer/methods/dataService/controllers/collections.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { | ||
HTTP: { StatusCodes: { BAD_REQUEST } }, | ||
Exceptions: { ValidationException, InvalidParamsException }, | ||
} = require('lisk-service-framework'); | ||
|
||
const dataService = require('../../../shared/dataService'); | ||
|
||
const getCollections = async params => { | ||
const collections = { | ||
data: [], | ||
meta: {}, | ||
}; | ||
|
||
try { | ||
const response = await dataService.getCollections(params); | ||
if (response.data) collections.data = response.data; | ||
if (response.meta) collections.meta = response.meta; | ||
|
||
return collections; | ||
} catch (err) { | ||
let status; | ||
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS'; | ||
if (err instanceof ValidationException) status = BAD_REQUEST; | ||
if (status) return { status, data: { error: err.message } }; | ||
throw err; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
getCollections, | ||
}; |
31 changes: 31 additions & 0 deletions
31
services/blockchain-indexer/methods/dataService/controllers/profiles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { | ||
HTTP: { StatusCodes: { BAD_REQUEST } }, | ||
Exceptions: { ValidationException, InvalidParamsException }, | ||
} = require('lisk-service-framework'); | ||
|
||
const dataService = require('../../../shared/dataService'); | ||
|
||
const getProfiles = async params => { | ||
const profiles = { | ||
data: [], | ||
meta: {}, | ||
}; | ||
|
||
try { | ||
const response = await dataService.getProfiles(params); | ||
if (response.data) profiles.data = response.data; | ||
if (response.meta) profiles.meta = response.meta; | ||
|
||
return profiles; | ||
} catch (err) { | ||
let status; | ||
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS'; | ||
if (err instanceof ValidationException) status = BAD_REQUEST; | ||
if (status) return { status, data: { error: err.message } }; | ||
throw err; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
getProfiles, | ||
}; |
31 changes: 31 additions & 0 deletions
31
services/blockchain-indexer/methods/dataService/controllers/subscriptions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { | ||
HTTP: { StatusCodes: { BAD_REQUEST } }, | ||
Exceptions: { ValidationException, InvalidParamsException }, | ||
} = require('lisk-service-framework'); | ||
|
||
const dataService = require('../../../shared/dataService'); | ||
|
||
const getSubscriptions = async params => { | ||
const subscriptions = { | ||
data: [], | ||
meta: {}, | ||
}; | ||
|
||
try { | ||
const response = await dataService.getSubscriptions(params); | ||
if (response.data) subscriptions.data = response.data; | ||
if (response.meta) subscriptions.meta = response.meta; | ||
|
||
return subscriptions; | ||
} catch (err) { | ||
let status; | ||
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS'; | ||
if (err instanceof ValidationException) status = BAD_REQUEST; | ||
if (status) return { status, data: { error: err.message } }; | ||
throw err; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
getSubscriptions, | ||
}; |
16 changes: 16 additions & 0 deletions
16
services/blockchain-indexer/methods/dataService/modules/audio.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { | ||
getAudios, | ||
} = require('../controllers/audios'); | ||
|
||
module.exports = [ | ||
{ | ||
name: 'audios', | ||
controller: getAudios, | ||
params: { | ||
creatorAddress: { optional: true, type: 'string' }, | ||
audioID: { optional: true, type: 'string' }, | ||
limit: { optional: true, type: 'number' }, | ||
offset: { optional: true, type: 'number' }, | ||
}, | ||
}, | ||
]; |
16 changes: 16 additions & 0 deletions
16
services/blockchain-indexer/methods/dataService/modules/collection.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { | ||
getCollections, | ||
} = require('../controllers/collections'); | ||
|
||
module.exports = [ | ||
{ | ||
name: 'collections', | ||
controller: getCollections, | ||
params: { | ||
creatorAddress: { optional: true, type: 'string' }, | ||
collectionID: { optional: true, type: 'string' }, | ||
limit: { optional: true, type: 'number' }, | ||
offset: { optional: true, type: 'number' }, | ||
}, | ||
}, | ||
]; |
16 changes: 16 additions & 0 deletions
16
services/blockchain-indexer/methods/dataService/modules/profile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { | ||
getProfiles, | ||
} = require('../controllers/profiles'); | ||
|
||
module.exports = [ | ||
{ | ||
name: 'profiles', | ||
controller: getProfiles, | ||
params: { | ||
creatorAddress: { optional: true, type: 'string' }, | ||
profileID: { optional: true, type: 'string' }, | ||
limit: { optional: true, type: 'number' }, | ||
offset: { optional: true, type: 'number' }, | ||
}, | ||
}, | ||
]; |
17 changes: 17 additions & 0 deletions
17
services/blockchain-indexer/methods/dataService/modules/subscription.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { | ||
getSubscriptions, | ||
} = require('../controllers/subscriptions'); | ||
|
||
module.exports = [ | ||
{ | ||
name: 'subscriptions', | ||
controller: getSubscriptions, | ||
params: { | ||
creatorAddress: { optional: true, type: 'string' }, | ||
subscriptionID: { optional: true, type: 'string' }, | ||
limit: { optional: true, type: 'number' }, | ||
offset: { optional: true, type: 'number' }, | ||
memberAddress: { optional: true, type: 'string' }, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { Logger } = require('lisk-service-framework'); | ||
const util = require('util'); | ||
|
||
const logger = Logger(); | ||
|
||
const business = require('./business'); | ||
|
||
const getAudios = async params => { | ||
// Store logs | ||
if (params.audioID) logger.debug(`Retrieved audio with ID ${params.audioID} from Lisk Core`); | ||
else if (params.creatorAddress) logger.debug(`Retrieved audio with creatorAddress: ${params.creatorAddress} from Lisk Core`); | ||
else logger.debug(`Retrieved audios with custom search: ${util.inspect(params)} from Lisk Core`); | ||
|
||
// Get data from server | ||
const response = await business.getAudios(params); | ||
|
||
return response; | ||
}; | ||
|
||
module.exports = { | ||
getAudios, | ||
}; |
Oops, something went wrong.