Skip to content
Snippets Groups Projects
Commit e65cdb34 authored by Karen Bjørndalen's avatar Karen Bjørndalen
Browse files

Make Parameter.status, Parameter.valid_from, Parameter.valid_to and Parameter.description optional

Also a little tidying
parent a09a31b2
No related branches found
No related tags found
1 merge request!16Bugfix/optional fields in models.Parameter
"""Models used by the client"""
import datetime
import json
import typing
from enum import Enum
from typing import Optional, TypeVar, List
from typing import Optional, List
import pydantic
......@@ -69,7 +68,7 @@ class Voucher(BaseModel):
voucherdate: datetime.datetime
exref: Optional[str]
voucherno: int
transactions: typing.List[Transaction]
transactions: List[Transaction]
class Batch(BaseModel):
......@@ -79,11 +78,11 @@ class Batch(BaseModel):
"""
client: str
batchid: str
period: typing.Optional[str]
period: Optional[str]
interface: str
vouchertype: typing.Optional[str]
batch_progress: typing.Optional[str]
vouchers: typing.Optional[typing.List[Voucher]]
vouchertype: Optional[str]
batch_progress: Optional[str]
vouchers: Optional[List[Voucher]]
class ErrorTransaction(BaseModel):
......@@ -114,9 +113,9 @@ class ErrorBatch(BaseModel):
class BatchErrors(BaseModel):
"""Model for the /batch_error/<id> endpoint"""
batch_errors: typing.List[ErrorBatch]
voucher_errors: typing.List[ErrorVoucher]
transaction_errors: typing.List[ErrorTransaction]
batch_errors: List[ErrorBatch]
voucher_errors: List[ErrorVoucher]
transaction_errors: List[ErrorTransaction]
class CompleteTransaction(BaseModel):
......@@ -152,7 +151,7 @@ class CompleteVoucher(BaseModel):
voucherno_ubw: Optional[int]
voucherno_ubw_wflow: Optional[int]
vouchertype: Optional[str]
transactions: typing.List[CompleteTransaction]
transactions: List[CompleteTransaction]
class CompleteBatch(BaseModel):
......@@ -176,7 +175,7 @@ class CompleteBatch(BaseModel):
getresult_logg: Optional[str]
getresult_report: Optional[str]
batch_progress: str
vouchers: typing.List[CompleteVoucher]
vouchers: List[CompleteVoucher]
class Parameter(BaseModel):
......@@ -187,7 +186,7 @@ class Parameter(BaseModel):
mandatory: str
validation: str
value: str
status: str
valid_from: datetime.date
valid_to: datetime.date
description: str
status: Optional[str]
valid_from: Optional[datetime.date]
valid_to: Optional[datetime.date]
description: Optional[str]
......@@ -20,10 +20,10 @@
"mandatory": "j",
"validation": "j",
"value": "wat",
"status": "anerikke",
"valid_from": "2020-01-01",
"valid_to": "2020-01-01",
"description": "Min parameter b"
"status": null,
"valid_from": null,
"valid_to": null,
"description": null
},
{
"client": "72",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment