-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
cleanupCleaning up codeCleaning up code
Description
Currently in a lot of parts of the code (Ex: all of the database files), we take the data directly from JSONs and pass it around into the controller or managers. Instead of passing this into the controllers, managers, it would be nice to pass the JSON into a pydantic model instead.
Example:
In database/users.py, the _new_user() function looks like this:
@classmethod
def _new_user(cls, _id: str, username: str, vendor_type: str) -> JSONDict:
return {
"_id": _id,
"username": username,
"contracts": [],
"group": Groups.CUSTOMER,
"vendor_type": vendor_type,
"roles": []
}
Instead we can define a model and use that
class MongoUser(BaseModel):
_id: str
username: str
contracts: List<str>
...
@classmethod
def _new_user(cls, _id: str, username: str, vendor_type: str) -> JSONDict:
return MongoUser(...)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cleanupCleaning up codeCleaning up code