mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 13:04:19 +00:00
Add docs
This commit is contained in:
parent
783d6de392
commit
0fe508071c
5 changed files with 23 additions and 57 deletions
|
@ -28,7 +28,8 @@ app.add_url_rule("/api/v1/repositories/<int:rid>/conditions", view_func=page_rep
|
||||||
methods=["GET", "POST"])
|
methods=["GET", "POST"])
|
||||||
app.add_url_rule("/api/v1/repositories/<int:rid>/alerts", view_func=page_repository_alerts,
|
app.add_url_rule("/api/v1/repositories/<int:rid>/alerts", view_func=page_repository_alerts,
|
||||||
methods=["GET", "POST"])
|
methods=["GET", "POST"])
|
||||||
app.add_url_rule("/api/v1/conditions/<int:cid>", view_func=page_condition, methods=["GET", "PATCH", "DELETE"])
|
app.add_url_rule("/api/v1/conditions/<int:aid>", view_func=page_condition, methods=["GET", "PATCH", "DELETE"])
|
||||||
|
app.add_url_rule("/api/v1/alerts/<int:aid>", view_func=page_alert, methods=["GET", "PATCH", "DELETE"])
|
||||||
|
|
||||||
app.register_error_handler(Exception, error_handler)
|
app.register_error_handler(Exception, error_handler)
|
||||||
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
|
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
|
||||||
|
|
|
@ -36,6 +36,10 @@ class IntegerParameterSchema(Schema):
|
||||||
rid = fields.Integer(description="The target numeric id.")
|
rid = fields.Integer(description="The target numeric id.")
|
||||||
|
|
||||||
|
|
||||||
|
class AlertParameterSchema(Schema):
|
||||||
|
rid = fields.Integer(description="The target numeric id.")
|
||||||
|
|
||||||
|
|
||||||
class CreateUser(Schema):
|
class CreateUser(Schema):
|
||||||
email = fields.String(description="The new user's email.")
|
email = fields.String(description="The new user's email.")
|
||||||
username = fields.String(description="The new user's username.")
|
username = fields.String(description="The new user's username.")
|
||||||
|
|
|
@ -29,6 +29,7 @@ spec.components.schema("RepositoryUpdate", schema=RepositoryUpdate)
|
||||||
spec.components.schema("CreateRepository", schema=CreateRepository)
|
spec.components.schema("CreateRepository", schema=CreateRepository)
|
||||||
spec.components.schema("CreateCondition", schema=CreateCondition)
|
spec.components.schema("CreateCondition", schema=CreateCondition)
|
||||||
spec.components.schema("ConditionParameter", schema=ConditionParameterSchema)
|
spec.components.schema("ConditionParameter", schema=ConditionParameterSchema)
|
||||||
|
spec.components.schema("AlertParameter", schema=AlertParameterSchema)
|
||||||
spec.components.schema("Alert", schema=Alert)
|
spec.components.schema("Alert", schema=Alert)
|
||||||
spec.components.schema("CreateAlert", schema=CreateAlert)
|
spec.components.schema("CreateAlert", schema=CreateAlert)
|
||||||
spec.components.security_scheme("jwt", {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"})
|
spec.components.security_scheme("jwt", {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"})
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
from .repository_alerts import page_repository_alerts
|
from .repository_alerts import page_repository_alerts
|
||||||
|
from .alert import page_alert
|
|
@ -9,22 +9,22 @@ import datetime
|
||||||
@cross_origin()
|
@cross_origin()
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
@repository_auth
|
@repository_auth
|
||||||
def page_repository(aid):
|
def page_alert(aid):
|
||||||
"""
|
"""
|
||||||
---
|
---
|
||||||
get:
|
get:
|
||||||
summary: Get details about a repository.
|
summary: Get details about an alert.
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
schema: IntegerParameterSchema
|
schema: AlertParameterSchema
|
||||||
security:
|
security:
|
||||||
- jwt: []
|
- jwt: []
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: The details about the requested schema. The schema is incapsulated in Success.
|
description: The details about the requested alert. The schema is incapsulated in Success.
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema: Repository
|
schema: Alert
|
||||||
'404':
|
'404':
|
||||||
description: Could not find the requested repository.
|
description: Could not find the requested repository.
|
||||||
content:
|
content:
|
||||||
|
@ -41,12 +41,12 @@ def page_repository(aid):
|
||||||
application/json:
|
application/json:
|
||||||
schema: Error
|
schema: Error
|
||||||
tags:
|
tags:
|
||||||
- repository-related
|
- alert-related
|
||||||
delete:
|
delete:
|
||||||
summary: Deletes a repository.
|
summary: Deletes an alert.
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
schema: IntegerParameterSchema
|
schema: AlertParameterSchema
|
||||||
security:
|
security:
|
||||||
- jwt: []
|
- jwt: []
|
||||||
responses:
|
responses:
|
||||||
|
@ -73,26 +73,26 @@ def page_repository(aid):
|
||||||
application/json:
|
application/json:
|
||||||
schema: Error
|
schema: Error
|
||||||
tags:
|
tags:
|
||||||
- repository-related
|
- alert-related
|
||||||
patch:
|
patch:
|
||||||
summary: Updates a repository.
|
summary: Updates an alert.
|
||||||
security:
|
security:
|
||||||
- jwt: []
|
- jwt: []
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema: RepositoryUpdate
|
schema: CreateAlert
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
schema: IntegerParameterSchema
|
schema: AlertParameterSchema
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: The repository has been updated successfully.
|
description: The repository has been updated successfully.
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema: Repository
|
schema: Alert
|
||||||
'404':
|
'404':
|
||||||
description: Could not find the requested repository.
|
description: Could not find the requested repository.
|
||||||
content:
|
content:
|
||||||
|
@ -109,48 +109,7 @@ def page_repository(aid):
|
||||||
application/json:
|
application/json:
|
||||||
schema: Error
|
schema: Error
|
||||||
tags:
|
tags:
|
||||||
- repository-related
|
- alert-related
|
||||||
put:
|
|
||||||
summary: Overwrites a repository.
|
|
||||||
security:
|
|
||||||
- jwt: []
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema: Repository
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
schema: IntegerParameterSchema
|
|
||||||
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: The repository has been updated successfully.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema: Repository
|
|
||||||
'404':
|
|
||||||
description: Could not find the requested repository.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema: Error
|
|
||||||
'403':
|
|
||||||
description: The user is not authorized.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema: Error
|
|
||||||
'401':
|
|
||||||
description: The user is not logged in.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema: Error
|
|
||||||
'400':
|
|
||||||
description: The request was malformed.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema: Error
|
|
||||||
tags:
|
|
||||||
- repository-related
|
|
||||||
"""
|
"""
|
||||||
user = find_user(get_jwt_identity())
|
user = find_user(get_jwt_identity())
|
||||||
alert = Alert.query.filter_by(id=aid).first()
|
alert = Alert.query.filter_by(id=aid).first()
|
||||||
|
|
Loading…
Reference in a new issue