Skip to content

auto add work lead as team lead #1353

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

Merged
merged 11 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""project lead to team lead

Revision ID: 7a42d4f57279
Revises: 1e1a2af1605b
Create Date: 2023-11-24 13:39:01.142953

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '7a42d4f57279'
down_revision = '1e1a2af1605b'
branch_labels = None
depends_on = None


def upgrade():
op.execute("Update roles set name='Team Lead' where name='Project Lead'")


def downgrade():
pass
2 changes: 1 addition & 1 deletion epictrack-api/src/api/resources/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def get(work_id):
@auth.require
@profiletime
def post(work_id):
"""Get all the active staff allocated to the work"""
"""Add staff member to a work"""
req.WorkIdPathParameterSchema().load(request.view_args)
request_json = req.StaffWorkBodyParamSchema().load(API.payload)
staff = WorkService.create_work_staff(work_id, request_json)
Expand Down
14 changes: 14 additions & 0 deletions epictrack-api/src/api/services/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from api.services.event_template import EventTemplateService
from api.services.outcome_template import OutcomeTemplateService
from api.services.phaseservice import PhaseService
from api.services.code import CodeService


class WorkService: # pylint: disable=too-many-public-methods
Expand Down Expand Up @@ -148,6 +149,19 @@ def create_work(cls, payload, commit: bool = True):
if sort_order == 1:
work.current_work_phase_id = work_phase_id
sort_order = sort_order + 1
role_id = CodeService.find_code_values_by_type(
"roles",
{
"name": "Team Lead"
}
).get("codes")[0].get("id")
WorkService.create_work_staff(
work.id,
{
"staff_id": payload["work_lead_id"],
"role_id": role_id, "is_active": True
}
)
if commit:
db.session.commit()
return work
Expand Down