This commit is contained in:
parent
de89182c5d
commit
357315990e
@ -6,8 +6,6 @@ import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1,29 +0,0 @@
|
||||
package cc.fascinated.model.platform;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "metrics")
|
||||
public class DailyScoresSet {
|
||||
/**
|
||||
* The platform for the metric.
|
||||
*/
|
||||
@Id private String platform;
|
||||
|
||||
/**
|
||||
* The amount of scores set for the day.
|
||||
*/
|
||||
private long scoresSet;
|
||||
|
||||
/**
|
||||
* The day the scores were set.
|
||||
*/
|
||||
private Date timestamp;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package cc.fascinated.model.platform;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name = "metric")
|
||||
public class TrackedPlatformMetric {
|
||||
/**
|
||||
* The platform for the metric.
|
||||
*/
|
||||
@Id private String platform;
|
||||
|
||||
/**
|
||||
* The total amount of scores.
|
||||
*/
|
||||
private long totalScores;
|
||||
|
||||
/**
|
||||
* The total amount of ranked scores.
|
||||
*/
|
||||
private long totalRankedScores;
|
||||
}
|
@ -10,7 +10,6 @@ import cc.fascinated.model.user.User;
|
||||
import cc.fascinated.model.user.statistic.impl.ScoreSaberStatistic;
|
||||
import cc.fascinated.platform.CurvePoint;
|
||||
import cc.fascinated.platform.Platform;
|
||||
import cc.fascinated.services.QuestDBService;
|
||||
import cc.fascinated.services.ScoreSaberService;
|
||||
import cc.fascinated.services.ScoreService;
|
||||
import cc.fascinated.services.UserService;
|
||||
@ -49,15 +48,9 @@ public class ScoreSaberPlatform extends Platform {
|
||||
@NonNull
|
||||
private final UserService userService;
|
||||
|
||||
/**
|
||||
* The Influx service to use
|
||||
*/
|
||||
@NonNull
|
||||
private final QuestDBService questDBService;
|
||||
|
||||
@Autowired
|
||||
public ScoreSaberPlatform(@NonNull ScoreSaberService scoreSaberService, @NonNull UserService userService, @NonNull QuestDBService questDBService,
|
||||
@NonNull ScoreService scoreService) {
|
||||
public ScoreSaberPlatform(@NonNull ScoreSaberService scoreSaberService, @NonNull UserService userService) {
|
||||
super(Platforms.SCORESABER, 1, Map.of(
|
||||
1, new CurvePoint[]{
|
||||
new CurvePoint(0, 0),
|
||||
@ -101,7 +94,6 @@ public class ScoreSaberPlatform extends Platform {
|
||||
));
|
||||
this.scoreSaberService = scoreSaberService;
|
||||
this.userService = userService;
|
||||
this.questDBService = questDBService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,55 +0,0 @@
|
||||
package cc.fascinated.services;
|
||||
|
||||
import io.questdb.client.Sender;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@Service
|
||||
@Getter
|
||||
@Log4j2(topic = "QuestDB Service")
|
||||
public class QuestDBService {
|
||||
/*
|
||||
* The host of the QuestDB instance.
|
||||
*/
|
||||
private final String host;
|
||||
|
||||
/*
|
||||
* The username of the QuestDB instance.
|
||||
*/
|
||||
private final String username;
|
||||
|
||||
/*
|
||||
* The password of the QuestDB instance.
|
||||
*/
|
||||
private final String password;
|
||||
|
||||
@Autowired
|
||||
public QuestDBService(@Value("${questdb.host}") @NonNull String host,
|
||||
@Value("${questdb.username}") @NonNull String username,
|
||||
@Value("${questdb.password}") @NonNull String password
|
||||
) {
|
||||
this.host = host;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a new sender instance for QuestDB.
|
||||
*
|
||||
* @return the sender
|
||||
*/
|
||||
public Sender getSender() {
|
||||
return Sender.builder(Sender.Transport.HTTP)
|
||||
.address(host) // set host
|
||||
.httpUsernamePassword(username, password) // set username and password
|
||||
.retryTimeoutMillis(3000) // 3 seconds
|
||||
.build();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user