add demo endpoint for notification mocks
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package SuMoC.backend.trend.dto;
|
||||
|
||||
import SuMoC.backend.trend.enums.*;
|
||||
import SuMoC.backend.user.models.User;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class TrendDetectionDTO {
|
||||
private User user;
|
||||
private TrendTimespan timespan;
|
||||
private TrendType type;
|
||||
private StatAttribute attribute;
|
||||
private DeltaType deltaType;
|
||||
private double changeValue;
|
||||
|
||||
public static TrendDetectionDTO mockTrendDetectionDTO() {
|
||||
return TrendDetectionDTO.builder()
|
||||
.user(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();
|
||||
}
|
||||
|
||||
public TrendConnotation getTrendConnotation() {
|
||||
if (this.type == TrendType.INCREASING) {
|
||||
return switch (attribute) {
|
||||
case CAR_DISTANCE -> TrendConnotation.NEGATIVE;
|
||||
default -> TrendConnotation.NEUTRAL;
|
||||
};
|
||||
} else if (type == TrendType.DECREASING) {
|
||||
return switch (attribute) {
|
||||
case CAR_DISTANCE -> TrendConnotation.POSITIVE;
|
||||
default -> TrendConnotation.NEUTRAL;
|
||||
};
|
||||
} else {
|
||||
return TrendConnotation.NEUTRAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user