~homeworkprod/byceps

ref: 4237b3ec9496efe95dcce82bea3207ab9de4d520 byceps/byceps/events/board.py -rw-r--r-- 2.4 KiB
4237b3ec — Jochen Kupperschmidt Move ticketing blueprint into `site` subpackage 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
"""
byceps.events.board
~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from dataclasses import dataclass
from typing import Optional

from ..services.board.transfer.models import CategoryID, PostingID, TopicID
from ..typing import UserID

from .base import _BaseEvent


# topic


@dataclass(frozen=True)
class _BoardTopicEvent(_BaseEvent):
    topic_id: TopicID
    topic_creator_id: UserID
    topic_creator_screen_name: Optional[str]
    topic_title: str
    url: str


@dataclass(frozen=True)
class _BoardTopicModerationEvent(_BoardTopicEvent):
    moderator_id: UserID
    moderator_screen_name: Optional[str]


@dataclass(frozen=True)
class BoardTopicCreated(_BoardTopicEvent):
    pass


@dataclass(frozen=True)
class BoardTopicUpdated(_BoardTopicEvent):
    editor_id: UserID
    editor_screen_name: Optional[str]


@dataclass(frozen=True)
class BoardTopicHidden(_BoardTopicModerationEvent):
    pass


@dataclass(frozen=True)
class BoardTopicUnhidden(_BoardTopicModerationEvent):
    pass


@dataclass(frozen=True)
class BoardTopicLocked(_BoardTopicModerationEvent):
    pass


@dataclass(frozen=True)
class BoardTopicUnlocked(_BoardTopicModerationEvent):
    pass


@dataclass(frozen=True)
class BoardTopicPinned(_BoardTopicModerationEvent):
    pass


@dataclass(frozen=True)
class BoardTopicUnpinned(_BoardTopicModerationEvent):
    pass


@dataclass(frozen=True)
class BoardTopicMoved(_BoardTopicModerationEvent):
    old_category_id: CategoryID
    old_category_title: str
    new_category_id: CategoryID
    new_category_title: str


# posting


@dataclass(frozen=True)
class _BoardPostingEvent(_BaseEvent):
    posting_id: PostingID
    posting_creator_id: UserID
    posting_creator_screen_name: Optional[str]
    topic_id: TopicID
    topic_title: str
    url: str


@dataclass(frozen=True)
class _BoardPostingModerationEvent(_BoardPostingEvent):
    moderator_id: UserID
    moderator_screen_name: Optional[str]


@dataclass(frozen=True)
class BoardPostingCreated(_BoardPostingEvent):
    topic_muted: bool


@dataclass(frozen=True)
class BoardPostingUpdated(_BoardPostingEvent):
    editor_id: UserID
    editor_screen_name: Optional[str]


@dataclass(frozen=True)
class BoardPostingHidden(_BoardPostingModerationEvent):
    pass


@dataclass(frozen=True)
class BoardPostingUnhidden(_BoardPostingModerationEvent):
    pass