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

Update Categories #276

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

zysim
Copy link
Collaborator

@zysim zysim commented Jan 23, 2025

Closes: #263

Depends: #275

@zysim zysim self-assigned this Jan 23, 2025
@zysim zysim requested a review from a team as a code owner January 23, 2025 10:42
@zysim zysim changed the title Add Update Category Endpoint Update Categories Jan 23, 2025
@zysim zysim force-pushed the updateCategories branch 3 times, most recently from 0de2d38 to 142c1ab Compare January 23, 2025 17:21

UpdateCategoryRequest updateRequest = new()
{
Name = "new update",
Copy link
Contributor

Choose a reason for hiding this comment

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

Test updating the other fields too.

{
Email = email,
Password = "Passw0rd",
Username = $"CreateCatTest{role}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to UpdateCatTest{role}.


if (slug is not null)
{
problemDetails!.Errors["Slug"].ToArray().Should().Equal([SlugRule.SLUG_FORMAT]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the ToArray() call needed here?

Copy link
Collaborator Author

@zysim zysim Jan 24, 2025

Choose a reason for hiding this comment

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

Guess it wasn't. Thought it was.

[TestCase(1, "b.b")]
[TestCase(2, "b")]
[TestCase(3, null)]
public static async Task UpdateCategory_BadData(int index, string? slug)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the index param doing here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To act as a differentiator for the cats I create. Can't add slug to the cats' slugs

Comment on lines 78 to 82
[SwaggerResponse(
409,
"The specified slug is already in use by another category. Returns the conflicting category.",
typeof(CategoryViewModel)
)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use a Conflict Details here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh yeah of course. Sorry it slipped my mind. (Peer reviewing really does work, after all)

Copy link
Contributor

@TheTedder TheTedder left a comment

Choose a reason for hiding this comment

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

Add a test where you try to update a category's Type and it gives an error.

@zysim zysim force-pushed the updateCategories branch 2 times, most recently from 6808359 to 409025f Compare January 24, 2025 10:31
@zysim zysim mentioned this pull request Jan 24, 2025
@zysim zysim marked this pull request as draft January 26, 2025 07:57
zysim added 4 commits January 27, 2025 13:00
- Change UpdateCategory 409 to return a ConflictDetails
- Change UpdateCategory tests to directly call DB instead for scaffolding
@zysim zysim marked this pull request as ready for review January 27, 2025 05:02
@zysim zysim requested a review from TheTedder January 27, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Category Endpoint
2 participants