Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/namex-api-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
app_name: "namex-api"
working_directory: "./api"
codecov_flag: "namexapi"
skip_isort: "true"
skip_black: "true"
skip_isort: true
skip_black: true
11 changes: 7 additions & 4 deletions api/namex/resources/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
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
from namex.utils import queue_util
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

Expand Down Expand Up @@ -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='*')
Expand Down Expand Up @@ -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.'
),
Expand Down Expand Up @@ -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]:
Expand Down
Loading