Skip to content

Commit

Permalink
Merge pull request #5402 from bcgov/dev-NK-FOIMOD-3449
Browse files Browse the repository at this point in the history
changes for new caf ministry
  • Loading branch information
nkan-aot2 authored Sep 6, 2024
2 parents 1c67d46 + 87055fd commit 00cc423
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
3 changes: 2 additions & 1 deletion forms-flow-web/src/constants/FOI/enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ const MinistryNeedsScanning = [

const MinistryNeedsLANPages = [
"CFD",
"MCF"
"MCF",
"CAF"
]

const RequestTypes = Object.freeze({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const MINISTRYGROUPS = {
AGR : "AGR Ministry Team",
BRD : "BRD Ministry Team",
CAS : "CAS Ministry Team",
CAF : "CAF Ministry Team",
MCF : "MCF Ministry Team",
CLB : "CLB Ministry Team",
CITZ : "CITZ Ministry Team",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""empty message
Revision ID: ec27defe9178
Revises: 1d60153653db
Create Date: 2024-09-06 19:46:07.867757
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ec27defe9178'
down_revision = '1d60153653db'
branch_labels = None
depends_on = None


def upgrade():
op.execute('''INSERT INTO public."ProgramAreas"(name, type, isactive, bcgovcode, iaocode) VALUES ('Ministry of Children and Family Development (Generals)', 'BC GOV Ministry', True, 'CAF', 'CAF');commit;''')

# op.execute('''INSERT INTO public."ProgramAreaDivisions"(
# programareaid, name, isactive, created_at, createdby, sortorder, updated_at, updatedby, issection, parentid, specifictopersonalrequests, type)
# SELECT
# (select programareaid from public."ProgramAreas" where bcgovcode='CAF'), name, isactive, created_at, createdby, sortorder, updated_at, updatedby, issection, parentid, specifictopersonalrequests, type
# FROM public."ProgramAreaDivisions"
# where programareaid = (select programareaid from public."ProgramAreas" where bcgovcode = 'MCF')
# and specifictopersonalrequests is false
# and isactive = true
# ORDER BY divisionid ASC ''')

op.execute('''INSERT INTO public."OperatingTeams"(name, description, isactive, type) VALUES ('CAF Ministry Team', 'CAF Ministry Team', True, 'ministry');commit;''')

op.execute('''INSERT INTO public."FOIRequestTeams"(
requesttype, requeststatusid, teamid, programareaid, isactive, requeststatuslabel)
SELECT
requesttype, requeststatusid,
case when ot.name = 'MCF Ministry Team'
then (select teamid from public."OperatingTeams" where name = 'CAF Ministry Team')
else (rt.teamid) end,
(select programareaid from public."ProgramAreas" where bcgovcode = 'CAF'), rt.isactive, requeststatuslabel
FROM public."FOIRequestTeams" rt
join public."OperatingTeams" ot on rt.teamid = ot.teamid
where
programareaid = (select programareaid from public."ProgramAreas" where bcgovcode = 'MCF') and
requesttype = 'General' and rt.isactive = true''')

def downgrade():
op.execute('''delete from public."FOIRequestTeams" where programareaid in (select programareaid from public."ProgramAreas" where bcgovcode = 'CAF')''')

op.execute('''delete from public."OperatingTeams" where name = 'CAF Ministry Team' ''')

# op.execute('''delete from public."ProgramAreaDivisions" where programareaid in (select programareaid from public."ProgramAreas" where bcgovcode = 'CAF')''')

op.execute('''delete from public."ProgramAreas" where bcgovcode = 'CAF' ''')
#
1 change: 1 addition & 0 deletions request-management-api/request_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MinistryTeamWithKeycloackGroup(Enum):
AG = "AG Ministry Team"
BRD = "BRD Ministry Team"
CAS = "CAS Ministry Team"
CAF = "CAF Ministry Team"
CITZ = "CITZ Ministry Team"
CLB = "CLB Ministry Team"
DAS = "DAS Ministry Team"
Expand Down

0 comments on commit 00cc423

Please sign in to comment.