Coverage for opt/mealie/lib/python3.12/site-packages/mealie/db/models/server/task.py: 87%

21 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-11-25 15:48 +0000

1from datetime import datetime 1a

2from typing import TYPE_CHECKING 1a

3 

4from sqlalchemy import ForeignKey, String, orm 1a

5from sqlalchemy.orm import Mapped, mapped_column 1a

6 

7from mealie.db.models._model_base import BaseMixins, SqlAlchemyBase 1a

8from mealie.db.models._model_utils.datetime import NaiveDateTime 1a

9from mealie.db.models._model_utils.guid import GUID 1a

10 

11from .._model_utils.auto_init import auto_init 1a

12 

13if TYPE_CHECKING: 13 ↛ 14line 13 didn't jump to line 14 because the condition on line 13 was never true1a

14 from ..group import Group 

15 

16 

17class ServerTaskModel(SqlAlchemyBase, BaseMixins): 1a

18 # Server Tasks are deprecated, but the table still exists in the database 

19 

20 __tablename__ = "server_tasks" 1a

21 name: Mapped[str] = mapped_column(String, nullable=False) 1a

22 completed_date: Mapped[datetime] = mapped_column(NaiveDateTime, nullable=True) 1a

23 status: Mapped[str] = mapped_column(String, nullable=False) 1a

24 log: Mapped[str] = mapped_column(String, nullable=True) 1a

25 

26 group_id: Mapped[GUID] = mapped_column(GUID, ForeignKey("groups.id"), nullable=False, index=True) 1a

27 group: Mapped["Group"] = orm.relationship("Group", back_populates="server_tasks") 1a

28 

29 @auto_init() 1a

30 def __init__(self, **_) -> None: 1a

31 pass