/
models.py
61 lines (44 loc) · 1.1 KB
/
models.py
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
"""
byceps.services.news.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from dataclasses import dataclass
from datetime import datetime
from typing import List, NewType, Optional
from uuid import UUID
from ....typing import BrandID, UserID
ChannelID = NewType('ChannelID', str)
ItemID = NewType('ItemID', UUID)
ItemVersionID = NewType('ItemVersionID', UUID)
ImageID = NewType('ImageID', UUID)
@dataclass(frozen=True)
class Channel:
id: ChannelID
brand_id: BrandID
url_prefix: str
@dataclass(frozen=True)
class Image:
id: ImageID
created_at: datetime
creator_id: UserID
item_id: ItemID
number: int
filename: str
url_path: str
alt_text: Optional[str]
caption: Optional[str]
attribution: Optional[str]
@dataclass(frozen=True)
class Item:
id: ItemID
channel: Channel
slug: str
published_at: Optional[datetime]
published: bool
title: str
body: str
external_url: str
image_url_path: Optional[str]
images: List[Image]