1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-24 22:14:18 +00:00

Change repository json repr.

This commit is contained in:
Lorenzo Balugani 2021-05-20 13:56:23 +02:00
parent 6a2f5923a3
commit 3a8df55178
3 changed files with 2 additions and 1 deletions

View file

@ -74,6 +74,7 @@ class RepositorySchema(Schema):
is_active = fields.Boolean(description="True if the repository is active.")
end = fields.DateTime(description="The end date of the repository")
owner = fields.Nested(UserSchema)
spectators = fields.Nested(AuthorizationSchema, many=True)
conditions = fields.Nested(ConditionSchema, many=True)
evaluation_mode = fields.Integer(description="The mode with which conditions are evaluated.")

View file

@ -34,7 +34,6 @@ spec.components.schema("Alert", schema=Alert)
spec.components.schema("Tweet", schema=TweetSchema)
spec.components.schema("CreateAlert", schema=CreateAlert)
spec.components.schema("CreateAuthorization", schema=CreateAuthorizationSchema)
spec.components.schema("Authorization", schema=AuthorizationSchema)
spec.components.security_scheme("jwt", {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"})
# add swagger tags that are used for endpoint annotation

View file

@ -35,6 +35,7 @@ class Repository(ext.Model):
"is_active": self.is_active,
"end": self.end.isoformat() if self.end else None,
"owner": self.owner.to_json(),
"spectators": [a.to_json() for a in self.authorizations],
"evaluation_mode": self.evaluation_mode.value,
"conditions": [c.to_json() for c in self.conditions]
}