-
Notifications
You must be signed in to change notification settings - Fork 1
/
schemas.py
60 lines (45 loc) · 1.19 KB
/
schemas.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
import enum
from pydantic import BaseModel, Field
from typing import List, Optional, Dict
class ResetIntervalDefinition(enum.Enum):
daily = "daily"
weekly = "weekly"
monthly = "monthly"
semester = "semester"
# Enum definitions
class QuotaScope(enum.Enum):
user = "user"
course = "course"
course_user = "course-user"
total = "total"
class QuotaDefinition(BaseModel):
type: Optional[str]
description: Dict[str, str]
reset_interval: Optional[ResetIntervalDefinition]
scope: QuotaScope
feature: Optional[str] = None
class QuotaGet(BaseModel):
limit: int
used: Optional[int] = None
type: Optional[str]
scope: QuotaScope
feature: Optional[str] = None
user_id: Optional[str] = None
class QuotaUpdate(BaseModel):
limit: int
scope: QuotaScope
feature: Optional[str] = None
class Metadata(BaseModel):
tool_url: str
quota_url: str
image_url: str
description: Dict[str, str]
title: Dict[str, str]
supported_quotas: List[QuotaDefinition]
class JWTPayload(BaseModel):
sub: str
name: str
iat: float
exp: float
context: Optional[str]
context_role: str = Field(alias="context-role")