Skip to content

Commit

Permalink
update mine_report_permit_requirement response model to not break swa…
Browse files Browse the repository at this point in the history
…gger
  • Loading branch information
matbusby-fw committed Nov 14, 2024
1 parent b5036c2 commit 587bc01
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MineReportPermitRequirementResource(Resource, UserMixin):
parser.add_argument('permit_condition_id', type=int, location='json')
parser.add_argument('permit_amendment_id', type=int, location='json')

@api.expect(parser)
@api.doc(description='creates a new mine report permit requirement')
@api.marshal_with(MINE_REPORT_PERMIT_REQUIREMENT, code=201)
@requires_any_of([EDIT_REPORT])
Expand Down
7 changes: 3 additions & 4 deletions services/core-api/app/api/mines/response_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from app.api.compliance.response_models import COMPLIANCE_ARTICLE_MODEL
from app.api.dams.dto import DAM_MODEL
from app.api.mines.reports.models.mine_report_permit_requirement import CimOrCpo
from app.api.mines.reports.models.mine_report_permit_requirement import CimOrCpo, OfficeDestination
from app.api.parties.party_appt.models.mine_party_appt import MinePartyAppointmentStatus, MinePartyAcknowledgedStatus
from app.api.parties.response_models import PARTY
from app.api.utils.helpers import EnumListField
from app.extensions import api

from app.api.utils.feature_flag import is_feature_enabled, Feature
Expand Down Expand Up @@ -251,8 +250,8 @@ def format(self, value):
'mine_report_permit_requirement_id': fields.Integer,
'due_date_period_months': fields.Integer,
'initial_due_date': fields.Date,
'cim_or_cpo': fields.String(enum=CimOrCpo, attribute='cim_or_cpo.name'),
'ministry_recipient': EnumListField(),
'cim_or_cpo': fields.String(enum=[e.value for e in CimOrCpo], attribute='cim_or_cpo.name'),
'ministry_recipient': fields.List(fields.String(enum=[e.value for e in OfficeDestination])),
'permit_condition_id': fields.Integer
}
)
Expand Down
11 changes: 1 addition & 10 deletions services/core-api/app/api/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,4 @@ def get_current_core_or_ms_env_url(app):
return getattr(Config, core_config_property)
elif app == 'ms':
ms_config_property = f'MINESPACE_{(Config.ENVIRONMENT_NAME).upper()}_URL'
return getattr(Config, ms_config_property)

class EnumListField(Raw):
def format(self, value):
if value is None:
return None
try:
return [enum.value for enum in value]
except AttributeError:
raise ValidationError("Invalid enum value")
return getattr(Config, ms_config_property)

0 comments on commit 587bc01

Please sign in to comment.