Get asset by id endpoint and user profile photo coloumn update #471
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.
Implement
GET /api/assets/{id}
Endpoint for Retrieving Asset by IDDescription:
This pull request adds the
GET /api/assets/{id}
endpoint to theTradeverse
application, enabling retrieval of asset details by their unique ID. The implementation adheres to RESTful standards and handles missing resources gracefully.Changes Implemented:
Controller Layer:
getAssetById
method inAssetController
to handle requests to fetch asset details by ID.200 OK
with asset details when found.404 Not Found
when the asset does not exist.Service Layer:
getAssetById
method inAssetService
to retrieve asset details using the repository layer.RuntimeException
for missing assets (or can returnnull
if exceptions are avoided).Repository Layer:
findById
method fromJpaRepository
for efficient asset retrieval.Error Handling:
404 Not Found
for missing assets without using custom exceptions.Testing:
200 OK
).404 Not Found
.Endpoint Summary:
GET /api/assets/{id}
200 OK
: Returns the asset details in JSON format.404 Not Found
: No asset exists for the provided ID.Example Response: