preparing for adding positions to document
This commit is contained in:
@@ -20,6 +20,7 @@ public class Constants {
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String DOMAIN = "domain";
|
||||
public static final String DUE_DATE = "due_date";
|
||||
public static final String DURATION = "duration";
|
||||
public static final String EMAIL = "email";
|
||||
public static final String END_TIME = "end_time";
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@ import java.util.Collection;
|
||||
public interface TaskService {
|
||||
CompanyService companyService();
|
||||
Collection<Task> listCompanyTasks(long companyId) throws UmbrellaException;
|
||||
Collection<Task> listProjectTasks(long projectId) throws UmbrellaException;
|
||||
|
||||
ProjectService projectService();
|
||||
|
||||
UserService userService();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.model;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Util.dateTimeOf;
|
||||
import static de.srsoftware.umbrella.core.Util.markdown;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@@ -59,18 +60,15 @@ public class Time implements Mappable{
|
||||
this.taskIds = taskIds;
|
||||
}
|
||||
|
||||
public long id(){
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
var map = new HashMap<String,Object>();
|
||||
map.put(ID,id);
|
||||
map.put(USER_ID,userId);
|
||||
map.put(SUBJECT,subject);
|
||||
map.put(DESCRIPTION,description);
|
||||
map.put(START_TIME,start);
|
||||
map.put(END_TIME,end);
|
||||
map.put(STATE,Map.of(STATUS_CODE,state.code,NAME,state.name()));
|
||||
return map;
|
||||
public boolean isClosed() {
|
||||
return switch (state){
|
||||
case Complete, Cancelled -> true;
|
||||
case null, default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
public static Time of(ResultSet rs) throws SQLException {
|
||||
@@ -90,4 +88,26 @@ public class Time implements Mappable{
|
||||
new HashSet<>()
|
||||
);
|
||||
}
|
||||
|
||||
public LocalDateTime start(){
|
||||
return start;
|
||||
}
|
||||
|
||||
public Collection<Long> taskIds(){
|
||||
return taskIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
var map = new HashMap<String,Object>();
|
||||
map.put(ID,id);
|
||||
map.put(USER_ID,userId);
|
||||
map.put(SUBJECT,subject);
|
||||
map.put(DESCRIPTION,Map.of(SOURCE,description,RENDERED,markdown(description)));
|
||||
map.put(START_TIME,start.toString().replace("T"," "));
|
||||
map.put(END_TIME,end.toString().replace("T"," "));
|
||||
map.put(STATE,Map.of(STATUS_CODE,state.code,NAME,state.name()));
|
||||
map.put(DURATION,Duration.between(start,end).toMinutes()/60d);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user