remove builder from TrendDetectionDTO so that trendConnotation can be calculated in constructor
This commit is contained in:
@@ -2,13 +2,11 @@ package SuMoC.backend.trend.dto;
|
||||
|
||||
import SuMoC.backend.notification.interfaces.Notifieable;
|
||||
import SuMoC.backend.trend.enums.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TrendDetectionDTO implements Notifieable {
|
||||
private Long userId;
|
||||
private TrendTimespan timespan;
|
||||
@@ -16,16 +14,20 @@ public class TrendDetectionDTO implements Notifieable {
|
||||
private StatAttribute attribute;
|
||||
private DeltaType deltaType;
|
||||
private double changeValue;
|
||||
private TrendConnotation trendConnotation;
|
||||
|
||||
public TrendDetectionDTO(Long userId, TrendTimespan timespan, TrendType type, StatAttribute attribute, DeltaType deltaType, double changeValue) {
|
||||
this.userId = userId;
|
||||
this.timespan = timespan;
|
||||
this.type = type;
|
||||
this.attribute = attribute;
|
||||
this.deltaType = deltaType;
|
||||
this.changeValue = changeValue;
|
||||
this.trendConnotation = getTrendConnotation();
|
||||
}
|
||||
|
||||
public static TrendDetectionDTO mockTrendDetectionDTO() {
|
||||
return TrendDetectionDTO.builder()
|
||||
.userId(null) // Replace with a mock User if needed
|
||||
.timespan(TrendTimespan.WEEKLY)
|
||||
.type(TrendType.INCREASING)
|
||||
.attribute(StatAttribute.CAR_DISTANCE)
|
||||
.deltaType(DeltaType.ABSOLUTE)
|
||||
.changeValue(15.0)
|
||||
.build();
|
||||
return new TrendDetectionDTO(null, TrendTimespan.WEEKLY, TrendType.INCREASING, StatAttribute.CAR_DISTANCE, DeltaType.ABSOLUTE, 15.0);
|
||||
}
|
||||
|
||||
public TrendConnotation getTrendConnotation() {
|
||||
|
||||
Reference in New Issue
Block a user