irrasoft-node-codegen
Advanced tools
Comparing version 0.0.103 to 0.0.104
{ | ||
"name": "irrasoft-node-codegen", | ||
"version": "0.0.103", | ||
"version": "0.0.104", | ||
"bin": { | ||
@@ -5,0 +5,0 @@ "codegen": "./bin/cli.js" |
@@ -12,3 +12,4 @@ import Router from 'koa-router'; | ||
router.get('/', async(ctx) => { // get all | ||
const result = await model.getAll(); | ||
const { limit, offset } = ctx.query | ||
const result = await model.getAll(limit, offset); | ||
if(result) { | ||
@@ -44,7 +45,8 @@ ctx.body = { | ||
router.post('/', async(ctx) => { // create | ||
const isCreated = await model.create(ctx.payload); | ||
const data = await model.create(ctx.payload); | ||
if(isCreated) { | ||
if(data) { | ||
ctx.response.body = { | ||
status: 'success', | ||
data: isCreated | ||
}; | ||
@@ -54,3 +56,3 @@ }else { | ||
status: 'error', | ||
message: msgConfig.message.error.internalError | ||
message: msgConfig.message.error.invalidPayload | ||
}; | ||
@@ -60,8 +62,9 @@ } | ||
router.put('/', async(ctx) => { // update | ||
const isUpdated = await model.update(ctx.payload); | ||
router.put('/:id', async(ctx) => { // update | ||
const data = await model.update(ctx.params.id, ctx.payload); | ||
if(isUpdated) { | ||
if(data) { | ||
ctx.response.body = { | ||
status: 'success', | ||
data: data | ||
}; | ||
@@ -68,0 +71,0 @@ }else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15355
388