diff --git a/nest_backend/api_schemas.py b/nest_backend/api_schemas.py index 47894d3..e23740b 100644 --- a/nest_backend/api_schemas.py +++ b/nest_backend/api_schemas.py @@ -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.") diff --git a/nest_backend/api_spec.py b/nest_backend/api_spec.py index 366abfd..f744f75 100644 --- a/nest_backend/api_spec.py +++ b/nest_backend/api_spec.py @@ -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 diff --git a/nest_backend/database/tables/Repository.py b/nest_backend/database/tables/Repository.py index ea93297..053474e 100644 --- a/nest_backend/database/tables/Repository.py +++ b/nest_backend/database/tables/Repository.py @@ -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] }