@quorum/schematics
Advanced tools
Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "@quorum/schematics", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A schematics Library for Quorum", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -12,3 +12,3 @@ import { StoredProcedure } from "common/message-broker"; | ||
export class <%= classify(name) %> { | ||
static create<%= classify(nameSingular) %>(<%= nameSingular %> : <%= classify(nameSingular) %>, routingDetails: any): BrokerMessagePayload { | ||
static create<%= classify(nameSingular) %>(<%= nameSingular %>: <%= classify(nameSingular) %>, routingDetails: any): BrokerMessagePayload { | ||
let brokerMessagePayload: BrokerMessagePayload; | ||
@@ -19,3 +19,3 @@ if (routingDetails.version === 1) { | ||
//Populate parameters here | ||
sp.parameters.push(new SqlParameter(parameterTypes.input, '', variableTypes.int, null, null, 0); | ||
sp.parameters.push(new SqlParameter(parameterTypes.input, '', variableTypes.int, null, null, 0)); | ||
@@ -33,3 +33,3 @@ brokerMessagePayload = new BrokerMessagePayload(RequestTypes.StoredProcedure, sp, uuid()); | ||
//Populate parameters here | ||
sp.parameters.push(new SqlParameter(parameterTypes.input, '', variableTypes.int, null, null, 0); | ||
sp.parameters.push(new SqlParameter(parameterTypes.input, '', variableTypes.int, null, null, 0)); | ||
@@ -48,3 +48,3 @@ brokerMessagePayload = new BrokerMessagePayload(RequestTypes.StoredProcedure, sp, uuid()); | ||
if(params.parameterName != null) | ||
sp.parameters.push(new SqlParameter(parameterTypes.input, '', variableTypes.int, null, null, 0); | ||
sp.parameters.push(new SqlParameter(parameterTypes.input, '', variableTypes.int, null, null, 0)); | ||
@@ -56,3 +56,3 @@ brokerMessagePayload = new BrokerMessagePayload(RequestTypes.StoredProcedure, sp, uuid()); | ||
static update<%= classify(nameSingular) %>(id: number, <%= nameSingular %> : <%= classify(nameSingular) %>, routingDetails: any): BrokerMessagePayload { | ||
static update<%= classify(nameSingular) %>(id: number, <%= nameSingular %>: <%= classify(nameSingular) %>, routingDetails: any): BrokerMessagePayload { | ||
let brokerMessagePayload: BrokerMessagePayload; | ||
@@ -59,0 +59,0 @@ if (routingDetails.version === 1) { |
import { Server } from 'restify'; | ||
import { <%= classify(nameSingular) %>s } from './<%= dasherize(nameSingular) %>s.class'; | ||
import { <%= classify(nameSingular) %> } from './<%= dasherize(nameSingular) %>.model'; | ||
import { }; | ||
//import for model.barrel | ||
//import for server.barrel | ||
import { | ||
@@ -14,7 +17,7 @@ DataTerminalBrokerMessage, | ||
export default (server: Server, dtBroker: MessageBrokerDataTerminal) => { | ||
server.get('/v/:version/<%= dasherize(routeParent) %>/<%= classify(name) %>/:id', (req: any, res, next) => { | ||
server.get('/v/:version/<%= dasherize(routeParent) %>/<%= dasherize(name) %>/:id', (req: any, res, next) => { | ||
try { | ||
const brokerMessagePayloads = new Array<DataTerminalBrokerMessagePayload>(); | ||
brokerMessagePayloads.push( | ||
<%= classify(nameSingular) %> s.get <%= classify(nameSingular) %> (req.params.id, { | ||
<%= classify(name) %>.get<%= classify(nameSingular) %>(req.params.id, { | ||
server: req.routingDetails.databaseServer, | ||
@@ -29,3 +32,3 @@ dsn: req.routingDetails.databaseName, | ||
.then((brokerMessage: DataTerminalBrokerMessage) => { | ||
const <%= nameSingular %> : <%= classify(nameSingular) %> = brokerMessage.payloads[0].recordsets[0][0]; | ||
const <%= nameSingular %>: <%= classify(nameSingular) %> = brokerMessage.payloads[0].recordsets[0][0]; | ||
res.json(<%= nameSingular %>); | ||
@@ -48,7 +51,7 @@ return next(); | ||
server.get('/v/:version/<%= dasherize(routeParent) %>/<%= classify(name) %>', (req: any, res, next) => { | ||
server.get('/v/:version/<%= dasherize(routeParent) %>/<%= dasherize(name) %>', (req: any, res, next) => { | ||
try { | ||
const brokerMessagePayloads = new Array<DataTerminalBrokerMessagePayload>(); | ||
brokerMessagePayloads.push( | ||
<%= classify(nameSingular) %> s.get <%= classify(nameSingular) %> s(req.query, { | ||
<%= classify(name) %>.get<%= classify(nameSingular) %>s(req.query, { | ||
server: req.routingDetails.databaseServer, | ||
@@ -67,4 +70,4 @@ dsn: req.routingDetails.databaseName, | ||
const <%= nameSingular %> s : <%= classify(nameSingular) %> [] = brokerMessage.payloads[0].recordsets[0]; | ||
res.json(<%= nameSingular %> s); | ||
const <%= nameSingular %>s: <%= classify(nameSingular) %> [] = brokerMessage.payloads[0].recordsets[0]; | ||
res.json(<%= nameSingular %>s); | ||
return next(); | ||
@@ -86,7 +89,7 @@ }) | ||
server.post('/v/:version/<%= dasherize(routeParent) %>/<%= classify(name) %>', (req: any, res, next) => { | ||
server.post('/v/:version/<%= dasherize(routeParent) %>/<%= dasherize(name) %>', (req: any, res, next) => { | ||
try { | ||
const brokerMessagePayloads = new Array<DataTerminalBrokerMessagePayload>(); | ||
brokerMessagePayloads.push( | ||
<%= classify(nameSingular) %> s.create <%= classify(nameSingular) %> (req.body, { | ||
<%= classify(name) %>.create <%= classify(nameSingular) %>(req.body, { | ||
server: req.routingDetails.databaseServer, | ||
@@ -101,3 +104,3 @@ dsn: req.routingDetails.databaseName, | ||
.then((brokerMessage: DataTerminalBrokerMessage) => { | ||
const <%= nameSingular %> : <%= classify(nameSingular) %> = brokerMessage.payloads[0].recordsets[0][0]; | ||
const <%= nameSingular %>: <%= classify(nameSingular) %> = brokerMessage.payloads[0].recordsets[0][0]; | ||
res.json(<%= nameSingular %>); | ||
@@ -120,7 +123,7 @@ return next(); | ||
server.put('/v/:version/<%= dasherize(routeParent) %>/<%= classify(name) %>/:id', (req: any, res, next) => { | ||
server.put('/v/:version/<%= dasherize(routeParent) %>/<%= dasherize(name) %>/:id', (req: any, res, next) => { | ||
try { | ||
const brokerMessagePayloads = new Array<DataTerminalBrokerMessagePayload>(); | ||
brokerMessagePayloads.push( | ||
<%= classify(nameSingular) %> s.update <%= classify(nameSingular) %> (req.body, { | ||
<%= classify(name) %>.update <%= classify(nameSingular) %>(req.body, { | ||
server: req.routingDetails.databaseServer, | ||
@@ -135,3 +138,3 @@ dsn: req.routingDetails.databaseName, | ||
.then((brokerMessage: DataTerminalBrokerMessage) => { | ||
const <%= nameSingular %> : <%= classify(nameSingular) %> = brokerMessage.payloads[0].recordsets[0][0]; | ||
const <%= nameSingular %>: <%= classify(nameSingular) %> = brokerMessage.payloads[0].recordsets[0][0]; | ||
res.json(<%= nameSingular %>); | ||
@@ -138,0 +141,0 @@ return next(); |
@@ -18,4 +18,5 @@ import { DataTerminalBrokerMessageHeaders as BrokerMessageHeaders } from "common/message-broker"; | ||
let response: BrokerMessage; | ||
let updatedRecord: <%= classify(nameSingular) %>; | ||
let <%= nameSingular %>: <%= classify(nameSingular) %>; | ||
let create<%= nameSingular %> : <%= classify(nameSingular) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<%= classify(name) %>', 'post'); | ||
let create<%= classify(nameSingular) %>: <%= classify(nameSingular) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<%= dasherize(name) %>', 'post'); | ||
@@ -36,3 +37,3 @@ before((done) => { | ||
); | ||
result.payloads.push( <%= classify(nameSingular) %>s.create<%= classify(nameSingular) %>(<%= nameSingular %> , { | ||
result.payloads.push(<%= classify(nameSingular) %>s.create<%= classify(nameSingular) %>(<%= nameSingular %>, { | ||
server: process.env.TESTING_SERVER, | ||
@@ -90,4 +91,2 @@ dsn: process.env.TEMP_DB, | ||
describe('<%= classify(routeParent) %>.update<%= classify(nameSingular) %>', () => { | ||
let updatedRecord: <%= classify(nameSingular) %>; | ||
before((done) => { | ||
@@ -94,0 +93,0 @@ //modify <%= nameSingular %> here |
@@ -11,3 +11,3 @@ import { DataTerminalBrokerMessagePayload as BrokerMessagePayload } from "common/message-broker"; | ||
describe('Version 1', () => { | ||
let <% nameSingular %> : <%= classify(name) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<% classify(name) %>s', 'post'); | ||
let <%= nameSingular %>: <%= classify(name) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<%= dasherize(name) %>s', 'post'); | ||
@@ -30,3 +30,3 @@ const result: BrokerMessagePayload = <%= classify(name) %>.create<%= classify(nameSingular) %>(<%= nameSingular %>, { server: 'test', dsn: 'test', version: 1 }); | ||
describe('Version 1', () => { | ||
let <% nameSingular %> : <%= classify(name) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<% classify(name) %>/{id}', 'get'); | ||
let <%= nameSingular %>: <%= classify(name) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<%= dasherize(name) %>/{id}', 'get'); | ||
@@ -48,3 +48,3 @@ const result: BrokerMessagePayload = <%= classify(name) %>.get<%= classify(nameSingular) %>('1', { server: 'test', dsn: 'test', version: 1 }); | ||
describe('Version 1', () => { | ||
const params: <%= classify(nameSingular) %> QueryParameters = DocParser(getExampleData(<%= classify(routeParent) %>), '/<%= classify(name) %>', 'get'); | ||
const params: <%= classify(nameSingular) %> QueryParameters = DocParser(getExampleData(<%= classify(routeParent) %>), '/<%= dasherize(name) %>', 'get'); | ||
const result: BrokerMessagePayload = <%= classify(name) %>.get<%= classify(name) %>(params, { server: 'test', dsn: 'test', version: 1 }); | ||
@@ -65,5 +65,5 @@ it('it should be a stored procedure', () => { | ||
describe('Version 1', () => { | ||
let <% nameSingular %> : <%= classify(name) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<% classify(name) %>s', 'put'); | ||
let <%= nameSingular %>: <%= classify(name) %> = DocParser.getExampleData('<%= classify(routeParent) %>', '/<%= dasherize(name) %>s', 'put'); | ||
const result: BrokerMessagePayload = <%= classify(name) %>.update<%= classify(nameSingular) %>(<% nameSingular %>.id <%= nameSingular %>, { server: 'test', dsn: 'test', version: 1 }); | ||
const result: BrokerMessagePayload = <%= classify(name) %>.update<%= classify(nameSingular) %>(<%= nameSingular %>.id <%= nameSingular %>, { server: 'test', dsn: 'test', version: 1 }); | ||
it('it should be a stored procedure', () => { | ||
@@ -70,0 +70,0 @@ expect(result.requestType).to.equal(RequestTypes.StoredProcedure); |
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
49224
854