Skip to content

Commit 8391313

Browse files
author
Piotr Kubicki
committed
chore: add TODO
1 parent 5e29286 commit 8391313

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

api/openapi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ components:
184184
type: object
185185
properties:
186186
id:
187-
type: string
188-
format: uuid
187+
type: string # TODO integer
188+
format: uuid # TODO int64 -> Krzysztof - change uuid to integer or something better suited for long for Long id of Entity. Change all uuid and resign from getMostSignificantBits everywhere
189189
name:
190190
type: string
191191
duration:

src/main/java/com/capgemini/training/appointmentbooking/dataaccess/repository/AppointmentRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ SELECT CASE WHEN COUNT(a) > 0 THEN TRUE ELSE FALSE END
7878
WHERE t.specialist.id = :specialistId
7979
AND a.dateTime = :date
8080
AND a.status <> com.capgemini.training.appointmentbooking.common.datatype.AppointmentStatus.CANCELLED
81-
""")
81+
""") // TODO add checks for TreatmentEntity#durationMinutes so that within treatment time no more appoinments can be booked
8282
boolean hasConflictingAppointmentBySpecialistIdAndDateTime(@Param("specialistId") Long specialistId, @Param("date") Instant date);
8383

8484
}

src/main/java/com/capgemini/training/appointmentbooking/dataaccess/repository/UserRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@Repository
1717
public interface UserRepository extends BaseJpaRepository<UserEntity, Long> {
18-
default List<UserEntity> findByCriteria(UserCriteria criteria) {
18+
default List<UserEntity> findByCriteria(UserCriteria criteria) { // TODO openapi change ? -> szukanie po clientach do stworzenia appointmentów
1919
Objects.requireNonNull(criteria, "criteria must not be null");
2020

2121
EntityManager entityManager = getEntityManager();

src/main/java/com/capgemini/training/appointmentbooking/logic/impl/ManageAppointmentUcImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public ManageAppointmentUcImpl(FindAppointmentUc findAppointmentUc, AppointmentR
5353
@Override
5454
public AppointmentCto bookAppointment(@Valid AppointmentBookingEto appointmentBookingEto) {
5555
boolean hasConflict = findAppointmentUc.hasConflictingAppointment(appointmentBookingEto.specialistId(), appointmentBookingEto.dateTime());
56-
56+
// TODO Michał will add hints regarding pessimistic locking in exercise for logic
5757
if (hasConflict) {
5858
throw new ConflictedAppointmentException();
5959
}
6060

6161
AppointmentEntity appointmentEntity = buildAppointmentEntity(appointmentBookingEto);
62-
appointmentEntity = appointmentRepository.saveAndFlush(appointmentEntity);
62+
appointmentEntity = appointmentRepository.saveAndFlush(appointmentEntity); // TODO Piotr save
6363

6464
return appointmentCtoMapper.toCto(appointmentEntity);
6565
}
@@ -71,15 +71,15 @@ public AppointmentEto updateAppointmentStatus(@NotNull Long appointmentId, @NotN
7171
.orElseThrow(() -> new EntityNotFoundException("Appointment not found for ID: " + appointmentId));
7272

7373
appointmentEntity.setStatus(appointmentStatus);
74-
appointmentEntity = appointmentRepository.saveAndFlush(appointmentEntity);
74+
appointmentEntity = appointmentRepository.saveAndFlush(appointmentEntity); // TODO Piotr save
7575

7676
return appointmentMapper.toEto(appointmentEntity);
7777
}
7878

7979
private AppointmentEntity buildAppointmentEntity(@Valid AppointmentBookingEto appointmentBookingEto) {
8080
AppointmentEntity entity = new AppointmentEntity();
8181

82-
ClientEntity clientEntity = clientRepository.getReferenceById(appointmentBookingEto.clientId());
82+
ClientEntity clientEntity = clientRepository.getReferenceById(appointmentBookingEto.clientId()); // TODO change getReferenceById to find
8383
TreatmentEntity treatmentEntity = treatmentRepository.getReferenceById(appointmentBookingEto.treatmentId());
8484

8585
entity.setClient(clientEntity);

src/main/java/com/capgemini/training/appointmentbooking/service/impl/AppointmentsApiController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ResponseEntity<List<Appointment>> getAppointments(
4545
AppointmentCriteria.AppointmentCriteriaBuilder criteria = AppointmentCriteria.builder();
4646
status.ifPresent(t -> criteria.status(AppointmentStatus.valueOf(t)));
4747
clientId.ifPresent(t -> criteria.clientId(UUID.fromString(t).getMostSignificantBits()));
48-
specialistId.ifPresent(t -> criteria.specialistId(UUID.fromString(t).getMostSignificantBits()));
48+
specialistId.ifPresent(t -> criteria.specialistId(UUID.fromString(t).getMostSignificantBits())); // TODO Krzysztof resign from getMostSignificantBits everywhere, instewad of uuid we want integer
4949

5050
List<AppointmentCto> list = findAppointmentUc.findByCriteria(criteria.build());
5151
List<Appointment> result =

0 commit comments

Comments
 (0)