forked from Netflix/dispatch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
46 lines (31 loc) · 999 Bytes
/
Copy pathmodels.py
File metadata and controls
46 lines (31 loc) · 999 Bytes
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
from typing import Optional, List
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy_utils import TSVectorType
from dispatch.database import Base
from dispatch.models import DispatchBase, TimeStampMixin
class Tag(Base, TimeStampMixin):
id = Column(Integer, primary_key=True)
name = Column(String, unique=True)
description = Column(String)
uri = Column(String)
source = Column(String)
type = Column(String)
discoverable = Column(Boolean, default=True)
search_vector = Column(TSVectorType("name"))
# Pydantic models
class TagBase(DispatchBase):
name: str
source: Optional[str] = "dispatch"
type: Optional[str] = "generic"
uri: Optional[str]
discoverable: Optional[bool] = True
description: Optional[str] = "Generic user tag"
class TagCreate(TagBase):
pass
class TagUpdate(TagBase):
id: int
class TagRead(TagBase):
id: int
class TagPagination(DispatchBase):
items: List[TagRead]
total: int