-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschemas.py
More file actions
38 lines (26 loc) · 745 Bytes
/
schemas.py
File metadata and controls
38 lines (26 loc) · 745 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
from datetime import datetime
from enum import Enum
from typing import Optional
from pydantic import BaseModel, ConfigDict, Field
class FieldType(str, Enum):
string = "string"
number = "number"
integer = "integer"
boolean = "boolean"
array = "array"
object = "object"
class FieldBase(BaseModel):
name: str = Field(
min_length=1, max_length=100, description="Field name cannot be empty"
)
description: Optional[str] = None
field_type: FieldType
class FieldCreate(FieldBase):
pass
class FieldOut(FieldBase):
id: int
created_at: datetime
updated_at: datetime
model_config = ConfigDict(from_attributes=True)
class FieldOutWithEventCount(FieldOut):
event_count: int