Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add model #4332

Merged
merged 8 commits into from
Jul 12, 2023
Merged

Add model #4332

merged 8 commits into from
Jul 12, 2023

Conversation

codeEmpress1
Copy link
Contributor

@codeEmpress1 codeEmpress1 commented Jul 11, 2023

Done

  • Add the following endpoints:
    • get_model: [GET] /admin/store/<store_id>/models
    • create_model: [POST] /admin/store/<store_id>/models
    • update_model: [PATCH] /admin/store/<store_id>/models/<model_name>

How to QA

  • Login with /login-beta
  • get_model: Go to https://snapcraft-io-4332.demos.haus/admin/store/njwQYXFnS7ppo7LaGxoh7aqVZc1CPi26/models and ensure that a response object containing message, success, and data is returned
  • post_model: the post endpoint can be tested by sending the request from the frontend client with payload {"name": string, "api_key": string}
  • update_model: similar to the post endpoint should also be tested from the frontend client. payload: {"api_key": string}

Issue / Card https://warthogs.atlassian.net/browse/WD-4657

NOTE

THIS ENDPOINT ONLY WORKS WHEN USER AUTHENTICATE WITH LOGIN BETA FOR NOW.

Screenshots

@webteam-app
Copy link

Demo starting at https://snapcraft-io-4332.demos.haus

@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Merging #4332 (665eb4e) into main (6f9749c) will decrease coverage by 5.50%.
The diff coverage is 16.92%.

❗ Current head 665eb4e differs from pull request most recent head 68e5968. Consider uploading reports for the commit 68e5968 to get more accurate results

@@            Coverage Diff             @@
##             main    #4332      +/-   ##
==========================================
- Coverage   87.51%   82.02%   -5.50%     
==========================================
  Files          95      196     +101     
  Lines        6656     9808    +3152     
  Branches        0      801     +801     
==========================================
+ Hits         5825     8045    +2220     
- Misses        831     1641     +810     
- Partials        0      122     +122     
Flag Coverage Δ
javascript 71.56% <ø> (?)
python 86.83% <16.92%> (-0.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
webapp/admin/views.py 30.41% <16.92%> (-7.28%) ⬇️

... and 101 files with indirect coverage changes

res = {}
try:
models = admin_api.get_store_models(flask.session, store_id)
res["message"] = "Models retrieved"
Copy link
Contributor

Choose a reason for hiding this comment

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

If the request is successful we don't need a message :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For all requests? Or for the get requests only?

Copy link
Contributor

Choose a reason for hiding this comment

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

All successful requests

Copy link
Contributor

@Lukewh Lukewh left a comment

Choose a reason for hiding this comment

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

1 small change plz

Copy link
Contributor

@Lukewh Lukewh left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@codeEmpress1 codeEmpress1 merged commit cc529ab into canonical:main Jul 12, 2023
8 checks passed
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.

3 participants