mirror of
https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
synced 2024-12-27 16:08:55 +00:00
implemented deserializer
This commit is contained in:
parent
21d6e48bcc
commit
b9dad7f87c
21
app/orm.py
21
app/orm.py
@ -32,6 +32,16 @@ class Origin(Base):
|
||||
'os_version': self.os_version,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def deserialize(j) -> "Origin":
|
||||
return Origin(
|
||||
origin_ref=j.get('origin_ref'),
|
||||
hostname=j.get('hostname'),
|
||||
guest_driver_version=j.get('guest_driver_version'),
|
||||
os_platform=j.get('os_platform'),
|
||||
os_version=j.get('os_version'),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def create_statement(engine: Engine):
|
||||
from sqlalchemy.schema import CreateTable
|
||||
@ -95,6 +105,17 @@ class Lease(Base):
|
||||
'lease_renewal': lease_renewal.isoformat(),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def deserialize(j) -> "Lease":
|
||||
return Lease(
|
||||
lease_ref=j.get('lease_ref'),
|
||||
origin_ref=j.get('origin_ref'),
|
||||
lease_created=j.get('lease_created'),
|
||||
lease_expires=j.get('lease_expires'),
|
||||
lease_updated=j.get('lease_updated'),
|
||||
lease_renewal=j.get('lease_renewal'),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def create_statement(engine: Engine):
|
||||
from sqlalchemy.schema import CreateTable
|
||||
|
Loading…
Reference in New Issue
Block a user