Skip to content

Commit

Permalink
refactor: new-reservation.js 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
haeyoon1 committed Dec 10, 2024
1 parent fb70989 commit 551b7a8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/java/roomescape/dao/ReservationDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public Reservation insert(Reservation reservation) {

String query = "SELECT id FROM reservation ORDER BY id DESC LIMIT 1";
Long id = jdbcTemplate.queryForObject(query, Long.class);
//
return new Reservation(id, reservation.getName(), reservation.getDate(), reservation.getTime().getTime());

return new Reservation(id, reservation.getName(), reservation.getDate(), reservation.getTime());
}

public void delete(Long id) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/roomescape/dto/TimeRequestDto.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package roomescape.dto;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class TimeRequestDto {
private String time;

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/roomescape/service/ReservationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import roomescape.repository.ReservationRepository;
import roomescape.repository.TimeRepository;

import java.time.DateTimeException;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/static/js/new-reservation.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ function renderReservations(data) {
}

function insertReservationRow(row, reservation) {
['id', 'name', 'date'].forEach((field, index) => {
['id', 'name', 'date', 'time'].forEach((field, index) => {
row.insertCell(index).textContent = reservation[field];
});

row.insertCell(3).textContent = reservation.time.time;
row.insertCell(4).textContent = reservation.time.time;

const actionCell = row.insertCell(4);
const actionCell = row.insertCell(5);
actionCell.appendChild(createActionButton('삭제', 'btn-danger', deleteRow));
}

Expand Down

0 comments on commit 551b7a8

Please sign in to comment.