commit 9dfe635f512b50c3e76b3a1970a22ea88598cf0c
parent 6e868d5dd272354bc9eaae22bf3c6cc53e782c35
Author: Nikolas Mazur <nikolas@pop-os.localdomain>
Date: Thu, 12 Jan 2023 16:08:18 -0700
Update Projects and Agreement models
Diffstat:
M | model.py | | | 26 | +++++++++++++------------- |
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/model.py b/model.py
@@ -1,11 +1,11 @@
-import pydantic
import datetime
from fastapi.encoders import jsonable_encoder
+from typing import List, Optional, Union
from pydantic import BaseModel, Field
class Users(BaseModel):
- _id:[PydanticObjectId] = Field(None, alias="_id")
+ _id: Optional[PydanticObjectId] = Field(None, alias="_id")
slug: str
username: str
role: str
@@ -78,15 +78,15 @@ class Agreement(BaseModel):
bid_document: str #Filepath to document
budget: float
cost: int
- projects: [
- project_id: int
- project_name: str
- project_budget: [
- labor_budget: float
- travel_budget: int
- supplies_budget: int
- contact_budget: int
- equipment_budget: int
- other: complex
- ]
+
+class Projects(BaseModel):#Projects references agreement
+ project_id: int
+ project_name: str
+ project_budget: List[float] = [
+ # labor_budget: float | Indexed 0
+ # travel_budget: float | Indexed 1
+ # supplies_budget: float | Indexed 2
+ # contact_budget: float | Indexed 3
+ # equipment_budget: float | Indexed 4
+ # other: float | Indexed 5
]
\ No newline at end of file