2023-07-26 15:31:20 +00:00
|
|
|
from enum import auto
|
2023-07-26 15:39:41 +00:00
|
|
|
from typing import Sequence
|
2023-07-26 15:31:20 +00:00
|
|
|
|
2020-06-01 10:00:35 +00:00
|
|
|
from jsonmodels import fields, models
|
2023-07-26 15:31:20 +00:00
|
|
|
from jsonmodels.validators import Length
|
2020-06-01 10:00:35 +00:00
|
|
|
|
2023-07-26 15:39:41 +00:00
|
|
|
from apiserver.apimodels import DictField, ActualEnumField, ScalarField
|
2023-07-26 15:31:20 +00:00
|
|
|
from apiserver.utilities.stringenum import StringEnum
|
2022-07-08 14:32:56 +00:00
|
|
|
|
2020-06-01 10:00:35 +00:00
|
|
|
|
|
|
|
class Filter(models.Base):
|
2020-06-21 20:54:05 +00:00
|
|
|
tags = fields.ListField([str])
|
2020-06-01 10:00:35 +00:00
|
|
|
system_tags = fields.ListField([str])
|
|
|
|
|
|
|
|
|
|
|
|
class TagsRequest(models.Base):
|
|
|
|
include_system = fields.BoolField(default=False)
|
|
|
|
filter = fields.EmbeddedField(Filter)
|
2022-07-08 14:32:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EntitiesCountRequest(models.Base):
|
|
|
|
projects = DictField()
|
|
|
|
tasks = DictField()
|
|
|
|
models = DictField()
|
|
|
|
pipelines = DictField()
|
2022-07-08 14:45:03 +00:00
|
|
|
datasets = DictField()
|
2022-12-21 16:32:56 +00:00
|
|
|
reports = DictField()
|
2022-11-29 15:44:19 +00:00
|
|
|
active_users = fields.ListField(str)
|
|
|
|
search_hidden = fields.BoolField(default=False)
|
2022-12-21 16:32:56 +00:00
|
|
|
allow_public = fields.BoolField(default=True)
|
2023-07-26 15:31:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EntityType(StringEnum):
|
|
|
|
task = auto()
|
|
|
|
model = auto()
|
|
|
|
|
|
|
|
|
2023-07-26 15:39:41 +00:00
|
|
|
class ValueMapping(models.Base):
|
|
|
|
key = ScalarField(nullable=True)
|
|
|
|
value = ScalarField(nullable=True)
|
|
|
|
|
|
|
|
|
|
|
|
class FieldMapping(models.Base):
|
|
|
|
field = fields.StringField(required=True)
|
|
|
|
name = fields.StringField()
|
|
|
|
values: Sequence[ValueMapping] = fields.ListField(items_types=[ValueMapping])
|
|
|
|
|
|
|
|
|
|
|
|
class PrepareDownloadForGetAllRequest(models.Base):
|
2023-07-26 15:31:20 +00:00
|
|
|
entity_type = ActualEnumField(EntityType)
|
|
|
|
allow_public = fields.BoolField(default=True)
|
|
|
|
search_hidden = fields.BoolField(default=False)
|
|
|
|
only_fields = fields.ListField(
|
|
|
|
items_types=[str], validators=[Length(1)], required=True
|
|
|
|
)
|
2023-07-26 15:39:41 +00:00
|
|
|
field_mappings: Sequence[FieldMapping] = fields.ListField(
|
|
|
|
items_types=[FieldMapping], validators=[Length(1)], required=True
|
|
|
|
)
|
2023-07-26 15:31:20 +00:00
|
|
|
|
|
|
|
|
2023-07-26 15:39:41 +00:00
|
|
|
class DownloadForGetAllRequest(models.Base):
|
2023-07-26 15:31:20 +00:00
|
|
|
prepare_id = fields.StringField(required=True)
|