Skip to content

Commit

Permalink
inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
Signorini committed Aug 14, 2017
1 parent af45e95 commit 449a237
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/core/applications/persistenceApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const PersistenceApp = (Entity, PersistenceServices = DPersistenceServices) => {

create (req, res, next) {

_.defaults(req.body, Entity.defaults || {});

const bodyWithOwner = Object.assign(
{},
req.body,
Expand Down
2 changes: 0 additions & 2 deletions app/inventory/applications/persistenceApplications.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const persistenceApplications = (Entity, PersistenceServices = DPersistenceServi
{dest: 'system.name', source: 'lsystem'}
]);

console.log(query);

Object.assign(req, {query});
PersistenceApplication(Entity, PersistenceServices)
.find(req, res, next);
Expand Down
4 changes: 3 additions & 1 deletion app/inventory/entities/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const _ = require('lodash');
const Applications = require('../repositories/dao/applications');

const app = () => {
const resFilled = ['_id', 'updated_at', 'created_at', 'name', 'environment', 'system.name', 'system._id', 'servers', 'role', 'spec', 'language', 'cluster', 'deploy', 'tags', 'description'];
const resFilled = ['_id', 'updated_at', 'created_at', 'name', 'family', 'environment', 'system.name', 'system._id', 'servers', 'role', 'spec', 'language', 'cluster', 'deploy', 'tags', 'description'];

const singleFilled = [...resFilled, 'roles', 'owner'];

Expand All @@ -20,6 +20,8 @@ const app = () => {

dao: Applications,

defaults: {family: 'Application'},

filled,
singleFilled,
resFilled
Expand Down
3 changes: 2 additions & 1 deletion app/inventory/validators/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const schema = Joi.object().keys({
refs: Joi.string()
}),
spec: Joi.object({
role: Joi.string().valid('Application', 'Worker', 'LoadBalance', 'Jobs', 'Service Discovery', 'Monitoring', 'Testing', 'Standard').required(),
role: Joi.string().valid('Application', 'Worker', 'Jobs', 'Service Discovery', 'Monitoring', 'Testing', 'Standard').required(),
endpoint: Joi.string().uri().max(250),
path: Joi.string().max(150),
command: Joi.string().max(150),
Expand All @@ -51,6 +51,7 @@ const schema = Joi.object().keys({
deploy: Joi.array().items(deploy),
roles: Joi.array().items(roles).unique('_id'),
environment: Joi.string().valid('Production', 'Staging', 'Development', 'UTA', 'Training', 'SandBox').required(),
family: Joi.string().valid('Application', 'LoadBalance', 'Broker', 'DataBase', 'Serveless', 'Api Gateway', 'SearchEngine', 'Cache').default("Application"),
tags: Joi.array().items(tags),
active: Joi.boolean()
});
Expand Down
21 changes: 21 additions & 0 deletions migrations/0020-system_options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';


exports.up = function (db, next) {
let pets = db.collection('adminer');
pets.insert({
"value": {
check: ['Public URL', 'Private URL', 'Admin', 'WebSocket', 'TCP/IP', 'Unix Sock', 'HealthCheck'],
apps: ['Application', 'LoadBalance', 'Broker', 'DataBase', 'Serveless', 'Api Gateway', 'SearchEngine', 'Cache']
},
"key": "system_options",
"active": true,
"updated_at": new Date()
}, next);
};

exports.down = function (db, next) {
let pets = db.collection('adminer');

pets.findAndModify({key: 'system_options'}, [], {}, {remove: true}, next);
};

0 comments on commit 449a237

Please sign in to comment.