|
|
|
@ -35,7 +35,10 @@ module.exports = (config, app) => { |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/setPasswordFromTemporaryCode", async (ctx) => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
.post("/:appname/api/createTemporaryAccess", async (ctx) => { |
|
|
|
|
|
|
|
}) |
|
|
|
.use(async (ctx, next) => { |
|
|
|
|
|
|
|
@ -51,8 +54,25 @@ module.exports = (config, app) => { |
|
|
|
|
|
|
|
await next(); |
|
|
|
}) |
|
|
|
.post("/:appname/api/changeMyPassword", async (ctx) => { |
|
|
|
await ctx.instance.authApi.changeMyPassword( |
|
|
|
ctx.request.body.currentPassword, |
|
|
|
ctx.request.body.newPassword |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/changeMyPassword", async (ctx) => { |
|
|
|
await ctx.instance.authApi.changeMyPassword( |
|
|
|
ctx.request.body.currentPassword, |
|
|
|
ctx.request.body.newPassword |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/executeAction/:actionname", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.actionApi.execute( |
|
|
|
ctx.request.body.actionname, |
|
|
|
ctx.request.body.parameters); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/createUser", async (ctx) => { |
|
|
|
await ctx.instance.authApi.createUser( |
|
|
|
@ -63,44 +83,80 @@ module.exports = (config, app) => { |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/enableUser", async (ctx) => { |
|
|
|
|
|
|
|
await ctx.instance.authApi.enableUser( |
|
|
|
ctx.request.body.username); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/disableUser", async (ctx) => { |
|
|
|
|
|
|
|
await ctx.instance.authApi.disableUser( |
|
|
|
ctx.request.body.username); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.get("/:appname/api/users", async (ctx) => { |
|
|
|
ctx.body = await ctx.instance.authApi.getUsers(); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.get("/:appname/api/accessLevels", async (ctx) => { |
|
|
|
|
|
|
|
}) |
|
|
|
.post("/:appname/api/changeMyPassword", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.authApi.getAccessLevels(); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/listRecords/:indexkey", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.indexApi.listItems( |
|
|
|
ctx.request.body.indexKey, |
|
|
|
{ |
|
|
|
rangeStartParams:ctx.request.body.rangeStartParams, |
|
|
|
rangeEndParams:ctx.request.body.rangeEndParams, |
|
|
|
searchPhrase:ctx.request.body.searchPhrase |
|
|
|
} |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/aggregated/:indexkey", async (ctx) => { |
|
|
|
|
|
|
|
.post("/:appname/api/aggregates/:indexkey", async (ctx) => { |
|
|
|
ctx.body = await ctx.instance.indexApi.aggregates( |
|
|
|
ctx.request.body.indexKey, |
|
|
|
{ |
|
|
|
rangeStartParams:ctx.request.body.rangeStartParams, |
|
|
|
rangeEndParams:ctx.request.body.rangeEndParams, |
|
|
|
searchPhrase:ctx.request.body.searchPhrase |
|
|
|
} |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/record/:recordkey", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.recordApi.save( |
|
|
|
ctx.request.body |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.get("/:appname/api/record/:recordkey", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.recordApi.load( |
|
|
|
ctx.params.recordKey |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.del("/:appname/api/record/:recordkey", async (ctx) => { |
|
|
|
|
|
|
|
await ctx.instance.recordApi.delete( |
|
|
|
ctx.params.recordKey |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/appHeirarchy", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.templateApi.saveApplicationHeirarchy( |
|
|
|
ctx.body |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/actionsAndTriggers", async (ctx) => { |
|
|
|
|
|
|
|
ctx.body = await ctx.instance.templateApi.saveApplicationHeirarchy( |
|
|
|
ctx.body |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}) |
|
|
|
.post("/:appname/api/appDefinition", async (ctx) => { |
|
|
|
|
|
|
|
.get("/:appname/api/appDefinition", async (ctx) => { |
|
|
|
ctx.body = await ctx.instance.templateApi.saveActionsAndTriggers( |
|
|
|
ctx.body |
|
|
|
); |
|
|
|
ctx.response.status = StatusCodes.OK; |
|
|
|
}); |
|
|
|
|
|
|
|
return router; |
|
|
|
|