From 357315990ecff022c851f369e61ba8eb4114d51f Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 1 Aug 2024 23:46:09 +0100 Subject: [PATCH] API: oopsie --- API/src/main/java/cc/fascinated/Main.java | 2 - .../model/platform/DailyScoresSet.java | 29 ---------- .../model/platform/TrackedPlatformMetric.java | 31 ----------- .../platform/impl/ScoreSaberPlatform.java | 10 +--- .../fascinated/services/QuestDBService.java | 55 ------------------- 5 files changed, 1 insertion(+), 126 deletions(-) delete mode 100644 API/src/main/java/cc/fascinated/model/platform/DailyScoresSet.java delete mode 100644 API/src/main/java/cc/fascinated/model/platform/TrackedPlatformMetric.java delete mode 100644 API/src/main/java/cc/fascinated/services/QuestDBService.java diff --git a/API/src/main/java/cc/fascinated/Main.java b/API/src/main/java/cc/fascinated/Main.java index 7a00870..1cf0277 100644 --- a/API/src/main/java/cc/fascinated/Main.java +++ b/API/src/main/java/cc/fascinated/Main.java @@ -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; diff --git a/API/src/main/java/cc/fascinated/model/platform/DailyScoresSet.java b/API/src/main/java/cc/fascinated/model/platform/DailyScoresSet.java deleted file mode 100644 index c0eb358..0000000 --- a/API/src/main/java/cc/fascinated/model/platform/DailyScoresSet.java +++ /dev/null @@ -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; -} diff --git a/API/src/main/java/cc/fascinated/model/platform/TrackedPlatformMetric.java b/API/src/main/java/cc/fascinated/model/platform/TrackedPlatformMetric.java deleted file mode 100644 index 4ab563b..0000000 --- a/API/src/main/java/cc/fascinated/model/platform/TrackedPlatformMetric.java +++ /dev/null @@ -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; -} diff --git a/API/src/main/java/cc/fascinated/platform/impl/ScoreSaberPlatform.java b/API/src/main/java/cc/fascinated/platform/impl/ScoreSaberPlatform.java index a4c3140..014b88b 100644 --- a/API/src/main/java/cc/fascinated/platform/impl/ScoreSaberPlatform.java +++ b/API/src/main/java/cc/fascinated/platform/impl/ScoreSaberPlatform.java @@ -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; } /** diff --git a/API/src/main/java/cc/fascinated/services/QuestDBService.java b/API/src/main/java/cc/fascinated/services/QuestDBService.java deleted file mode 100644 index 1a6063c..0000000 --- a/API/src/main/java/cc/fascinated/services/QuestDBService.java +++ /dev/null @@ -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(); - } -}