Skip to content

Commit

Permalink
[test]
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyeon330 committed Sep 14, 2023
1 parent 134712f commit be2fffc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ List<ConferenceRoom> findAllByDateAndAfterNow(@Param("date") LocalDate date,
"order by reservation_info asc",
nativeQuery = true)
List<ConferenceRoom> findAllByPlaceAndAfterNow(@Param("date") LocalDate date,
@Param("placeInfo") Long placeInfo,
@Param("timeBit") Long timeBit);
@Param("placeInfo") Long placeInfo,
@Param("timeBit") Long timeBit);

// 내 폼중에 내가 신청한 폼과 같은 시간대에 있는 애들
// 내가 신청한 폼과 같은 위치의 애들
Expand All @@ -40,9 +40,10 @@ List<ConferenceRoom> findAllByPlaceAndAfterNow(@Param("date") LocalDate date,
"and ((reservation_info & :reqPlaceInfoBit) = :reqPlaceInfoBit " +
"or (user_id = :userId and (reservation_info & :reqTimeBit) > 0))",
nativeQuery = true)
List<ConferenceRoom> findByDateAndSamePlaceOrMySameTime(@Param("userId") Long userId, @Param("date") LocalDate date,
@Param("reqPlaceInfoBit") Long reqPlaceInfoBit,
@Param("reqTimeBit") Long reqTimeBit);
List<ConferenceRoom> findByDateAndSamePlaceOrMySameTime(@Param("userId") Long userId,
@Param("date") LocalDate date,
@Param("reqPlaceInfoBit") Long reqPlaceInfoBit,
@Param("reqTimeBit") Long reqTimeBit);

@Query("DELETE FROM ConferenceRoom c WHERE c.date < :oneWeek")
void deleteAllByDateBeforeOneWeek(@Param("oneWeek") LocalDate oneWeek);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/check_in42/backend/tablet/TabletController.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public class TabletController {
@GetMapping("reservations/{place}")
public ResponseEntity<TabletDTO> reservations(@PathVariable(name = "place") final String roomName) {
TabletDTO tabletDTO = new TabletDTO(tabletService
.findAllByPlaceAndNowOver(LocalDate.now(), Rooms.valueOf(roomName).getRoomBit(), ConferenceUtil.getAfterTimeBit(
ConferenceUtil.getTimeIdx(LocalDateTime.now().withDayOfMonth(15).withHour(10).withMinute(30))
.findAllByPlaceAndNowOver(LocalDate.now().withDayOfMonth(15), Rooms.valueOf(roomName).getRoomBit(), ConferenceUtil.getAfterTimeBit(
ConferenceUtil.getTimeIdx(LocalDateTime.now().withHour(10).withMinute(30))
)));
return ResponseEntity.ok(tabletDTO);
}

@PostMapping("check-in")
public ResponseEntity updateState(@RequestBody ConferenceRoomDTO conferenceRoomDTO) {
tabletService.updateState(conferenceRoomDTO.getFormId());
tabletService.updateTime(conferenceRoomDTO.getFormId());
return ResponseEntity.ok(HttpStatus.OK);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/check_in42/backend/tablet/TabletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public List<ConferenceRoomDTO> findAllByPlaceAndNowOver(LocalDate date, Long pla
}

@Transactional
public void updateState(Long formId) {
public void updateTime(Long formId) {
conferenceRoomService.findOne(formId).setCheckInTime(LocalDateTime.now());
}
}

0 comments on commit be2fffc

Please sign in to comment.