api issue
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package fr.bonsai.api.domain.model;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Bonsai {
|
||||
|
||||
private final UUID id;
|
||||
private String name;
|
||||
private String species;
|
||||
private int ageYears;
|
||||
|
||||
public Bonsai(UUID id, String name, String species, int ageYears) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.species = species;
|
||||
this.ageYears = ageYears;
|
||||
}
|
||||
|
||||
public static Bonsai create(String name, String species, int ageYears) {
|
||||
return new Bonsai(UUID.randomUUID(), name, species, ageYears);
|
||||
}
|
||||
|
||||
public UUID getId() { return id; }
|
||||
public String getName() { return name; }
|
||||
public String getSpecies() { return species; }
|
||||
public int getAgeYears() { return ageYears; }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package fr.bonsai.api.domain.model;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class Comment {
|
||||
|
||||
private final Long id;
|
||||
private final String text;
|
||||
private final Instant createdAt;
|
||||
private final Instant updatedAt;
|
||||
|
||||
public Comment(Long id, String text, Instant createdAt, Instant updatedAt) {
|
||||
this.id = id;
|
||||
this.text = text;
|
||||
this.createdAt = createdAt;
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public String getText() { return text; }
|
||||
public Instant getCreatedAt() { return createdAt; }
|
||||
public Instant getUpdatedAt() { return updatedAt; }
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package fr.bonsai.api.domain.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class Issue {
|
||||
|
||||
private final Long id;
|
||||
private final IssueType type;
|
||||
private final String assignee;
|
||||
private final String epic;
|
||||
private final String name;
|
||||
private final LocalDate dueDate;
|
||||
private final String description;
|
||||
private final Double estimatedTime;
|
||||
private final List<Long> dependsOnIds;
|
||||
private final List<Comment> comments;
|
||||
private final Priority priority;
|
||||
private final IssueStatus status;
|
||||
private final int progress;
|
||||
|
||||
public Issue(Long id, IssueType type, String assignee, String epic, String name,
|
||||
LocalDate dueDate, String description, Double estimatedTime,
|
||||
List<Long> dependsOnIds, List<Comment> comments,
|
||||
Priority priority, IssueStatus status, int progress) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.assignee = assignee;
|
||||
this.epic = epic;
|
||||
this.name = name;
|
||||
this.dueDate = dueDate;
|
||||
this.description = description;
|
||||
this.estimatedTime = estimatedTime;
|
||||
this.dependsOnIds = dependsOnIds;
|
||||
this.comments = comments;
|
||||
this.priority = priority;
|
||||
this.status = status;
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public IssueType getType() { return type; }
|
||||
public String getAssignee() { return assignee; }
|
||||
public String getEpic() { return epic; }
|
||||
public String getName() { return name; }
|
||||
public LocalDate getDueDate() { return dueDate; }
|
||||
public String getDescription() { return description; }
|
||||
public Double getEstimatedTime() { return estimatedTime; }
|
||||
public List<Long> getDependsOnIds() { return dependsOnIds; }
|
||||
public List<Comment> getComments() { return comments; }
|
||||
public Priority getPriority() { return priority; }
|
||||
public IssueStatus getStatus() { return status; }
|
||||
public int getProgress() { return progress; }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package fr.bonsai.api.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum IssueStatus {
|
||||
DRAFT("draft"),
|
||||
TODO("todo"),
|
||||
IN_PROGRESS("in-progress"),
|
||||
DONE("done");
|
||||
|
||||
private final String value;
|
||||
|
||||
IssueStatus(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static IssueStatus fromValue(String value) {
|
||||
return Arrays.stream(values())
|
||||
.filter(s -> s.value.equals(value))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Unknown IssueStatus: " + value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package fr.bonsai.api.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum IssueType {
|
||||
EPIC("Epic"),
|
||||
BUG("Bug"),
|
||||
STUDY("Study"),
|
||||
STORY("Story"),
|
||||
TASK("Task"),
|
||||
TECHNICAL_STORY("Technical Story");
|
||||
|
||||
private final String value;
|
||||
|
||||
IssueType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static IssueType fromValue(String value) {
|
||||
return Arrays.stream(values())
|
||||
.filter(t -> t.value.equals(value))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Unknown IssueType: " + value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package fr.bonsai.api.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum Priority {
|
||||
BASSE("Basse"),
|
||||
MOYENNE("Moyenne"),
|
||||
HAUTE("Haute");
|
||||
|
||||
private final String value;
|
||||
|
||||
Priority(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static Priority fromValue(String value) {
|
||||
return Arrays.stream(values())
|
||||
.filter(p -> p.value.equals(value))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Unknown Priority: " + value));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user