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 3 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
5 changes: 4 additions & 1 deletion epictrack-api/src/api/resources/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from api.utils import auth, profiletime
from api.utils.util import cors_preflight
from api.utils.datetime_helper import get_start_of_day
from api.services.code import CodeService


API = Namespace("works", description="Works")
Expand Down Expand Up @@ -74,6 +75,8 @@ def post():
request_json = req.WorkBodyParameterSchema().load(API.payload)
request_json["start_date"] = get_start_of_day(request_json["start_date"])
work = WorkService.create_work(request_json)
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": request_json["work_lead_id"], "role_id": role_id, "is_active": True })
return res.WorkResponseSchema().dump(work), HTTPStatus.CREATED


Expand Down Expand Up @@ -170,7 +173,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