Refactor workspace domain class to match other domain objects
This commit is contained in:
parent
e068889b5b
commit
f8c3ac824a
@ -1,14 +1,33 @@
|
|||||||
|
class Workspaces(object):
|
||||||
|
MOCK_WORKSPACES = [
|
||||||
|
{
|
||||||
|
"name": "Unclassified IaaS and PaaS for Defense Digital Service (DDS)",
|
||||||
|
"id": "5966187a-eff9-44c3-aa15-4de7a65ac7ff",
|
||||||
|
"task_order": {"number": 123456},
|
||||||
|
"user_count": 23,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get(cls, workspace_id):
|
||||||
|
return cls.MOCK_WORKSPACES[0]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_many(cls):
|
||||||
|
return cls.MOCK_WORKSPACES
|
||||||
|
|
||||||
class Projects(object):
|
class Projects(object):
|
||||||
def __init__(self):
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, creator_id, body):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def create(self, creator_id, body):
|
@classmethod
|
||||||
|
def get(cls, project_id):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get(self, project_id):
|
@classmethod
|
||||||
pass
|
def get_many(cls, workspace_id):
|
||||||
|
|
||||||
def get_many(self, workspace_id):
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"id": "187c9bea-9541-45d7-801f-cf8e7a642e93",
|
"id": "187c9bea-9541-45d7-801f-cf8e7a642e93",
|
||||||
@ -41,21 +60,23 @@ class Projects(object):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def update(self, request_id, request_delta):
|
@classmethod
|
||||||
|
def update(cls, request_id, request_delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Members(object):
|
class Members(object):
|
||||||
def __init__(self):
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, creator_id, body):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def create(self, creator_id, body):
|
@classmethod
|
||||||
|
def get(cls, request_id):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get(self, request_id):
|
@classmethod
|
||||||
pass
|
def get_many(cls, workspace_id):
|
||||||
|
|
||||||
def get_many(self, workspace_id):
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"first_name": "Danny",
|
"first_name": "Danny",
|
||||||
@ -86,5 +107,6 @@ class Members(object):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def update(self, request_id, request_delta):
|
@classmethod
|
||||||
|
def update(cls, request_id, request_delta):
|
||||||
pass
|
pass
|
||||||
|
@ -1,29 +1,19 @@
|
|||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template, request as http_request
|
||||||
|
|
||||||
from atst.domain.workspaces import Projects, Members
|
from atst.domain.workspaces import Members, Projects, Workspaces
|
||||||
|
|
||||||
|
|
||||||
bp = Blueprint("workspaces", __name__)
|
bp = Blueprint("workspaces", __name__)
|
||||||
|
|
||||||
mock_workspaces = [
|
|
||||||
{
|
|
||||||
"name": "Unclassified IaaS and PaaS for Defense Digital Service (DDS)",
|
|
||||||
"id": "5966187a-eff9-44c3-aa15-4de7a65ac7ff",
|
|
||||||
"task_order": {"number": 123456},
|
|
||||||
"user_count": 23,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/workspaces")
|
@bp.route("/workspaces")
|
||||||
def workspaces():
|
def workspaces():
|
||||||
return render_template("workspaces.html", page=5, workspaces=mock_workspaces)
|
return render_template("workspaces.html", page=5, workspaces=Workspaces.get_many())
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/workspaces/<workspace_id>/projects")
|
@bp.route("/workspaces/<workspace_id>/projects")
|
||||||
def workspace_projects(workspace_id):
|
def workspace_projects(workspace_id):
|
||||||
projects_repo = Projects()
|
projects = Projects.get_many(workspace_id)
|
||||||
projects = projects_repo.get_many(workspace_id)
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"workspace_projects.html", workspace_id=workspace_id, projects=projects
|
"workspace_projects.html", workspace_id=workspace_id, projects=projects
|
||||||
)
|
)
|
||||||
@ -31,8 +21,7 @@ def workspace_projects(workspace_id):
|
|||||||
|
|
||||||
@bp.route("/workspaces/<workspace_id>/members")
|
@bp.route("/workspaces/<workspace_id>/members")
|
||||||
def workspace_members(workspace_id):
|
def workspace_members(workspace_id):
|
||||||
members_repo = Members()
|
members = Members.get_many(workspace_id)
|
||||||
members = members_repo.get_many(workspace_id)
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"workspace_members.html", workspace_id=workspace_id, members=members
|
"workspace_members.html", workspace_id=workspace_id, members=members
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user