Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ repositories {
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.rest-assured:rest-assured:5.3.1'
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/roomescape/MissionController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package roomescape;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class MissionController {

@GetMapping("/")
public String index(){
return "home";
}
}
23 changes: 23 additions & 0 deletions src/main/java/roomescape/ReservationController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package roomescape;

import java.util.ArrayList;
import java.util.List;

import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class ReservationController {
@GetMapping("/reservation")
public String getReservations(Model model) {
List<Reservations> reservations = new ArrayList<>();
reservations.add (new Reservations(1L,"브라운","2023-01-01","10:00"));
reservations.add (new Reservations(2L,"브라운","2023-01-02","10:00"));
reservations.add (new Reservations(3L,"브라운","2023-01-03","10:00"));

model.addAttribute("reservations", reservations);
return "reservation";
}

}
34 changes: 34 additions & 0 deletions src/main/java/roomescape/Reservations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package roomescape;

public class Reservations {
private Long id;
private String name;
private String date;
private String time;


public Reservations(String id, String name, String date, String time) {
this.id = Long.parseLong(id);
this.name = name;
this.date = date;
this.time = time;
}

public Reservations(Long id, String name, String date, String time) {
this.id = id;
this.name = name;
this.date = date;
this.time = time;
}

public Long getId() { return id; }
public String getName() { return name; }
public String getDate() { return date; }
public String getTime() { return time; }

public void setId(Long id) { this.id = id; }
public void setName(String name) { this.name = name; }
public void setDate(String date) { this.date = date; }
public void setTime(String time) { this.time = time; }

}
6 changes: 6 additions & 0 deletions src/main/resources/templates/reservation.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ <h1>예약 관리</h1>
</tr>
</thead>
<tbody id="reservation-table-body">
<tr th:each="res : ${reservations}">
<td th:text="${res.id}"></td>
<td th:text="${res.name}"></td>
<td th:text="${res.date}"></td>
<td th:text="${res.time}"></td>
</tr>
</tbody>
</table>
</div>
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/roomescape/MissionStepTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ public class MissionStepTest {
.then().log().all()
.statusCode(200);
}

@Test
void 이단계() {
RestAssured.given().log().all()
.when().get("/reservation")
.then().log().all()
.statusCode(200);

RestAssured.given().log().all()
.when().get("/reservation")
.then().log().all()
.statusCode(200);

}
}