-
Notifications
You must be signed in to change notification settings - Fork 4
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
Micro birth plan #14
base: develop
Are you sure you want to change the base?
Micro birth plan #14
Conversation
Warning Rate limit exceeded@SauravBizbRolly has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 56 seconds before requesting another review. β How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. π¦ How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. π Files selected for processing (1)
WalkthroughThis pull request introduces functionalities for managing micro birth plans. A new REST controller provides endpoints to create, retrieve all, and fetch specific micro birth plans by ID. Additionally, a domain entity with JPA mapping, a corresponding DTO, a Spring Data repository, and a service layer (interface and implementation) are added to encapsulate CRUD operations. An existing DTO is also updated with a new Timestamp field ( Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant MC as MicroBirthPlanController
participant S as MicroBirthPlanService
participant R as MicroBirthPlanRepository
C->>MC: POST /saveAll (MicroBirthPlanDTO)
MC->>S: createMicroBirthPlan(MicroBirthPlanDTO)
S->>R: Save/Update each MicroBirthPlan entry
R-->>S: Persisted entry
S-->>MC: MicroBirthPlan
MC-->>C: ResponseEntity with created MicroBirthPlan
sequenceDiagram
participant C as Client
participant MC as MicroBirthPlanController
participant S as MicroBirthPlanService
participant R as MicroBirthPlanRepository
C->>MC: GET /getAll?userId={userId}
MC->>S: getAllMicroBirthPlans(userId)
S->>R: Query micro birth plans by userId
R-->>S: List of MicroBirthPlan
S-->>MC: Map with entries
MC-->>C: ResponseEntity with plan list
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
π§Ή Nitpick comments (9)
src/main/java/com/iemr/flw/dto/iemr/EligibleCoupleDTO.java (1)
108-109
: Use consistent naming convention for the new field.The new field
lmp_Date
uses snake_case with a capital 'D', which is inconsistent with the camelCase naming convention used for all other fields in this class.- private Timestamp lmp_Date; + private Timestamp lmpDate;src/main/java/com/iemr/flw/repo/iemr/MicroBirthPlanRepository.java (2)
7-8
: Remove unused import.The
java.util.List
import is not used in this interface and should be removed.-import java.util.List;
9-11
: Consider using Long as ID type and add finder method.Two recommendations:
- Use Long instead of Integer for consistency with other entity IDs in the system
- Add a dedicated method to find birth plans by userId to improve code readability
@Repository -public interface MicroBirthPlanRepository extends JpaRepository<MicroBirthPlan, Integer> { +public interface MicroBirthPlanRepository extends JpaRepository<MicroBirthPlan, Long> { + List<MicroBirthPlan> findByUserId(Long userId); }src/main/java/com/iemr/flw/service/MicroBirthPlanService.java (2)
5-8
: Remove unused imports.The following imports are not used in this interface and should be removed:
com.iemr.flw.repo.iemr.MicroBirthPlanRepository
lombok.RequiredArgsConstructor
org.springframework.beans.factory.annotation.Autowired
import com.iemr.flw.domain.iemr.MicroBirthPlan; import com.iemr.flw.dto.iemr.MicroBirthPlanDTO; -import com.iemr.flw.repo.iemr.MicroBirthPlanRepository; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
19-22
: Remove unnecessary empty lines.There are several empty lines at the end of the file that should be removed.
Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) ; - - - - }src/main/java/com/iemr/flw/domain/iemr/MicroBirthPlan.java (3)
27-32
: Missing validation for contact numbersThe comments indicate specific validation rules for contact numbers (must be 10 digits, start with 6-9), but there's no validation logic implemented. Consider adding Bean Validation annotations.
@Column(name = "contact_no_1", length = 10) +@Pattern(regexp = "^[6-9]\\d{9}$", message = "Contact number must be 10 digits and start with 6-9") private String contactNo1; // Auto-filled, must be 10 digits, starts with 6-9 @Column(name = "contact_no_2", length = 10) +@Pattern(regexp = "^[6-9]\\d{9}$", message = "Contact number must be 10 digits and start with 6-9") private String contactNo2; // Optional, 10 digits, starts with 6-9
33-68
: Consider adding validation for formatting requirementsSeveral fields have comments indicating specific formatting requirements (e.g., "all caps", "alphabets only"), but there's no validation logic implemented to enforce these requirements.
72-77
: Add created/updated timestamps and remove extra blank linesConsider adding created and updated timestamp fields for auditing purposes. Also, remove the extra blank lines at the end of the class.
@Column(name = "is_synced") private Boolean isSynced; +@Column(name = "created_at") +private Timestamp createdAt; + +@Column(name = "updated_at") +private Timestamp updatedAt; - }src/main/java/com/iemr/flw/service/impl/MicroBirthPlanServiceImpl.java (1)
82-84
: Missing @OverRide annotation for deleteMicroBirthPlanThe
deleteMicroBirthPlan
method is missing the@Override
annotation if it's part of the interface. If it's not part of the interface, consider adding it.+@Override public void deleteMicroBirthPlan(Integer id) { microBirthPlanRepository.deleteById(id); }
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (7)
src/main/java/com/iemr/flw/controller/MicroBirthPlanController.java
(1 hunks)src/main/java/com/iemr/flw/domain/iemr/MicroBirthPlan.java
(1 hunks)src/main/java/com/iemr/flw/dto/iemr/EligibleCoupleDTO.java
(1 hunks)src/main/java/com/iemr/flw/dto/iemr/MicroBirthPlanDTO.java
(1 hunks)src/main/java/com/iemr/flw/repo/iemr/MicroBirthPlanRepository.java
(1 hunks)src/main/java/com/iemr/flw/service/MicroBirthPlanService.java
(1 hunks)src/main/java/com/iemr/flw/service/impl/MicroBirthPlanServiceImpl.java
(1 hunks)
package com.iemr.flw.dto.iemr; | ||
|
||
import com.iemr.flw.domain.iemr.MicroBirthPlan; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
@Data | ||
public class MicroBirthPlanDTO { | ||
Integer userId; | ||
List<MicroBirthPlan> entries; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Add access modifiers and implement Serializable.
The DTO has several issues that should be addressed:
- Fields are missing access modifiers (should be private)
- The class doesn't implement Serializable (unlike other DTOs in the codebase)
- The DTO directly references a domain entity which breaks layer separation
package com.iemr.flw.dto.iemr;
import com.iemr.flw.domain.iemr.MicroBirthPlan;
import lombok.Data;
import java.util.List;
+import java.io.Serializable;
@Data
-public class MicroBirthPlanDTO {
- Integer userId;
- List<MicroBirthPlan> entries;
+public class MicroBirthPlanDTO implements Serializable {
+ private Long userId;
+ private List<MicroBirthPlanDTO.Entry> entries;
+
+ @Data
+ public static class Entry implements Serializable {
+ // Add all necessary fields from MicroBirthPlan entity
+ private Integer id;
+ // Other fields from MicroBirthPlan
+ }
}
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
package com.iemr.flw.dto.iemr; | |
import com.iemr.flw.domain.iemr.MicroBirthPlan; | |
import lombok.Data; | |
import java.util.List; | |
@Data | |
public class MicroBirthPlanDTO { | |
Integer userId; | |
List<MicroBirthPlan> entries; | |
} | |
package com.iemr.flw.dto.iemr; | |
import com.iemr.flw.domain.iemr.MicroBirthPlan; | |
import lombok.Data; | |
import java.util.List; | |
import java.io.Serializable; | |
@Data | |
public class MicroBirthPlanDTO implements Serializable { | |
private Long userId; | |
private List<MicroBirthPlanDTO.Entry> entries; | |
@Data | |
public static class Entry implements Serializable { | |
// Add all necessary fields from MicroBirthPlan entity | |
private Integer id; | |
// Other fields from MicroBirthPlan | |
} | |
} |
@Service | ||
public interface MicroBirthPlanService { | ||
public MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan); | ||
public List<MicroBirthPlan> getAllMicroBirthPlans(Integer userId); | ||
public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) ; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Service annotation should be on implementation, not interface.
Several issues need addressing:
- The
@Service
annotation should be on implementation classes, not interfaces - Interface methods are implicitly public, so the
public
modifier is redundant - For consistency with other entities, consider using
Long
instead ofInteger
for IDs
-@Service
public interface MicroBirthPlanService {
- public MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan);
- public List<MicroBirthPlan> getAllMicroBirthPlans(Integer userId);
- public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) ;
+ MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan);
+ List<MicroBirthPlan> getAllMicroBirthPlans(Long userId);
+ Optional<MicroBirthPlan> getMicroBirthPlanById(Long id);
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@Service | |
public interface MicroBirthPlanService { | |
public MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan); | |
public List<MicroBirthPlan> getAllMicroBirthPlans(Integer userId); | |
public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) ; | |
public interface MicroBirthPlanService { | |
MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan); | |
List<MicroBirthPlan> getAllMicroBirthPlans(Long userId); | |
Optional<MicroBirthPlan> getMicroBirthPlanById(Long id); | |
} |
@Column(name = "user_id") | ||
private Integer UserId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Inconsistent naming convention for 'UserId'
The field UserId
is using Pascal case while all other fields in the class use camel case. This is inconsistent with Java naming conventions.
@Column(name = "user_id")
-private Integer UserId;
+private Integer userId;
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@Column(name = "user_id") | |
private Integer UserId; | |
@Column(name = "user_id") | |
private Integer userId; |
|
||
@RequestMapping(value = "getAll",method = RequestMethod.GET) | ||
public ResponseEntity<Map<String, Object>> getAllMicroBirthPlans(@Param("userId")Integer userId) { | ||
Map<String, Object> response = new HashMap<>(); | ||
response.put("entries",service.getMicroBirthPlanById(userId)); | ||
|
||
return ResponseEntity.ok(response); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method name inconsistent with implementation
The method getAllMicroBirthPlans
actually calls getMicroBirthPlanById(userId)
which is incorrect. It should call getAllMicroBirthPlans(userId)
to match the method name and expected behavior.
@RequestMapping(value = "getAll",method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> getAllMicroBirthPlans(@Param("userId")Integer userId) {
Map<String, Object> response = new HashMap<>();
- response.put("entries",service.getMicroBirthPlanById(userId));
+ response.put("entries",service.getAllMicroBirthPlans(userId));
return ResponseEntity.ok(response);
}
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@RequestMapping(value = "getAll",method = RequestMethod.GET) | |
public ResponseEntity<Map<String, Object>> getAllMicroBirthPlans(@Param("userId")Integer userId) { | |
Map<String, Object> response = new HashMap<>(); | |
response.put("entries",service.getMicroBirthPlanById(userId)); | |
return ResponseEntity.ok(response); | |
} | |
@RequestMapping(value = "getAll",method = RequestMethod.GET) | |
public ResponseEntity<Map<String, Object>> getAllMicroBirthPlans(@Param("userId")Integer userId) { | |
Map<String, Object> response = new HashMap<>(); | |
response.put("entries",service.getAllMicroBirthPlans(userId)); | |
return ResponseEntity.ok(response); | |
} |
@RequestMapping(value = "getAllMicroBirthPlansBy{id}",method = RequestMethod.GET) | ||
public ResponseEntity<MicroBirthPlan> getMicroBirthPlanById(@PathVariable Integer id) { | ||
return service.getMicroBirthPlanById(id) | ||
.map(ResponseEntity::ok) | ||
.orElse(ResponseEntity.notFound().build()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Endpoint naming inconsistency
The endpoint path getAllMicroBirthPlansBy{id}
doesn't follow standard REST conventions. It would be clearer as /{id}
since it's getting a single resource by ID.
-@RequestMapping(value = "getAllMicroBirthPlansBy{id}",method = RequestMethod.GET)
+@RequestMapping(value = "/{id}",method = RequestMethod.GET)
public ResponseEntity<MicroBirthPlan> getMicroBirthPlanById(@PathVariable Integer id) {
return service.getMicroBirthPlanById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@RequestMapping(value = "getAllMicroBirthPlansBy{id}",method = RequestMethod.GET) | |
public ResponseEntity<MicroBirthPlan> getMicroBirthPlanById(@PathVariable Integer id) { | |
return service.getMicroBirthPlanById(id) | |
.map(ResponseEntity::ok) | |
.orElse(ResponseEntity.notFound().build()); | |
} | |
@RequestMapping(value = "/{id}",method = RequestMethod.GET) | |
public ResponseEntity<MicroBirthPlan> getMicroBirthPlanById(@PathVariable Integer id) { | |
return service.getMicroBirthPlanById(id) | |
.map(ResponseEntity::ok) | |
.orElse(ResponseEntity.notFound().build()); | |
} |
@RestController | ||
@RequestMapping(value = "/micro-birthPlan",headers = "Authorization", produces = "application/json") | ||
public class MicroBirthPlanController { | ||
@Autowired | ||
private MicroBirthPlanService service; | ||
@CrossOrigin() | ||
@Operation(summary = "Micro BirthPlan") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Incomplete Operation annotation and security considerations
The @Operation
annotation is missing a description. Also, the @CrossOrigin()
annotation without parameters allows requests from any origin, which might pose security risks.
@RestController
@RequestMapping(value = "/micro-birthPlan",headers = "Authorization", produces = "application/json")
public class MicroBirthPlanController {
@Autowired
private MicroBirthPlanService service;
- @CrossOrigin()
- @Operation(summary = "Micro BirthPlan")
+ @CrossOrigin(origins = "${allowed.origins}")
+ @Operation(summary = "Micro BirthPlan", description = "API endpoints for creating and managing micro birth plans")
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@RestController | |
@RequestMapping(value = "/micro-birthPlan",headers = "Authorization", produces = "application/json") | |
public class MicroBirthPlanController { | |
@Autowired | |
private MicroBirthPlanService service; | |
@CrossOrigin() | |
@Operation(summary = "Micro BirthPlan") | |
@RestController | |
@RequestMapping(value = "/micro-birthPlan", headers = "Authorization", produces = "application/json") | |
public class MicroBirthPlanController { | |
@Autowired | |
private MicroBirthPlanService service; | |
@CrossOrigin(origins = "${allowed.origins}") | |
@Operation(summary = "Micro BirthPlan", description = "API endpoints for creating and managing micro birth plans") |
public List<MicroBirthPlan> getAllMicroBirthPlans(Integer userId) { | ||
return microBirthPlanRepository.findAll().stream().filter(microBirthPlan -> Objects.equals(microBirthPlan.getUserId(), userId)).collect(Collectors.toList()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Inefficient implementation of getAllMicroBirthPlans
The current implementation fetches all records from the database and then filters them in memory. This is inefficient and will not scale well. Use a repository method that directly queries for records with the specified userId.
@Override
public List<MicroBirthPlan> getAllMicroBirthPlans(Integer userId) {
- return microBirthPlanRepository.findAll().stream().filter(microBirthPlan -> Objects.equals(microBirthPlan.getUserId(), userId)).collect(Collectors.toList());
+ return microBirthPlanRepository.findByUserId(userId);
}
You'll need to add this method to the repository:
List<MicroBirthPlan> findByUserId(Integer userId);
@Override | ||
public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) { | ||
return Optional.empty(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unimplemented getMicroBirthPlanById method
The getMicroBirthPlanById
method returns an empty Optional instead of fetching the actual data from the repository.
@Override
public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) {
- return Optional.empty();
+ return microBirthPlanRepository.findById(id);
}
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@Override | |
public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) { | |
return Optional.empty(); | |
} | |
@Override | |
public Optional<MicroBirthPlan> getMicroBirthPlanById(Integer id) { | |
return microBirthPlanRepository.findById(id); | |
} |
public MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan) { | ||
MicroBirthPlan microBirthPlan = null; | ||
|
||
for (MicroBirthPlan entry : birthPlan.getEntries()) { | ||
// Check if the entry already exists in the database | ||
Optional<MicroBirthPlan> existingEntry = microBirthPlanRepository.findById(entry.getId()); | ||
|
||
if (existingEntry.isPresent()) { | ||
updateMicroBirthPlan(entry.getId(),microBirthPlan); | ||
continue; | ||
} | ||
|
||
// Set user ID and prepare for saving | ||
entry.setUserId(birthPlan.getUserId()); | ||
microBirthPlan = microBirthPlanRepository.save(entry); | ||
} | ||
|
||
return microBirthPlan; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical issue in createMicroBirthPlan method
There are several issues with this method:
- The
microBirthPlan
variable is initialized as null but then passed toupdateMicroBirthPlan()
. - The method only returns the last processed entry, not all entries that were processed.
- No transaction management is being used for batch operations.
@Override
public MicroBirthPlan createMicroBirthPlan(MicroBirthPlanDTO birthPlan) {
- MicroBirthPlan microBirthPlan = null;
+ MicroBirthPlan lastProcessedPlan = null;
for (MicroBirthPlan entry : birthPlan.getEntries()) {
// Check if the entry already exists in the database
Optional<MicroBirthPlan> existingEntry = microBirthPlanRepository.findById(entry.getId());
if (existingEntry.isPresent()) {
- updateMicroBirthPlan(entry.getId(),microBirthPlan);
+ lastProcessedPlan = updateMicroBirthPlan(entry.getId(), entry);
continue;
}
// Set user ID and prepare for saving
entry.setUserId(birthPlan.getUserId());
- microBirthPlan = microBirthPlanRepository.save(entry);
+ lastProcessedPlan = microBirthPlanRepository.save(entry);
}
- return microBirthPlan;
+ return lastProcessedPlan;
}
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
π§Ή Nitpick comments (1)
src/main/java/com/iemr/flw/controller/MicroBirthPlanController.java (1)
24-25
: Consider aligning the endpoint name with the returned resource type.Currently, the endpoint path is
"saveAll"
while the controller method and service call return a singleMicroBirthPlan
object, which can be misleading. Consider renaming the endpoint to something like"/create"
or"/save"
to accurately reflect that it handles a single resource instead of a collection.Apply this diff to rename the endpoint:
-@RequestMapping(value = "saveAll",method = RequestMethod.POST) +@RequestMapping(value = "/create", method = RequestMethod.POST)
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (1)
src/main/java/com/iemr/flw/controller/MicroBirthPlanController.java
(1 hunks)
π Additional comments (3)
src/main/java/com/iemr/flw/controller/MicroBirthPlanController.java (3)
31-34
: Method name inconsistent with implementation.
You are retrieving a single micro birth plan by user ID (service.getMicroBirthPlanById(userId)
) rather than all micro birth plans. This was raised in a previous review.Consider updating the code and/or method names to match the functionality:
response.put("entries", - service.getMicroBirthPlanById(userId)); + service.getAllMicroBirthPlans(userId));
39-44
: Endpoint naming inconsistency.
The endpointgetAllMicroBirthPlansBy{id}
suggests multiple resources but actually returns a single plan by ID. A REST convention for fetching one item by ID would be"/{id}"
. This was mentioned in a previous review.Here is the suggested fix:
-@RequestMapping(value = "getAllMicroBirthPlansBy{id}",method = RequestMethod.GET) +@RequestMapping(value = "/{id}",method = RequestMethod.GET)
21-22
: Refactor security and documentation annotations.
You still have a broad@CrossOrigin()
without restrictions and lack a detaileddescription
in the@Operation
annotation. This was highlighted in an earlier review.Consider refining your CORS policy and enhancing the OpenAPI documentation, for instance:
-@CrossOrigin() -@Operation(summary = "Micro BirthPlan") +@CrossOrigin(origins = "${allowed.origins}") +@Operation(summary = "Micro BirthPlan", description = "API endpoints for creating and managing micro birth plans")
π Description
JIRA ID:
Micro birth plan
β Type of Change
βΉοΈ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit