-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemas.py
76 lines (51 loc) · 1.54 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Create initial Pydantic schemas
from datetime import datetime
from typing import List
from pydantic import BaseModel, Field
class UserBase(BaseModel):
email: str
class UserCreate(UserBase):
first_name: str
last_name: str
# email: EmailStr
password: str
class User(UserBase):
user_id: str
account_created: datetime
account_updated: datetime
class Config:
orm_mode = True
class AssignmentBase(BaseModel):
name: str
points: int = Field(type, minimum=1, maximum=10,
example=2, description="number of points")
num_of_attempts: int = Field(
type, minimum=1, maximum=3, example=1, description="number of attempts")
deadline: datetime
class AssignmentUpdate(BaseModel):
name: str
user: UserBase
points: int = Field(type, minimum=1, maximum=10,
example=2, description="number of points")
num_of_attempts: int = Field(
type, minimum=1, maximum=3, example=1, description="number of attempts")
deadline: datetime
class AssignmentCreate(AssignmentBase):
assignment_id: str
assignment_created: datetime
assignment_updated: datetime
class Assignment(AssignmentBase):
u_id: str
class SubmissionBase(BaseModel):
submission_url: str
class SubmissionResponse(BaseModel):
id: str
assignment_id: str
submission_url: str
submission_date: datetime
submission_updated: datetime
class Config:
orm_mode = True
class Token(BaseModel):
access_token: str
token_type: str