From 770fe27fc69ce479fd158696b3f736c5c9421871 Mon Sep 17 00:00:00 2001 From: Vysakh Menon Date: Wed, 24 Apr 2024 14:29:38 -0700 Subject: [PATCH] 19693 continuation in corp types (#2771) * 19693 continuation in corp types * no message --- .../versions/2024_04_23_51524729b99c_.py | 39 +++++++++++++++++++ auth-api/src/auth_api/services/affiliation.py | 17 ++++++-- auth-api/src/auth_api/utils/enums.py | 17 +++++--- 3 files changed, 63 insertions(+), 10 deletions(-) create mode 100644 auth-api/migrations/versions/2024_04_23_51524729b99c_.py diff --git a/auth-api/migrations/versions/2024_04_23_51524729b99c_.py b/auth-api/migrations/versions/2024_04_23_51524729b99c_.py new file mode 100644 index 0000000000..ba1537cd53 --- /dev/null +++ b/auth-api/migrations/versions/2024_04_23_51524729b99c_.py @@ -0,0 +1,39 @@ +"""CTMP message + +Revision ID: 51524729b99c +Revises: 824f5ef280c6 +Create Date: 2024-04-23 14:50:24.894593 + +""" +from alembic import op +from sqlalchemy import Boolean, String +from sqlalchemy.sql import column, table + +# revision identifiers, used by Alembic. +revision = '51524729b99c' +down_revision = '824f5ef280c6' +branch_labels = None +depends_on = None + + + +def upgrade(): + corp_type_table = table('corp_types', + column('code', String), + column('desc', String), + column('default', Boolean) + ) + op.bulk_insert( + corp_type_table, + [ + {'code': 'CTMP', 'description': 'Continuation In', 'default': False}, + {'code': 'C', 'description': 'BC Limited Company Continuation In', 'default': False}, + {'code': 'CBEN', 'description': 'BC Benefit Company Continuation In', 'default': False}, + {'code': 'CUL', 'description': 'BC Unlimited Liability Company Continuation In', 'default': False} + ] + ) + op.execute("update corp_types set description='BC Community Contribution Company Continuation In' where code='CCC'") + + +def downgrade(): + op.execute("delete from corp_types where code in ('CTMP','C', 'CBEN', 'CUL')") diff --git a/auth-api/src/auth_api/services/affiliation.py b/auth-api/src/auth_api/services/affiliation.py index 8e2e5bfd81..4b3f9b5051 100644 --- a/auth-api/src/auth_api/services/affiliation.py +++ b/auth-api/src/auth_api/services/affiliation.py @@ -93,7 +93,7 @@ def find_visible_affiliations_by_org_id(org_id, environment=None): nr_number_name_dict = {d['business_identifier']: d['name'] for d in data if d['corp_type']['code'] == CorpType.NR.value} # Create a list of all temporary business names - temp_types = (CorpType.TMP.value, CorpType.RTMP.value) + temp_types = [CorpType.TMP.value, CorpType.ATMP.value, CorpType.CTMP.value, CorpType.RTMP.value] tmp_business_list = [d['name'] for d in data if d['corp_type']['code'] in temp_types] # NR Numbers @@ -187,7 +187,10 @@ def create_affiliation(org_id, business_identifier, environment=None, pass_code= if entity_type not in ['SP', 'GP']: entity.set_pass_code_claimed(True) - if entity_type not in [CorpType.RTMP.value, CorpType.TMP.value, CorpType.ATMP.value]: + if entity_type not in [CorpType.RTMP.value, + CorpType.TMP.value, + CorpType.ATMP.value, + CorpType.CTMP.value]: name = entity.name if len(entity.name) > 0 else entity.business_identifier ActivityLogPublisher.publish_activity(Activity(org_id, ActivityAction.CREATE_AFFILIATION.value, name=name, id=entity.business_identifier)) @@ -286,7 +289,10 @@ def create_new_business_affiliation(affiliation_data: AffiliationData, # pylint affiliation_model = AffiliationModel( org_id=org_id, entity_id=entity.identifier, certified_by_name=certified_by_name) - if entity.corp_type not in [CorpType.RTMP.value, CorpType.TMP.value, CorpType.ATMP.value]: + if entity.corp_type not in [CorpType.RTMP.value, + CorpType.TMP.value, + CorpType.ATMP.value, + CorpType.CTMP.value]: ActivityLogPublisher.publish_activity(Activity(org_id, ActivityAction.CREATE_AFFILIATION.value, name=entity.name, id=entity.business_identifier)) affiliation_model.certified_by_name = certified_by_name @@ -341,7 +347,10 @@ def delete_affiliation(delete_affiliation_request: DeleteAffiliationRequest, env affiliation.delete() entity.set_pass_code_claimed(False) - if entity.corp_type in [CorpType.RTMP.value, CorpType.TMP.value, CorpType.ATMP.value]: + if entity.corp_type in [CorpType.RTMP.value, + CorpType.TMP.value, + CorpType.ATMP.value, + CorpType.CTMP.value]: return # When registering a business (also RTMP and TMP in between): diff --git a/auth-api/src/auth_api/utils/enums.py b/auth-api/src/auth_api/utils/enums.py index eb8dca74cd..fc378fbd77 100644 --- a/auth-api/src/auth_api/utils/enums.py +++ b/auth-api/src/auth_api/utils/enums.py @@ -41,14 +41,19 @@ class CorpType(Enum): """Corp Types.""" NR = 'NR' - CP = 'CP' # cooperative - TMP = 'TMP' - RTMP = 'RTMP' + CP = 'CP' # Coperative + TMP = 'TMP' # Incorporation Application + CTMP = 'CTMP' # Continuation In + RTMP = 'RTMP' # Registration ATMP = 'ATMP' # Amalgamation - BC = 'BC' # bcomp - CR = 'CR' # corporation - UL = 'UL' # Unlimited Liability + BC = 'BC' # Limited Company + BEN = 'BEN' # Benefit Company + ULC = 'ULC' # Unlimited Liability CC = 'CC' # Community Contribution + C = 'C' # Continuation In BC + CBEN = 'CBEN' # Continuation In BEN + CCC = 'CCC' # Continuation In CC + CUL = 'CUL' # Continuation In ULC GP = 'GP' # General Partnership SP = 'SP' # Sole Proprietorship