feat: refs #7874 validate required field
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-09-26 17:20:50 +02:00
parent 20e894257d
commit f3bf0b7432
2 changed files with 9 additions and 5 deletions

View File

@ -379,5 +379,6 @@
"The entry does not have stickers": "La entrada no tiene etiquetas", "The entry does not have stickers": "La entrada no tiene etiquetas",
"Too many records": "Demasiados registros", "Too many records": "Demasiados registros",
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
"No valid travel thermograph found": "No se encontró un termógrafo válido" "No valid travel thermograph found": "No se encontró un termógrafo válido",
} "type cannot be blank": "Se debe rellenar el tipo"
}

View File

@ -1,8 +1,11 @@
module.exports = function(Self) { module.exports = function(Self) {
Self.validate('text', isEnabled, {message: 'Description cannot be blank'}); Self.validate('text', function(err) {
function isEnabled(err) {
if (!this.text) err(); if (!this.text) err();
} }, {message: 'Description cannot be blank'});
Self.validate('observationTypeFk', function(err) {
if (!this.observationTypeFk) err();
}, {message: 'type cannot be blank'});
Self.observe('before save', function(ctx, next) { Self.observe('before save', function(ctx, next) {
ctx.instance.created = Date(); ctx.instance.created = Date();