Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint for project info #1310

Merged
merged 17 commits into from
Oct 27, 2022
1 change: 1 addition & 0 deletions dds_web/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def output_json(data, code, headers=None):
api.add_resource(project.ProjectStatus, "/proj/status", endpoint="project_status")
api.add_resource(project.ProjectAccess, "/proj/access", endpoint="project_access")
api.add_resource(project.ProjectBusy, "/proj/busy", endpoint="project_busy")
api.add_resource(project.ProjectInfo, "/proj/info", endpoint="project_info")

# User management ################################################################ User management #
api.add_resource(user.RetrieveUserInfo, "/user/info", endpoint="user_info")
Expand Down
25 changes: 25 additions & 0 deletions dds_web/api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,3 +949,28 @@ def put(self):
"ok": True,
"message": f"Project {project_id} was set to {'busy' if set_to_busy else 'not busy'}.",
}


class ProjectInfo(flask_restful.Resource):
"""Get information for a specific project."""

@auth.login_required
@logging_bind_request
@handle_validation_errors
valyo marked this conversation as resolved.
Show resolved Hide resolved
def get(self):
# Get the specified project
project = project_schemas.ProjectRequiredSchema().load(flask.request.args)
valyo marked this conversation as resolved.
Show resolved Hide resolved

# Construct a dict with info items
project_info = {
"Project ID": project.public_id,
"Created by": project.created_by,
valyo marked this conversation as resolved.
Show resolved Hide resolved
"Status": project.current_status,
"Last updated": project.date_updated,
"Size": project.size,
"Title": project.title,
"Description": project.description,
}

return_info = {"project_info": project_info}
return return_info
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class DDSEndpoint:
PROJECT_ACCESS = BASE_ENDPOINT + "/proj/access"
PROJECT_BUSY = BASE_ENDPOINT + "/proj/busy"
PROJECT_BUSY_ANY = BASE_ENDPOINT + "/proj/busy/any"
PROJECT_INFO = BASE_ENDPOINT + "/proj/info"

# Listing urls
LIST_PROJ = BASE_ENDPOINT + "/proj/list"
Expand Down