feat: highlight expired date and datetime attributes
This commit is contained in:
@@ -47,6 +47,11 @@ class Attribute(BaseModel):
|
||||
server_default='0',
|
||||
comment='Отображается ли атрибут на дашборде',
|
||||
)
|
||||
is_highlight_if_expired: Mapped[bool] = mapped_column(
|
||||
default=False,
|
||||
server_default='0',
|
||||
comment='Подсветка атрибута, если Дата/ДатаВремя просрочена',
|
||||
)
|
||||
is_nullable: Mapped[bool] = mapped_column(default=False, nullable=False)
|
||||
default_value: Mapped[bytes] = mapped_column(nullable=True)
|
||||
is_deleted: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
@@ -21,6 +21,7 @@ class BaseAttributeSchema(BaseSchema):
|
||||
name: str
|
||||
is_applicable_to_group: bool
|
||||
is_shown_on_dashboard: bool
|
||||
is_highlight_if_expired: bool
|
||||
is_nullable: bool
|
||||
default_value: Optional[bool | int | float | str | date | datetime]
|
||||
type_id: int
|
||||
|
||||
@@ -61,7 +61,7 @@ class AttributeService(BaseService):
|
||||
if attribute.name != request.attribute.name:
|
||||
attr_with_same_name = await self.get_attr_by_name(request.attribute.name)
|
||||
if attr_with_same_name:
|
||||
return CreateAttributeResponse(ok=False, message="Атрибут с данным уникальным ключом уже существует")
|
||||
return UpdateAttributeResponse(ok=False, message="Атрибут с данным уникальным ключом уже существует")
|
||||
|
||||
default_value = pickle.dumps(request.attribute.default_value) if request.attribute.default_value else None
|
||||
|
||||
@@ -70,6 +70,7 @@ class AttributeService(BaseService):
|
||||
attribute.default_value = default_value
|
||||
attribute.is_applicable_to_group = request.attribute.is_applicable_to_group
|
||||
attribute.is_shown_on_dashboard = request.attribute.is_shown_on_dashboard
|
||||
attribute.is_highlight_if_expired = request.attribute.is_highlight_if_expired
|
||||
attribute.is_nullable = request.attribute.is_nullable
|
||||
attribute.description = request.attribute.description
|
||||
await self.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user