Skip to content

Commit

Permalink
319_delete_ar_prompt (#2981)
Browse files Browse the repository at this point in the history
* 319_delete_ar_prompt

* 319_delete_AR_PROMPT_FIX
  • Loading branch information
rarmitag authored Sep 11, 2024
1 parent e1e84ff commit 0019a3d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions colin-api/src/colin_api/resources/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,35 @@ def post(identifier, **kwargs):
except Exception as err: # pylint: disable=broad-except
current_app.logger.error(f'Error updating AR status for {identifier}: {str(err)}')
return jsonify({'message': 'Error updating AR status.'}), HTTPStatus.INTERNAL_SERVER_ERROR


@cors_preflight('POST')
@API.route('/string:identifier/filings')
# pylint: disable=too-few-public-methods
class DeleteARPrompt(Resource):
"""Delete AR Prompt for corporation."""

@staticmethod
@cors.crossdomain(origin='*')
@jwt.requires_roles([COLIN_SVC_ROLE])
def post(identifier, **kwargs):
"""Clean up data in Colin for the corporation."""
# pylint: disable=unused-argument
try:
with DB.connection as con:
with con.cursor() as cursor:
# Delete from AR prompt for the given corporation
delete_ar_prompt = """
DELETE FROM AR_PROMPT
WHERE corp_num = :identifier
"""
cursor.execute(delete_ar_prompt, {'identifier': identifier})

# Commit the transaction
con.commit()
current_app.logger.info(f'Successfully deleted AR prompt for corporation {identifier}.')
return jsonify({'message': f'AR prompt deleted for corporation {identifier}.'}), HTTPStatus.OK

except Exception as err: # pylint: disable=broad-except
current_app.logger.error(f'Error Deleteing AR status for {identifier}: {str(err)}')
return jsonify({'message': 'Error Deleteing AR status.'}), HTTPStatus.INTERNAL_SERVER_ERROR

0 comments on commit 0019a3d

Please sign in to comment.