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

[API] add priority #4313

Merged
merged 5 commits into from
Aug 21, 2023
Merged

[API] add priority #4313

merged 5 commits into from
Aug 21, 2023

Conversation

rouet
Copy link
Contributor

@rouet rouet commented Jun 15, 2023

[API] add priority in book read
[API] add priority in chapter create and update
[API] add priority in page create and update

I propose a pull request in order to add the possibility of modifying the priority field of pages and chapters by the api, this in order to allow sorting a book using the api.
This proposal solves the problem posed by @riton in ticket #4298.
I also added in addition to display the priorities when a book is requested by the rest api.
We have tested and validated it internally.
I am not a Laravel specialist, but if it is necessary to add the corresponding tests, I can do it, but it will need help on the scenarios to be tested.

Regards.

[API] add priority in chapter create and update
[API] add priority in page create and update
@ssddanbrown
Copy link
Member

Thanks for this @rouet.

We have tested and validated it internally.

Is it currently working on page create? Not tested it myself but looking at the existing code I'd be surprised if priority was filled here.

I am not a Laravel specialist, but if it is necessary to add the corresponding tests, I can do it, but it will need help on the scenarios to be tested.

Tests would be ideal. For the update endpoints, you can update the existing test_update_endpoint tests to include priority. Example of such test.
For the create endpoints, it'd be best to have new tests for those, so a test_create_applies_correct_priority test cases for both chapters and pages. You can follow the test_create_endpoint test cases as an example in the relevant PagesApiTest and ChaptersApiTest classes.

Additionally, could you update the relevant example API requests/responses within this directory?:
https://github.com/BookStackApp/BookStack/tree/1e220c473fa71a412918a8e55b63949019b40744/dev/api

@rouet
Copy link
Contributor Author

rouet commented Jun 16, 2023

Thanks for this @rouet.

We have tested and validated it internally.

Is it currently working on page create? Not tested it myself but looking at the existing code I'd be surprised if priority was filled here.

my tests were not complete, indeed, it does not work at creation, should we make it work? because I have the impression that the modification of the code will be much more consequent.

I am not a Laravel specialist, but if it is necessary to add the corresponding tests, I can do it, but it will need help on the scenarios to be tested.

Tests would be ideal. For the update endpoints, you can update the existing test_update_endpoint tests to include priority. Example of such test. For the create endpoints, it'd be best to have new tests for those, so a test_create_applies_correct_priority test cases for both chapters and pages. You can follow the test_create_endpoint test cases as an example in the relevant PagesApiTest and ChaptersApiTest classes.

Additionally, could you update the relevant example API requests/responses within this directory?: https://github.com/BookStackApp/BookStack/tree/1e220c473fa71a412918a8e55b63949019b40744/dev/api

ok i'll take care of that

@ssddanbrown
Copy link
Member

it does not work at creation, should we make it work?

Ideally yes, but if you're uncomfortable making further changes you can ignore this but be sure to still add a test, so that I have a failing test case to address before merging.

@rouet
Copy link
Contributor Author

rouet commented Jul 11, 2023

Hi

I've push a last version (if it's ok) with priority set correctly on insert.
I wrote or modify some tests
I modify the Json examples

regards

@ssddanbrown ssddanbrown added this to the Next Feature Release milestone Jul 18, 2023
ssddanbrown added a commit that referenced this pull request Aug 21, 2023
Review of #4313
- Made constructor changes while reviewing some classes.
- Updated API examples for consistency.
- Tweaked formatting for some array changes.
- Simplified added tests.
- Tweaked chapter/page repo priority handling to be simpler.

Performed manual API endpoint testing of page/chapter create/update.
@ssddanbrown ssddanbrown merged commit 3a36d3c into BookStackApp:development Aug 21, 2023
@ssddanbrown
Copy link
Member

Thanks for this @rouet,
Now merged in to development to be part of the next feature release.
Made a few last minor changes in 9ca1139.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants