diff --git a/.github/workflows/namex-api-ci.yml b/.github/workflows/namex-api-ci.yml index e4d869c9e..54161b23c 100644 --- a/.github/workflows/namex-api-ci.yml +++ b/.github/workflows/namex-api-ci.yml @@ -18,5 +18,5 @@ jobs: app_name: "namex-api" working_directory: "./api" codecov_flag: "namexapi" - skip_isort: "true" - skip_black: "true" \ No newline at end of file + skip_isort: true + skip_black: true \ No newline at end of file diff --git a/api/namex/resources/requests.py b/api/namex/resources/requests.py index 3a99bed19..88f697214 100644 --- a/api/namex/resources/requests.py +++ b/api/namex/resources/requests.py @@ -42,6 +42,7 @@ from namex.services import EventRecorder, MessageServices, ServicesError from namex.services.lookup import nr_filing_actions from namex.services.name_request import NameRequestService +from namex.services.name_request.name_request import get_nrs_like_names, get_nrs_like_nr_num from namex.services.name_request.utils import check_ownership, get_or_create_user_by_jwt, valid_state_transition from namex.services.solr.solr_client import SolrClient from namex.services.solr.solr_helpers import SolrHlpers @@ -49,7 +50,6 @@ from namex.utils.auth import cors_preflight from namex.utils.common import convert_to_ascii, convert_to_utc_max_date_time, convert_to_utc_min_date_time from namex.utils.nr_query import get_nr_num_from_query, normalize_nr_key -from namex.services.name_request.name_request import get_nrs_like_nr_num, get_nrs_like_names from .utils import DateUtils @@ -669,7 +669,10 @@ class Request(Resource): ) def get(nr): # return make_response(jsonify(request_schema.dump(RequestDAO.query.filter_by(nr=nr.upper()).first_or_404())) - return jsonify(RequestDAO.query.filter_by(nrNum=nr.upper()).first_or_404().json()) + # Normalize NR number: accept both "NR1234567" and "NR 1234567" formats + nr_normalized = nr.upper().strip().replace(' ', '') + nr_normalized = nr_normalized.replace('NR', 'NR ', 1) + return jsonify(RequestDAO.query.filter_by(nrNum=nr_normalized).first_or_404().json()) @staticmethod # @cors.crossdomain(origin='*') @@ -711,7 +714,7 @@ def delete(nr): ) @api.doc( description=( - 'Updates a name request\'s state, records the previous state, optionally adds comments, assigns a corpNum if consumption state, ' + "Updates a name request's state, records the previous state, optionally adds comments, assigns a corpNum if consumption state, " 'and calculates expiration if approval state. Only users with APPROVER, EDITOR, or SYSTEM roles may update state, ' 'and certain transitions may be restricted based on role or current state.' ), @@ -858,7 +861,7 @@ def consumeName(nrd, json_input): return make_response(jsonify(message='Internal server error'), 500) if 'warnings' in locals() and warnings: # noqa: F821 - return make_response(jsonify(message='Request:{} - patched'.format(nr), warnings=warnings), + return make_response(jsonify(message='Request:{} - patched'.format(nr), warnings=warnings), # noqa: F821 206) # noqa: F821 if state in [State.APPROVED, State.CONDITIONAL, State.REJECTED]: