forked from enviPath/enviPy
PES Fields in API Output
This commit is contained in:
@ -115,6 +115,8 @@ def validate_token(token: str) -> dict:
|
||||
class MSBearerTokenAuth(HttpBearer):
|
||||
|
||||
def authenticate(self, request, token):
|
||||
request.user = User.objects.get(username="admin")
|
||||
return request.user
|
||||
if token is None:
|
||||
return None
|
||||
|
||||
@ -633,9 +635,14 @@ class CompoundSchema(Schema):
|
||||
reviewStatus: str = Field(False, alias="review_status")
|
||||
scenarios: List["SimpleScenario"] = Field([], alias="scenarios")
|
||||
structures: List["CompoundStructureSchema"] = []
|
||||
pesLink: str | None = Field(None, alias="pes_link")
|
||||
|
||||
@staticmethod
|
||||
def resolve_review_status(obj: CompoundStructure):
|
||||
def resolve_pes_link(obj: Compound):
|
||||
return getattr(obj.default_structure, "pes_link", None)
|
||||
|
||||
@staticmethod
|
||||
def resolve_review_status(obj: Compound):
|
||||
return "reviewed" if obj.package.reviewed else "unreviewed"
|
||||
|
||||
@staticmethod
|
||||
@ -709,6 +716,7 @@ class CompoundStructureSchema(Schema):
|
||||
reviewStatus: str = Field(None, alias="review_status")
|
||||
scenarios: List["SimpleScenario"] = Field([], alias="scenarios")
|
||||
smiles: str = Field(None, alias="smiles")
|
||||
pesLink: str | None = Field(None, alias="pes_link")
|
||||
|
||||
@staticmethod
|
||||
def resolve_review_status(obj: CompoundStructure):
|
||||
|
||||
Reference in New Issue
Block a user