class FulfilmentSchema(BaseSchema): person = ExistingPersonValidator() type = FulfilmentTypeValidator(not_empty=True) status = FulfilmentStatusValidator(not_empty=True) chained_validators = [ FulfilmentTypeStatusValidator(type='type', status='status') ]
class RegoRoomSchema(BaseSchema): rego = ExistingRegistrationValidator(not_empty=True) room = validators.String(not_empty=True) by = ExistingPersonValidator(not_empty=True)
class VoucherSchema(BaseSchema): count = validators.Int(min=1, max=100) leader = ExistingPersonValidator(not_empty=True) code = validators.String() comment = validators.String(not_empty=True)
class FulfilmentGroupSchema(BaseSchema): person = ExistingPersonValidator(not_empty=False) code = validators.String(not_empty=True)
class InvoiceSchema(BaseSchema): person = ExistingPersonValidator(not_empty=True) due_date = validators.DateConverter(month_style='dd/mm/yyyy') items = ForEach(InvoiceItemValidator()) item_count = validators.Int(min=0) # no max, doesn't hit database
class RegoNoteSchema(BaseSchema): rego = ExistingRegistrationValidator(not_empty=True) note = validators.String(not_empty=True) block = validators.Bool(if_empty=False) by = ExistingPersonValidator(not_empty=True)