Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6276-createNewWarehouse
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
6ee7ca79b7
|
@ -1,10 +1,11 @@
|
||||||
|
const SalixError = require('../../util/salixError');
|
||||||
const UserError = require('../../util/user-error');
|
const UserError = require('../../util/user-error');
|
||||||
const logToConsole = require('strong-error-handler/lib/logger');
|
const logToConsole = require('strong-error-handler/lib/logger');
|
||||||
|
|
||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
return function(err, req, res, next) {
|
return function(err, req, res, next) {
|
||||||
// Thrown user errors
|
// Thrown user errors
|
||||||
if (err instanceof UserError) {
|
if (err instanceof SalixError) {
|
||||||
err.message = req.__(err.message, ...err.translateArgs);
|
err.message = req.__(err.message, ...err.translateArgs);
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +14,7 @@ module.exports = function() {
|
||||||
if (err.statusCode == 422) {
|
if (err.statusCode == 422) {
|
||||||
try {
|
try {
|
||||||
let code;
|
let code;
|
||||||
let messages = err.details.messages;
|
let {messages} = err.details;
|
||||||
for (code in messages) break;
|
for (code in messages) break;
|
||||||
err.message = req.__(messages[code][0]);
|
err.message = req.__(messages[code][0]);
|
||||||
return next(err);
|
return next(err);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
module.exports = class ForbiddenError extends Error {
|
const SalixError = require('./salixError');
|
||||||
|
module.exports = class ForbiddenError extends SalixError {
|
||||||
constructor(message, code, ...translateArgs) {
|
constructor(message, code, ...translateArgs) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = 'ForbiddenError';
|
this.name = ForbiddenError.name;
|
||||||
this.statusCode = 403;
|
this.statusCode = 403;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.translateArgs = translateArgs;
|
this.translateArgs = translateArgs;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = class SalixError extends Error {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
};
|
|
@ -4,10 +4,11 @@
|
||||||
* the final user, so they cannot contain sensitive data and must
|
* the final user, so they cannot contain sensitive data and must
|
||||||
* be understandable by people who do not have a technical profile.
|
* be understandable by people who do not have a technical profile.
|
||||||
*/
|
*/
|
||||||
module.exports = class UserError extends Error {
|
const SalixError = require('./salixError');
|
||||||
|
module.exports = class UserError extends SalixError {
|
||||||
constructor(message, code, ...translateArgs) {
|
constructor(message, code, ...translateArgs) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = 'UserError';
|
this.name = UserError.name;
|
||||||
this.statusCode = 400;
|
this.statusCode = 400;
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.translateArgs = translateArgs;
|
this.translateArgs = translateArgs;
|
||||||
|
|
|
@ -42,14 +42,15 @@
|
||||||
translate-attr="{title: 'Set as default'}">
|
translate-attr="{title: 'Set as default'}">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</vn-none>
|
</vn-none>
|
||||||
<vn-one
|
<vn-one
|
||||||
style="overflow: hidden; min-width: 14em;">
|
style="overflow: hidden; min-width: 14em;">
|
||||||
<div class="ellipsize"><b>{{::address.nickname}} - #{{::address.id}}</b></div>
|
<div class="ellipsize"><b>{{::address.nickname}} - #{{::address.id}}</b></div>
|
||||||
<div class="ellipsize" name="street">{{::address.street}}</div>
|
<div class="ellipsize" name="street">{{::address.street}}</div>
|
||||||
<div class="ellipsize">
|
<div class="ellipsize">
|
||||||
<span ng-show="::address.postalCode">{{::address.postalCode}} -</span>
|
<span ng-show="::address.postalCode">{{::address.postalCode}} -</span>
|
||||||
<span ng-show="::address.city">{{::address.city}},</span>
|
<span ng-show="::address.city">{{::address.city}},</span>
|
||||||
{{::address.province.name}}
|
<span ng-show="::address.province.name">{{::address.province.name}},</span>
|
||||||
|
{{::address.province.country.country}}
|
||||||
</div>
|
</div>
|
||||||
<div class="ellipsize">
|
<div class="ellipsize">
|
||||||
{{::address.phone}}<span ng-if="::address.mobile">, </span>
|
{{::address.phone}}<span ng-if="::address.mobile">, </span>
|
||||||
|
@ -72,7 +73,7 @@
|
||||||
class="vn-hide-narrow vn-px-md border-solid-left"
|
class="vn-hide-narrow vn-px-md border-solid-left"
|
||||||
style="height: 6em; overflow: auto;">
|
style="height: 6em; overflow: auto;">
|
||||||
<vn-one ng-repeat="observation in address.observations track by $index" ng-class="{'vn-pt-sm': $index}">
|
<vn-one ng-repeat="observation in address.observations track by $index" ng-class="{'vn-pt-sm': $index}">
|
||||||
<b>{{::observation.observationType.description}}:</b>
|
<b>{{::observation.observationType.description}}:</b>
|
||||||
<span>{{::observation.description}}</span>
|
<span>{{::observation.description}}</span>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -33,7 +33,13 @@ class Controller extends Section {
|
||||||
}, {
|
}, {
|
||||||
relation: 'province',
|
relation: 'province',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name']
|
fields: ['id', 'name', 'countryFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'country',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'country']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue