mono repo base

This commit is contained in:
Lee 2024-08-01 05:57:27 +01:00
parent 90ec976939
commit 47fc07f2dd
54 changed files with 91 additions and 68 deletions

@ -1,31 +0,0 @@
name: Deploy to Dokku
on:
push:
branches: ["master"]
paths-ignore:
- .gitignore
- README.md
- LICENSE
jobs:
docker:
strategy:
matrix:
arch: ["ubuntu-latest"]
runs-on: ${{ matrix.arch }}
# Steps to run
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Deploy to Dokku
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: "ssh://dokku@10.0.50.136:22/bs-tracker"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

3
.idea/.gitignore vendored

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/docker" vcs="Git" />
</component>
</project>

@ -0,0 +1,29 @@
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;
}

@ -0,0 +1,31 @@
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;
}

@ -0,0 +1,21 @@
package cc.fascinated.repository.couchdb;
import cc.fascinated.model.platform.TrackedPlatformMetric;
import org.springframework.data.repository.CrudRepository;
/**
* @author Fascinated (fascinated7)
*/
public interface MetricsRepository extends CrudRepository<TrackedPlatformMetric, String> {
/**
* SELECT
* platform,
* last(total_scores) - first(total_scores) AS scores_set,
* timestamp
* FROM metrics
* TIMESTAMP(timestamp)
* SAMPLE BY 1d
* ORDER BY timestamp DESC;
*/
}

@ -0,0 +1,10 @@
package cc.fascinated.services;
import org.springframework.stereotype.Service;
/**
* @author Fascinated (fascinated7)
*/
@Service
public class PlatformMetricsService {
}