Socket
Socket
Sign inDemoInstall

irrasoft-node-codegen

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

irrasoft-node-codegen - npm Package Compare versions

Comparing version 0.0.101 to 0.0.102

2

package.json
{
"name": "irrasoft-node-codegen",
"version": "0.0.101",
"version": "0.0.102",
"bin": {

@@ -5,0 +5,0 @@ "codegen": "./bin/cli.js"

import Router from 'koa-router';
import msgConfig from '@config/msg';
import {
add,
update,
getAll,
getById,
delById
} from '@{{api_version}}/services/{{name}}';
import Models from '@{{api_version}}/services/models';

@@ -15,8 +9,10 @@ const router = new Router({

const model = new Models('{{table}}');
router.get('/', async(ctx) => { // get all
const model = await getAll();
if(model) {
const result = await model.getAll();
if(result) {
ctx.body = {
status: 'success',
data: model
data: result
};

@@ -33,7 +29,7 @@ }else {

const id = ctx.params.id;
const model = await getById(id);
if(model[0]) {
const result = await model.getById(id);
if(result[0]) {
ctx.body = {
status: msgConfig.status.success,
data: model[0]
data: result[0]
};

@@ -49,3 +45,3 @@ }else {

router.post('/', async(ctx) => { // create
const isCreated = await add(ctx.payload);
const isCreated = await model.create(ctx.payload);

@@ -65,3 +61,3 @@ if(isCreated) {

router.put('/', async(ctx) => { // update
const isUpdated = await update(ctx.payload);
const isUpdated = await model.update(ctx.payload);

@@ -82,3 +78,3 @@ if(isUpdated) {

const id = ctx.params.id;
const isDeleted = await delById(id);
const isDeleted = await model.delById(id);
if(isDeleted) {

@@ -85,0 +81,0 @@ ctx.response.body = {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc