feat: tests and crud functionality for api #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
AuthorController
class, adds methods to thePostController
class, and updates thePostRepository
interface. Additionally, it includes new test cases for theAuthorController
andPostController
classes. Below are the most important changes:New Features:
New
AuthorController
class:AuthorController
class with agetAuthors
endpoint to return a sample list of authors. (src/main/java/com/liatrio/dojo/devopsknowledgeshareapi/AuthorController.java
)New methods in
PostController
:getPostsByTitle
,getPostsByFirstName
, andgetPostsByLink
methods to fetch posts based on title, first name, and link respectively. (src/main/java/com/liatrio/dojo/devopsknowledgeshareapi/PostController.java
)putPost
method to update an existing post by its ID. (src/main/java/com/liatrio/dojo/devopsknowledgeshareapi/PostController.java
)Repository Updates:
PostRepository
:findByTitle
,findByFirstName
, andfindByLink
to thePostRepository
interface. (src/main/java/com/liatrio/dojo/devopsknowledgeshareapi/PostRepository.java
)Model Updates:
Post
class:dateUpdated
field along with its getter and setter methods. (src/main/java/com/liatrio/dojo/devopsknowledgeshareapi/Post.java
)Tests:
New tests for
AuthorController
:AuthorControllerTest
class to test thegetAuthors
endpoint. (src/test/java/com/liatrio/dojo/devopsknowledgeshareapi/AuthorControllerTest.java
)New tests for
PostController
:getPostsByTitle
,getPostsByFirstName
, andgetPostsByLink
methods. (src/test/java/com/liatrio/dojo/devopsknowledgeshareapi/PostControllerTest.java
)New tests for
Post
class:setDateUpdated
andgetDateUpdated
methods. (src/test/java/com/liatrio/dojo/devopsknowledgeshareapi/PostTest.java
)