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 Society API #10

Merged
merged 2 commits into from
Feb 13, 2024
Merged

Add Society API #10

merged 2 commits into from
Feb 13, 2024

Conversation

chrisvrose
Copy link
Member

@chrisvrose chrisvrose commented Feb 13, 2024

Summary

Added a Society API and convenience configurations.

Changes

  • Created required CRUD apis for Society.

  • Added the modelmapper dependency. This allows us to use DTOs so that we can define what fields are taken as input (and not just the whole entity.

    • Modelmapper copies the matching properties from the DTO to the actual entity class.
  • Updated society field isActive to active. This is because the getter can be isActive, and still make sense.

  • Update the society entity to have createdAt and updatedAt. These values will be automatically set by Hibernate, as required.

  • Added an ItemNotFoundException. When this error is thrown, this will automatically map to a 404 response.

@chrisvrose chrisvrose self-assigned this Feb 13, 2024
@chrisvrose chrisvrose linked an issue Feb 13, 2024 that may be closed by this pull request
Copy link
Member

@Prajwalprakash3722 Prajwalprakash3722 left a comment

Choose a reason for hiding this comment

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

LGTM, would be better to have standard api response

}

@GetMapping
public List<Society> list(){
Copy link
Member

Choose a reason for hiding this comment

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

Is there a standardized format for data return, such as ResultDTO?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought of that, but decided to not since current API design so far isn't using it either.

In retrospect, it is much more standard to check the response code than the "ok" field.

Copy link
Member

Choose a reason for hiding this comment

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

It would make much more sense to have consistent data return across all end point.

Copy link
Member

@SundarakrishnanN SundarakrishnanN left a comment

Choose a reason for hiding this comment

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

Looks great!

@SundarakrishnanN SundarakrishnanN merged commit 2773679 into master Feb 13, 2024
2 checks passed
@chrisvrose chrisvrose deleted the society-api branch February 13, 2024 09:57
@Prajwalprakash3722 Prajwalprakash3722 linked an issue Feb 13, 2024 that may be closed by this pull request
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.

Society API Implement CRUD routes for Societies Table
3 participants