45 lines
1013 B
Python
45 lines
1013 B
Python
from datetime import datetime
|
|
from typing import Self
|
|
|
|
from cpl.core.typing import SerialId
|
|
from cpl.database.abc import DbModelABC
|
|
|
|
|
|
class Post(DbModelABC[Self]):
|
|
|
|
def __init__(
|
|
self,
|
|
id: int,
|
|
author_id: SerialId,
|
|
title: str,
|
|
content: str,
|
|
deleted: bool = False,
|
|
editor_id: SerialId | None = None,
|
|
created: datetime | None = None,
|
|
updated: datetime | None = None,
|
|
):
|
|
DbModelABC.__init__(self, id, deleted, editor_id, created, updated)
|
|
self._author_id = author_id
|
|
self._title = title
|
|
self._content = content
|
|
|
|
@property
|
|
def author_id(self) -> SerialId:
|
|
return self._author_id
|
|
|
|
@property
|
|
def title(self) -> str:
|
|
return self._title
|
|
|
|
@title.setter
|
|
def title(self, value: str):
|
|
self._title = value
|
|
|
|
@property
|
|
def content(self) -> str:
|
|
return self._content
|
|
|
|
@content.setter
|
|
def content(self, value: str):
|
|
self._content = value
|