add schema_version

This commit is contained in:
Cayo Puigdefabregas 2022-04-08 11:10:03 +02:00
parent cd6e079aee
commit 545a1013e9
2 changed files with 34 additions and 27 deletions

View File

@ -1,26 +1,35 @@
from distutils.version import StrictVersion from distutils.version import StrictVersion
from itertools import chain from itertools import chain
from typing import Set from typing import Set
from decouple import config
from decouple import config
from teal.auth import TokenAuth from teal.auth import TokenAuth
from teal.config import Config from teal.config import Config
from teal.enums import Currency from teal.enums import Currency
from teal.utils import import_resource from teal.utils import import_resource
from ereuse_devicehub.resources import action, agent, deliverynote, inventory, \ from ereuse_devicehub.resources import (
lot, tag, user action,
agent,
deliverynote,
inventory,
lot,
tag,
user,
)
from ereuse_devicehub.resources.device import definitions from ereuse_devicehub.resources.device import definitions
from ereuse_devicehub.resources.documents import documents from ereuse_devicehub.resources.documents import documents
from ereuse_devicehub.resources.tradedocument import definitions as tradedocument
from ereuse_devicehub.resources.enums import PriceSoftware from ereuse_devicehub.resources.enums import PriceSoftware
from ereuse_devicehub.resources.versions import versions
from ereuse_devicehub.resources.licences import licences from ereuse_devicehub.resources.licences import licences
from ereuse_devicehub.resources.metric import definitions as metric_def from ereuse_devicehub.resources.metric import definitions as metric_def
from ereuse_devicehub.resources.tradedocument import definitions as tradedocument
from ereuse_devicehub.resources.versions import versions
class DevicehubConfig(Config): class DevicehubConfig(Config):
RESOURCE_DEFINITIONS = set(chain(import_resource(definitions), RESOURCE_DEFINITIONS = set(
chain(
import_resource(definitions),
import_resource(action), import_resource(action),
import_resource(user), import_resource(user),
import_resource(tag), import_resource(tag),
@ -33,7 +42,8 @@ class DevicehubConfig(Config):
import_resource(versions), import_resource(versions),
import_resource(licences), import_resource(licences),
import_resource(metric_def), import_resource(metric_def),
),) ),
)
PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str] PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str]
SECRET_KEY = config('SECRET_KEY') SECRET_KEY = config('SECRET_KEY')
DB_USER = config('DB_USER', 'dhub') DB_USER = config('DB_USER', 'dhub')
@ -53,7 +63,7 @@ class DevicehubConfig(Config):
"""The minimum version of ereuse.org workbench that this devicehub """The minimum version of ereuse.org workbench that this devicehub
accepts. we recommend not changing this value. accepts. we recommend not changing this value.
""" """
WORKBENCH_LITE = ["2022.03.00"] WORKBENCH_LITE = ["V1"]
TMP_SNAPSHOTS = config('TMP_SNAPSHOTS', '/tmp/snapshots') TMP_SNAPSHOTS = config('TMP_SNAPSHOTS', '/tmp/snapshots')
TMP_LIVES = config('TMP_LIVES', '/tmp/lives') TMP_LIVES = config('TMP_LIVES', '/tmp/lives')
@ -61,11 +71,7 @@ class DevicehubConfig(Config):
"""This var is for save a snapshots in json format when fail something""" """This var is for save a snapshots in json format when fail something"""
API_DOC_CONFIG_TITLE = 'Devicehub' API_DOC_CONFIG_TITLE = 'Devicehub'
API_DOC_CONFIG_VERSION = '0.2' API_DOC_CONFIG_VERSION = '0.2'
API_DOC_CONFIG_COMPONENTS = { API_DOC_CONFIG_COMPONENTS = {'securitySchemes': {'bearerAuth': TokenAuth.API_DOCS}}
'securitySchemes': {
'bearerAuth': TokenAuth.API_DOCS
}
}
API_DOC_CLASS_DISCRIMINATOR = 'type' API_DOC_CLASS_DISCRIMINATOR = 'type'
PRICE_SOFTWARE = PriceSoftware.Ereuse PRICE_SOFTWARE = PriceSoftware.Ereuse

View File

@ -1,10 +1,11 @@
{ {
"timestamp": "2022-03-31T19:09:57.167164", "timestamp": "2022-03-31T19:09:57.167164",
"type": "Snapshot", "type": "Snapshot",
"uuid": "cdecaf47-6e32-4ccb-b689-95c064d8c513", "uuid": "cdecaf47-6e32-4ccb-b689-95c064d8c514",
"wbid": "MLKO1Y0R55XZM051WQ5KJM01RY44Q", "wbid": "MLKO1Y0R55XZM051WQ5KJM01RY44Q",
"software": "Workbench", "software": "Workbench",
"version": "2022.03.00", "version": "2022.03.00",
"schema_version": "V1",
"data": { "data": {
"lshw": { "lshw": {
"id": "__", "id": "__",