Skip to content

feat: Add endpoint to post new allowlist#5579

Merged
steverydz merged 1 commit intomainfrom
WD-33419-create-remodel-allowlist-endpoint
Feb 12, 2026
Merged

feat: Add endpoint to post new allowlist#5579
steverydz merged 1 commit intomainfrom
WD-33419-create-remodel-allowlist-endpoint

Conversation

@steverydz
Copy link
Copy Markdown
Contributor

@steverydz steverydz commented Feb 5, 2026

Done

Adds an endpoint to create a new remodel allowlist

How to QA

Run locally and use Postman to test the responses

URL

http://localhost:8004/api/store/njwQYXFnS7ppo7LaGxoh7aqVZc1CPi26/models/remodel-allowlist

Headers

  • Content-Type: application/json
  • Cookie: YOUR COOKIE
  • X-Csrftoken: YOUR TOKEN

Body

[{"from-model":"testmodelzzzz","to-model":"my-name-is-luke","from-serial":"GN4R66MulBPDMooy8Ch_VNzkJBW56zFwEupqSodfKhFbfVz_5hSUgSWztUwbvNPB-Hlkj"}]

Requests

  • Make a request - you should get a conflict error
  • Change the serial to a random string and make a request - it should be successful
  • Change one of the model names to a random string - you should get an error
  • Change the body to [] - you should get an error

Testing

  • This PR has tests
  • No testing required (explain why):

Security

  • Security considerations for review (list them):
    • Examples:
    • Access control: users can only access their own data
    • Input: user input is validated and sanitised
    • Sensitive data: secret or private data is not exposed in any way
    • ...
  • This PR has no security considerations (explain why): Follows existing patterns for posting data

Issue / Card

Fixes https://warthogs.atlassian.net/browse/WD-33419

Screenshots

n/a

UX Approval

  • This PR does not require UX approval
  • This PR does require UX approval (add context):

Copilot AI review requested due to automatic review settings February 5, 2026 10:01
@webteam-app
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new POST endpoint to create remodel allowlists for stores. The endpoint accepts JSON payloads containing allowlist data (description, from-model, from-serial, to-model) and creates them via the publisher gateway.

Changes:

  • New POST endpoint /api/store/<store_id>/models/remodel-allowlist for creating remodel allowlists
  • Endpoint includes authentication (@login_required, @exchange_required) and error handling for API and generic exceptions
  • Test suite with three test cases covering success, store not found, and empty payload scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
webapp/endpoints/models.py Adds create_remodel_allowlist function with POST route, implementing the endpoint logic with exception handling
tests/endpoints/tests_models.py Adds TestCreateRemodelAllowlist test class with three test methods to verify endpoint behavior

Comment thread tests/endpoints/tests_models.py Outdated
Comment thread webapp/endpoints/models.py
Comment thread webapp/endpoints/models.py Outdated
Comment thread webapp/endpoints/models.py Outdated
Comment thread webapp/endpoints/models.py
Comment thread webapp/endpoints/models.py Outdated
@steverydz steverydz force-pushed the WD-33419-create-remodel-allowlist-endpoint branch 3 times, most recently from aeeea16 to 2c1b053 Compare February 5, 2026 10:19
@steverydz steverydz requested a review from Copilot February 5, 2026 10:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread tests/endpoints/tests_models.py
Comment thread tests/endpoints/tests_models.py
@steverydz steverydz force-pushed the WD-33419-create-remodel-allowlist-endpoint branch from 2c1b053 to 37fe89f Compare February 5, 2026 10:31
@edisile edisile self-requested a review February 6, 2026 11:54
Comment thread webapp/endpoints/models.py
Comment thread tests/endpoints/tests_models.py Outdated
@steverydz steverydz force-pushed the WD-33419-create-remodel-allowlist-endpoint branch 2 times, most recently from 564072a to 9d1fc23 Compare February 11, 2026 09:19
Comment thread webapp/endpoints/models.py
@steverydz steverydz force-pushed the WD-33419-create-remodel-allowlist-endpoint branch from 9c1e057 to eadf84e Compare February 12, 2026 10:40
@steverydz
Copy link
Copy Markdown
Contributor Author

@bartaz @edisile I've updated this so that we will use the status code from the store api when there is an error, and also have an StoreApiResourceNotFound to handle that case

Copy link
Copy Markdown
Member

@bartaz bartaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@steverydz steverydz merged commit b7b53e7 into main Feb 12, 2026
14 checks passed
@steverydz steverydz deleted the WD-33419-create-remodel-allowlist-endpoint branch February 12, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants