put the forze of validation in the schemas
This commit is contained in:
parent
d6bee33601
commit
5e8cf78751
|
@ -1,7 +1,7 @@
|
|||
"""add vendor family in device
|
||||
|
||||
Revision ID: 564952310b17
|
||||
Revises: d65745749e34
|
||||
Revises: af038a8a388c
|
||||
Create Date: 2022-11-14 13:12:22.916848
|
||||
|
||||
"""
|
||||
|
@ -11,7 +11,7 @@ from alembic import context, op
|
|||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '564952310b17'
|
||||
down_revision = 'd65745749e34'
|
||||
down_revision = 'af038a8a388c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ from uuid import UUID
|
|||
|
||||
from flask import current_app as app
|
||||
from flask import g
|
||||
from marshmallow import ValidationError
|
||||
from sqlalchemy.util import OrderedSet
|
||||
|
||||
from ereuse_devicehub.db import db
|
||||
|
@ -118,10 +117,6 @@ class SnapshotMixin:
|
|||
|
||||
snapshot.device.set_hid()
|
||||
snapshot.device.binding.device.set_hid()
|
||||
if not snapshot.device.hid:
|
||||
txt = "Not exist the basic fields for to do an device. "
|
||||
txt += "Please do one placeholder instead of one snapshot"
|
||||
raise ValidationError(txt)
|
||||
|
||||
return snapshot
|
||||
|
||||
|
|
|
@ -213,9 +213,9 @@ class Computer(Device):
|
|||
"""Validates than exist model manufacturer and system_uuid."""
|
||||
|
||||
minimum = [
|
||||
data['manufacturer'],
|
||||
data['model'],
|
||||
data['system_uuid'],
|
||||
data.get('manufacturer'),
|
||||
data.get('model'),
|
||||
data.get('system_uuid'),
|
||||
]
|
||||
|
||||
if not all(minimum):
|
||||
|
|
Reference in New Issue