Skip to content
Snippets Groups Projects
Commit bc2dd9f8 authored by Ruben Backx's avatar Ruben Backx :coffee:
Browse files

Merge branch 'add-dates-to-editions' into 'development'

Add start and end date to editions (1)

See merge request !21
parents 8e9b1d1a 6d99dbf2
No related branches found
No related tags found
No related merge requests found
......@@ -237,6 +237,7 @@ dependencies {
implementation("org.springframework.boot", "spring-boot-starter-mail", springBootVersion)
implementation("org.springframework.boot", "spring-boot-starter-websocket", springBootVersion)
implementation("org.springframework.boot", "spring-boot-starter-validation", springBootVersion)
implementation("org.springframework.boot", "spring-boot-starter-tomcat", springBootVersion)
implementation("org.springframework", "spring-web", "5.1.13.RELEASE")
implementation("org.springframework.security", "spring-security-messaging", "5.3.3.RELEASE")
......
......@@ -17,6 +17,8 @@
*/
package nl.tudelft.submit.dto.create;
import java.time.LocalDateTime;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
......@@ -28,6 +30,8 @@ import nl.tudelft.labracore.api.dto.CohortIdDTO;
import nl.tudelft.labracore.api.dto.CourseIdDTO;
import nl.tudelft.labracore.api.dto.EditionCreateDTO;
import org.springframework.format.annotation.DateTimeFormat;
@Data
@Builder
@AllArgsConstructor
......@@ -46,6 +50,14 @@ public class SubmitEditionCreateDTO {
@NotNull
private EditionCreateDTO.EnrollabilityEnum enrollability;
@NotNull
@DateTimeFormat(pattern = "dd-MM-yyyy HH:mm")
private LocalDateTime startDate;
@NotNull
@DateTimeFormat(pattern = "dd-MM-yyyy HH:mm")
private LocalDateTime endDate;
@Builder.Default
@NotNull
private Boolean importFromCohort = false;
......
......@@ -119,6 +119,8 @@ edition.total_members = Total members
edition.total_students = Total students
edition.added.title = Your enrolment was successful
edition.added.message = You have successfully been enrolled in {0}.
edition.start_date = Start date
edition.end_date = End date
module.text = Module
module.add = Add new module
......
......@@ -56,6 +56,10 @@
<option th:each="option : ${T(nl.tudelft.labracore.api.dto.EditionCreateDTO.EnrollabilityEnum).values()}"
th:value="${option}" th:text="#{|edition.enrollability.${#strings.toLowerCase(option.name())}|}"></option>
</select>
<label for="edition-start" class="center-label" th:text="#{edition.start_date}"></label>
<input type="text" id="edition-start" class="textfield" th:field="*{startDate}" th:placeholder="${#dates.format(#dates.createNow(), 'dd-MM-yyyy HH:mm')}"/>
<label for="edition-end" class="center-label" th:text="#{edition.end_date}"></label>
<input type="text" id="edition-end" class="textfield" th:field="*{endDate}" th:placeholder="${#dates.format(#dates.createNow(), 'dd-MM-yyyy HH:mm')}"/>
</div>
<div class="form-buttons">
<button class="button" type="submit" th:text="#{generic.save}"></button>
......
......@@ -23,6 +23,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
......@@ -81,6 +82,8 @@ public class EditionControllerTest {
.course(new CourseIdDTO().id(COURSE_ID))
.cohort(new CohortIdDTO().id(4956L))
.enrollability(EditionCreateDTO.EnrollabilityEnum.OPEN)
.startDate(LocalDateTime.now())
.endDate(LocalDateTime.now().plusDays(50L))
.build();
private static final RoleEditionDetailsDTO ROLE_VIEW = new RoleEditionDetailsDTO()
.id(new Id().personId(PERSON_ID).editionId(EDITION_ID))
......@@ -519,6 +522,8 @@ public class EditionControllerTest {
.name(EDITION_CREATE.getName())
.cohort(EDITION_CREATE.getCohort())
.course(EDITION_CREATE.getCourse())
.startDate(EDITION_CREATE.getStartDate())
.endDate(EDITION_CREATE.getEndDate())
.enrollability(EDITION_CREATE.getEnrollability()));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment