nuevo micro servicio Item

This commit is contained in:
Daniel Herrero 2017-12-19 12:29:35 +01:00
parent 2c03dcf139
commit 55691b4cc9
16 changed files with 218 additions and 43 deletions

View File

@ -7,13 +7,18 @@ vn-textfield {
width: auto;
top: 0px;
right: -6px;
margin: 22px 0px;
background: transparent;
margin: 21px 0px;
background: white;
opacity: 1;
z-index: 9999;
color: #aaa;
}
.material-icons {
font-size: 18px;
float: right;
margin-right: 5px;
}
.material-icons:hover {
color: rgba(0,0,0, .87);
}
}

View File

@ -1,7 +1,7 @@
{
"module": "item",
"name": "Items",
"icon": "/static/images/icon_articles.svg",
"icon": "/static/images/icon_item.svg",
"routes": [
{
"url": "/item",

View File

@ -1 +1,24 @@
<h1>hi world</h1>
<mg-ajax path="/item/api/Items/filter" options="mgIndex"></mg-ajax>
<div margin-medium>
<div style="max-width: 40em; margin: 0 auto;">
<vn-card>
<vn-horizontal pad-medium>
<vn-searchbar vn-one
index="index"
on-search="$ctrl.search(index)"
advanced="true"
popover="vn-item-search-panel"
ignore-keys = "['page', 'size', 'search']"
>
</vn-searchbar>
</vn-horizontal>
</vn-card>
<vn-card margin-medium-top>
<vn-item-product ng-repeat="item in index.model.instances" title="View item" item="item"></vn-item-product>
</vn-card>
<vn-paging index="index" total="index.model.count"></vn-paging>
</div>
<a ui-sref="item.create" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>
</div>

View File

@ -87,7 +87,19 @@ services:
expose:
- "3006"
ports:
- "3006:3006"
- "3006:3006"
item:
environment:
- NODE_ENV=${NODE_ENV}
container_name: "${BRANCH_NAME}-item"
image: "item:${TAG}"
build:
context: ./services
dockerfile: /item/Dockerfile
expose:
- "3007"
ports:
- "3007:3007"
nginx:
container_name: "${BRANCH_NAME}-nginx"
image: "nginx:${TAG}"

15
services/item/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM node:6.9.1
COPY item /app
COPY loopback /loopback
WORKDIR /app
RUN npm install
RUN npm -g install pm2
CMD ["pm2-docker", "./server/server.js"]
EXPOSE 3007

View File

@ -0,0 +1,20 @@
module.exports = Self => {
Self.installMethod('filter', filterParams);
function filterParams(params) {
let filter = {
where: {},
skip: (params.page - 1) * params.size,
limit: params.size,
order: params.order || 'name ASC'/* ,
include: {
relation: "greugeType",
scope: {
fields: ["id", "name"]
}
} */
};
return filter;
}
};

View File

@ -0,0 +1,3 @@
module.exports = function(Self) {
require('../methods/item/filter.js')(Self);
};

View File

@ -0,0 +1,35 @@
{
"name": "Item",
"base": "VnModel",
"options": {
"mysql": {
"table": "item",
"database": "vn"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"size": {
"type": "Number"
},
"category": {
"type": "Number"
},
"stems": {
"type": "Number"
},
"description": {
"type": "String"
},
"isOnOffer": {
"type": "Boolean"
},
"isBargain": {
"type": "Boolean"
}
}
}

View File

@ -0,0 +1,19 @@
{
"name": "vn-item",
"version": "1.0.0",
"main": "server/server.js",
"scripts": {
"lint": "eslint .",
"start": "node .",
"posttest": "npm run lint && nsp check"
},
"repository": {
"type": "git",
"url": "https://git.verdnatura.es/salix"
},
"license": "GPL-3.0",
"description": "vn-item",
"dependencies": {
"uuid": "^3.1.0"
}
}

View File

@ -0,0 +1,3 @@
{
"port": 3007
}

View File

@ -0,0 +1,31 @@
{
"user": {
"dataSource": "salix"
},
"AccessToken": {
"dataSource": "salix",
"relations": {
"user": {
"type": "belongsTo",
"model": "user",
"foreignKey": "userId"
}
}
},
"ACL": {
"dataSource": "salix"
},
"RoleMapping": {
"dataSource": "salix"
},
"Role": {
"dataSource": "salix"
},
"Account": {
"dataSource": "salix"
},
"Item": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,4 @@
var vnLoopback = require('../../loopback/server/server.js');
var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname, module);

View File

@ -46,6 +46,9 @@ http {
location ~ ^/print(?:/(.*))?$ {
proxy_pass http://127.0.0.1:3006/$1$is_args$args;
}
location ~ ^/item(?:/(.*))?$ {
proxy_pass http://127.0.0.1:3007/$1$is_args$args;
}
# Este tiene que ser el último
location ~ ^(?:/(.*))?$ {
proxy_pass http://127.0.0.1:3001/$1$is_args$args;

View File

@ -41,6 +41,9 @@ http {
location ~ ^/print(?:/(.*))?$ {
proxy_pass http://print:3006/$1$is_args$args;
}
location ~ ^/item(?:/(.*))?$ {
proxy_pass http://item:3007/$1$is_args$args;
}
# Este tiene que ser el último
location ~ ^(?:/(.*))?$ {
proxy_pass http://salix:3001/$1$is_args$args;

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
<style type="text/css">
.st0{stroke:#000000;stroke-width:0.6335;stroke-miterlimit:10;}
.st1{fill:#FFFFFF;stroke:#000000;stroke-width:0.6335;stroke-miterlimit:10;}
.st2{fill:none;stroke:#000000;stroke-width:0.6335;stroke-miterlimit:10;}
.st3{fill:none;stroke:#000000;stroke-width:1.9005;stroke-miterlimit:10;}
</style>
<g>
<path class="st0" d="M17.4,4L5.6,10.8v13.6l11.8,6.8l11.8-6.8V10.8L17.4,4z M29,24.3L17.4,31L5.8,24.3V10.9l11.6-6.7L29,10.9V24.3z
"/>
<polygon class="st1" points="29,10.9 29,24.3 17.4,31 5.8,24.3 5.8,10.9 17.4,4.2 "/>
<path class="st2" d="M8.4,12.6"/>
<line class="st1" x1="5.8" y1="10.9" x2="17.4" y2="17.6"/>
<polygon class="st0" points="22.9,14.3 11.3,7.6 12.4,7 24,13.7 "/>
<line class="st2" x1="17.4" y1="17.6" x2="29" y2="10.9"/>
<path class="st3" d="M20,19.8"/>
<line class="st2" x1="17.4" y1="31" x2="17.4" y2="17.6"/>
<polygon class="st0" points="22.9,17.8 23.9,17.2 23.9,13.7 22.9,13.7 "/>
<g>
<path d="M7.6,18.4v4.4l0.1,0.1v-4.4L7.6,18.4z M7.9,18.3L7.9,18.3L7.9,18.3L7.9,18.3z M7.9,18.5V23L8,23L7.9,18.5L7.9,18.5z"/>
<path d="M8.4,18.8v4.4l0.2,0.1v-4.4L8.4,18.8z M8.1,18.7v4.4l0.1,0L8.1,18.7L8.1,18.7z"/>
<path d="M8.6,18.9v4.4l0.3,0.2v-4.4L8.6,18.9z M9,19.2v4.4l0.1,0L9,19.2L9,19.2z"/>
<path d="M9.2,19.3v4.4l0.1,0L9.2,19.3L9.2,19.3z M9.5,19.5v4.4L9.7,24v-4.4L9.5,19.5z"/>
<path d="M9.7,19.6V24l0.2,0.1v-4.4L9.7,19.6z M10.2,19.9v4.4l0.1,0L10.2,19.9L10.2,19.9z"/>
<path d="M10.5,20.1v4.4l0.3,0.2v-4.4L10.5,20.1z M10.3,19.9v4.4l0.1,0L10.3,19.9L10.3,19.9z"/>
<path d="M10.9,20.3v4.5l0.3,0.1v-4.5L10.9,20.3z M11.3,20.5V25l0.2,0.1v-4.4L11.3,20.5z"/>
<path d="M11.6,20.7v4.5l0.2,0.1v-4.5L11.6,20.7z M11.8,20.8v4.5l0.3,0.2V21L11.8,20.8z"/>
<path d="M12.4,21.1v4.5l0.1,0.1L12.4,21.1L12.4,21.1z M12.6,21.2v4.5l0.2,0.1v-4.5L12.6,21.2z"/>
<path d="M13,21.5v4.5l0.2,0.1v-4.5L13,21.5z M13.3,21.7v4.5l0.1,0.1L13.3,21.7L13.3,21.7z"/>
<path d="M13.7,21.9v4.5l0.2,0.1V22L13.7,21.9z M14,22.1v4.5l0.1,0.1L14,22.1L14,22.1z"/>
<path d="M14.3,22.3v4.5l0.2,0.1v-4.5L14.3,22.3z M14.8,22.5V27l0.1,0.1v-4.5L14.8,22.5z"/>
<path d="M15.1,22.7v4.5l0.2,0.1v-4.5L15.1,22.7z M15.5,22.9v4.5l0.1,0.1V23L15.5,22.9z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;stroke:#000000;stroke-width:0.6259;stroke-miterlimit:10;}
.st1{fill:none;stroke:#000000;stroke-width:0.6259;stroke-miterlimit:10;}
.st2{stroke:#000000;stroke-width:0.6259;stroke-miterlimit:10;}
.st3{fill:none;stroke:#000000;stroke-width:1.8778;stroke-miterlimit:10;}
</style>
<g>
<g>
<path d="M7.8,18.1v4.5L8,22.8v-4.5L7.8,18.1z M8.2,18.3v4.5l0.1,0L8.2,18.3L8.2,18.3z"/>
<path d="M8.4,18.5V23l0.1,0L8.4,18.5L8.4,18.5z M8.7,18.6v4.5l0.2,0.1v-4.5L8.7,18.6z"/>
<path d="M9,18.8v4.5l0.3,0.2V19L9,18.8z M9.4,19v4.5l0.1,0L9.4,19L9.4,19z"/>
<path d="M9.6,19.1v4.5l0.1,0L9.6,19.1L9.6,19.1z M9.9,19.4v4.5l0.2,0.1v-4.5L9.9,19.4z"/>
<path d="M10.2,19.5V24l0.2,0.1v-4.5L10.2,19.5z M10.7,19.8v4.5l0.1,0L10.7,19.8L10.7,19.8z"/>
<path d="M10.8,19.9v4.5l0.1,0L10.8,19.9L10.8,19.9z M11,20v4.5l0.3,0.2v-4.5L11,20z"/>
<path d="M11.5,20.2v4.5l0.3,0.1v-4.5L11.5,20.2z M11.8,20.4V25l0.2,0.1v-4.5L11.8,20.4z"/>
<path d="M12.1,20.6v4.5l0.2,0.1v-4.5L12.1,20.6z M12.4,20.7v4.5l0.3,0.1v-4.5L12.4,20.7z"/>
<path d="M12.9,21.1v4.5l0.1,0L12.9,21.1L12.9,21.1z M13.1,21.2v4.5l0.2,0.1v-4.5L13.1,21.2z"/>
<path d="M13.4,21.4v4.5l0.2,0.1v-4.5L13.4,21.4z M13.8,21.6v4.5l0.1,0L13.8,21.6L13.8,21.6z"/>
<path d="M14.1,21.8v4.5l0.2,0.1v-4.5L14.1,21.8z M14.4,21.9v4.5l0.1,0L14.4,21.9L14.4,21.9z"/>
<path d="M14.7,22.1v4.5l0.2,0.1v-4.5L14.7,22.1z M15,22.3v4.5l0.1,0L15,22.3L15,22.3z"/>
<path d="M15.3,22.4V27l0.2,0.1v-4.5L15.3,22.4z M15.6,22.7v4.5l0.1,0L15.6,22.7L15.6,22.7z"/>
</g>
<path class="st0" d="M17.5,4L5.8,10.8v13.5L17.5,31l11.7-6.7V10.8L17.5,4z M29,24.1l-11.5,6.6L6,24.1V10.9l11.5-6.6L29,10.9V24.1z"
/>
<path class="st1" d="M8.7,12.5"/>
<line class="st0" x1="6" y1="10.9" x2="17.5" y2="17.5"/>
<polygon class="st2" points="23,14.3 11.5,7.6 12.6,7 24.1,13.6 "/>
<line class="st1" x1="17.5" y1="17.5" x2="28.9" y2="10.9"/>
<path class="st3" d="M20.1,19.7"/>
<line class="st1" x1="17.5" y1="30.7" x2="17.5" y2="17.5"/>
<polygon class="st2" points="22.9,17.7 23.9,17.1 23.9,13.6 22.9,13.6 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB