Skip to content

Commit

Permalink
Improve resource visibility customization
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Jan 9, 2024
1 parent 45610e3 commit ce6f74e
Show file tree
Hide file tree
Showing 18 changed files with 299 additions and 347 deletions.
192 changes: 66 additions & 126 deletions Tekst-API/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4327,6 +4327,33 @@
},
"DebugResourceConfig": {
"properties": {
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"defaultActive": {
"type": "boolean",
"title": "Defaultactive",
"description": "Whether this resource is active by default when public",
"default": true
},
"showOnParentLevel": {
"type": "boolean",
"title": "Showonparentlevel",
Expand Down Expand Up @@ -4385,20 +4412,6 @@
"title": "Ownerid",
"description": "User owning this resource"
},
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sharedRead": {
"items": {
"type": "string",
Expand All @@ -4421,13 +4434,6 @@
"description": "Users with shared write access to this resource",
"default": []
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"public": {
"type": "boolean",
"title": "Public",
Expand Down Expand Up @@ -4482,6 +4488,8 @@
}
],
"default": {
"sortOrder": 100,
"defaultActive": true,
"showOnParentLevel": false
}
}
Expand Down Expand Up @@ -4601,20 +4609,6 @@
"title": "Ownerid",
"description": "User owning this resource"
},
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sharedRead": {
"items": {
"type": "string",
Expand All @@ -4637,13 +4631,6 @@
"description": "Users with shared write access to this resource",
"default": []
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"public": {
"type": "boolean",
"title": "Public",
Expand Down Expand Up @@ -4698,6 +4685,8 @@
}
],
"default": {
"sortOrder": 100,
"defaultActive": true,
"showOnParentLevel": false
}
}
Expand Down Expand Up @@ -4779,20 +4768,6 @@
"title": "Ownerid",
"description": "User owning this resource"
},
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sharedRead": {
"items": {
"type": "string",
Expand All @@ -4815,13 +4790,6 @@
"description": "Users with shared write access to this resource",
"default": []
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"public": {
"type": "boolean",
"title": "Public",
Expand Down Expand Up @@ -4876,6 +4844,8 @@
}
],
"default": {
"sortOrder": 100,
"defaultActive": true,
"showOnParentLevel": false
}
}
Expand Down Expand Up @@ -5452,6 +5422,33 @@
},
"PlaintextResourceConfig": {
"properties": {
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"defaultActive": {
"type": "boolean",
"title": "Defaultactive",
"description": "Whether this resource is active by default when public",
"default": true
},
"showOnParentLevel": {
"type": "boolean",
"title": "Showonparentlevel",
Expand Down Expand Up @@ -5525,20 +5522,6 @@
"title": "Ownerid",
"description": "User owning this resource"
},
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sharedRead": {
"items": {
"type": "string",
Expand All @@ -5561,13 +5544,6 @@
"description": "Users with shared write access to this resource",
"default": []
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"public": {
"type": "boolean",
"title": "Public",
Expand Down Expand Up @@ -5622,6 +5598,8 @@
}
],
"default": {
"sortOrder": 100,
"defaultActive": true,
"showOnParentLevel": false,
"deeplLinks": {
"enabled": false,
Expand Down Expand Up @@ -5749,20 +5727,6 @@
"title": "Ownerid",
"description": "User owning this resource"
},
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sharedRead": {
"items": {
"type": "string",
Expand All @@ -5785,13 +5749,6 @@
"description": "Users with shared write access to this resource",
"default": []
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"public": {
"type": "boolean",
"title": "Public",
Expand Down Expand Up @@ -5846,6 +5803,8 @@
}
],
"default": {
"sortOrder": 100,
"defaultActive": true,
"showOnParentLevel": false,
"deeplLinks": {
"enabled": false,
Expand Down Expand Up @@ -5935,20 +5894,6 @@
"title": "Ownerid",
"description": "User owning this resource"
},
"category": {
"anyOf": [
{
"type": "string",
"maxLength": 16,
"minLength": 1
},
{
"type": "null"
}
],
"title": "Category",
"description": "Resource category key"
},
"sharedRead": {
"items": {
"type": "string",
Expand All @@ -5971,13 +5916,6 @@
"description": "Users with shared write access to this resource",
"default": []
},
"sortOrder": {
"type": "integer",
"minimum": 0.0,
"title": "Sortorder",
"description": "Sort order for displaying this resource among others",
"default": 100
},
"public": {
"type": "boolean",
"title": "Public",
Expand Down Expand Up @@ -6032,6 +5970,8 @@
}
],
"default": {
"sortOrder": 100,
"defaultActive": true,
"showOnParentLevel": false,
"deeplLinks": {
"enabled": false,
Expand Down
9 changes: 0 additions & 9 deletions Tekst-API/tekst/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,3 @@ def update_model(cls, bases: type | tuple[type] = ()) -> type[ModelBase]:
**fields,
)
return cls._update_model


class ResourceConfigBase(ModelBase):
show_on_parent_level: Annotated[
bool,
Field(
description="Show combined contents of this resource on the parent level"
),
] = False
11 changes: 1 addition & 10 deletions Tekst-API/tekst/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
Metadata,
ModelBase,
ModelFactoryMixin,
ResourceConfigBase,
TranslationBase,
Translations,
)
from tekst.models.resource_configs import ResourceConfigBase
from tekst.models.text import TextDocument
from tekst.models.user import UserRead, UserReadPublic

Expand Down Expand Up @@ -64,11 +64,6 @@ class ResourceBase(ModelBase, ModelFactoryMixin):
owner_id: Annotated[
PydanticObjectId | None, Field(description="User owning this resource")
] = None
category: Annotated[
str | None,
StringConstraints(min_length=1, max_length=16, strip_whitespace=True),
Field(description="Resource category key"),
] = None
shared_read: Annotated[
list[PydanticObjectId],
Field(
Expand All @@ -81,10 +76,6 @@ class ResourceBase(ModelBase, ModelFactoryMixin):
description="Users with shared write access to this resource", max_length=64
),
] = []
sort_order: Annotated[
int,
Field(description="Sort order for displaying this resource among others", ge=0),
] = 100
public: Annotated[
bool, Field(description="Publication status of this resource")
] = False
Expand Down
Loading

0 comments on commit ce6f74e

Please sign in to comment.