Description
We need to introduce new data models and need to update existing ones to achieve the requirements/features needed for the new work management strategy. Though, we don't have final designs of all input and display requirements, we do have the feature details and we can determine common fields out of those details. So, we can start creating the model and API endpoints around it to be ahead of time and later update the end points when we have more detailed UI designs.
Technically, there is one new data model called WorkStream
that is going to be introduced and it would have schema like:
id bigint,
name varchar(255),
type varchar(45) or enum (dev, qa, design, deploy),
status enum (draft, reviewed, active, paused, completed), // we might not need this in final version
projectId bigint,
createdAt timestamp,
updatedAt timestamp,
createdBy bigint,
updatedBy bigint,
deletedAt timestamp,
deletedBy bigint
New endpoints:
GET /projects/{projectId}/workstreams (fetch directly from database)
GET /projects/{projectId}/workstreams/{id} (fetch directly from database)
POST /projects/{projectId}/workstreams (only admins should be able to directly create the workstreams)
PATCH /projects/{projectId}/workstreams/{id} (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to update the details while for others we don't)
DELETE /projects/{projectId}/workstreams/{id} (only admins should be able to directly deleted the workstreams)
We need to keep one to many relationship (via cross ref table) between WorkStream
and Phase
object so that one work stream can have multiple phases. Phase
object would remain mostly as is. For old projects a phase won't be associated with any work stream, so it is not mandatory for a phase to have workstream associate with it. After we have this relationship, following new endpoints are needed:
GET /projects/{id}/workstreams/{id}/works (we are calling a phase as work in new terminology without changing it in our data model. fetch phases from the database directly.)
GET /projects/{id}/workstreams/{id}/works/{id} (fetch directly from database)
POST /projects/{id}/workstreams/{id}/works (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to create work for a worksstream while for others we don't)
PATCH /projects/{id}/workstreams/{id}/works/{id} (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to update the details of a work while for others we don't)
DELETE /projects/{id}/workstreams/{id}/works/{id} (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to delete a work while for others we don't)
Note We would still keep our existing endpoint of /projects/{id}/phases
and all its child routes as is. These endpoints would serve the response for old projects as is while for new projects, which have workstreams, these endpoints would allow us to interact with all work
for the project e.g. GET /projects/{id}/phases
would return all the phases in the project no matter which workstream they are associated with. There would be no mention of workstream
or work
in the request or response for new projects when accessed via this old endpoints. I don't see any usage of these endpoint as of now, but for completeness and backward compatibility, we need to ensure this behaviour.
Now, next change in data model is to now utilize the one to many relationship between a Phase
and PhaseProduct
to capture the new details about associating a phase/work with challenge/task. Our idea is to keep PhaseProduct
as object to keep details about a challenge/task associated with a phase. I guess, until we have final UI requirements get started, we can use this model as is and keep any details (e.g. challenge id, type, etc in details
field of PhaseProduct
). We might need to update the schema though as soon as we get more requirements around challenges/tasks association.
However, we would need new endpoints for serving PhaseProduct
for new projects as follows:
GET /projects/{id}/workstreams/{id}/work{id}/workitems (fetch directly from database)
GET /projects/{id}/workstreams/{id}/work{id}/workitems/{id} (fetch directly from database)
POST /projects/{id}/workstreams/{id}/work{id}/workitems (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to create work items for a worksstream while for others we don't)
PATCH /projects/{id}/workstreams/{id}/work{id}/workitems/{id} (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to update the details of a work item while for others we don't)
DELETE /projects/{id}/workstreams/{id}/work{id}/workitems/{id} (it requires complex logic of authorization depending on the project template, for some templates we allow customers to be able to delete a work item while for others we don't)