Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
755ea05
feat(persistence): set up JPA,Flayway and integration test with TestC…
Arzu-N Jun 10, 2026
06b601f
style(persistence): fix code formatting and violations detected by sp…
Arzu-N Jun 10, 2026
7524ceb
fix(persistence): remove star imports and order them alphabetically i…
Arzu-N Jun 10, 2026
35f04ea
fix(test): fix checkstyle method name and resolve pipeline test failu…
Arzu-N Jun 10, 2026
18196e1
fix(test): exclude db autoconfig in api test and pass dynamic flyway …
Arzu-N Jun 10, 2026
98f29aa
fix(persistence): import FlywayAutoConfiguration explicitly in reposi…
Arzu-N Jun 10, 2026
361a2c8
fix(persistence): add flyway-database-postgresql driver dependency fo…
Arzu-N Jun 10, 2026
338329d
refactor: revert api configuration and cleanup project structure
Arzu-N Jun 11, 2026
697704b
fix: ensure gradlew is executable
Arzu-N Jun 11, 2026
4327ad5
test: fix persistence test context and remove redundant bean configur…
Arzu-N Jun 11, 2026
a416124
style: apply spotless code formatting
Arzu-N Jun 11, 2026
a2c0c0c
fix(ci): fix gradle execution permission
Arzu-N Jun 11, 2026
435658e
fix: fix initialization error using ContextConfiguration
Arzu-N Jun 11, 2026
6bf74a0
style: apply spotless code formatting
Arzu-N Jun 11, 2026
52a7fc0
refactor: revert unnecessary scanBasePackages from application class
Arzu-N Jun 11, 2026
c5544e6
style: fix spotless violations in AccountRepositoryTest
Arzu-N Jun 11, 2026
f23748c
style: fix code formatting with spotless
Arzu-N Jun 12, 2026
1f34b90
refactor: remove autoconfigure excludes to enable database support
Arzu-N Jun 12, 2026
013edad
test: link persistence tests to application context
Arzu-N Jun 12, 2026
5b9fbbd
test: refactor persistence test to use testconainers with local test …
Arzu-N Jun 12, 2026
2260925
fix(persistence): resolve context loading issues in AccountRepository…
Arzu-N Jun 12, 2026
2bf9b32
refactor(persistence): remove circular dependency in persistence modu…
Arzu-N Jun 12, 2026
5547012
fix(build): remove circular project dependency in apps:api
Arzu-N Jun 12, 2026
3a50cdf
refactor(persistence): cllean up dependencies
Arzu-N Jun 12, 2026
0e35402
refactor(persistence): remove Lombok in favor of standard Java boiler…
Arzu-N Jun 12, 2026
4e17e12
feat(persistence): add account and repo schema and entities
Arzu-N Jun 12, 2026
ab8e69a
refactor(persistence): fix checkstyle violations and optimize imports
Arzu-N Jun 12, 2026
cc796aa
fix(persistence): import missing JPA annotations for AccountEntity
Arzu-N Jun 12, 2026
54fd1f2
fix(persistence): resolve IdentifierGenerationException by adding @Ge…
Arzu-N Jun 12, 2026
0b49008
chore(persistence): fix import ordering violations via spotless
Arzu-N Jun 12, 2026
205bd20
chore(persistence): add index to repo account_id for performance
Arzu-N Jun 12, 2026
c301b0f
test(persistence): improve AccountRepositoryTest with flush and clear…
Arzu-N Jun 12, 2026
7711596
test(persistence): implement robust test for Account-Repo persistence
Arzu-N Jun 12, 2026
8595d5b
fix(persistence): align RepoEntity column names with schema
Arzu-N Jun 12, 2026
452fd66
fix(persistence): resolve column name typo in RepoEntity to match schema
Arzu-N Jun 12, 2026
72212a8
refactor(persistence): revert hardcoded spring boot version to use BO…
Arzu-N Jun 12, 2026
3bfc522
chore(persistence): update entity types and database schemas
Arzu-N Jun 12, 2026
3b08016
feat(persistence): implement Enums with @JsonValue for correct JSON s…
Arzu-N Jun 12, 2026
c9b9732
chore(persistence): fix enum mapping,restore ddl-validate,and cleanup…
Arzu-N Jun 13, 2026
76dc461
refactor(persistence): update data types for account and repo entities
Arzu-N Jun 13, 2026
c868457
refactor(flyway): update data types in migration scripts for consist…
Arzu-N Jun 13, 2026
1e76248
fix(flyway): resolve SQL syntax error in migration
Arzu-N Jun 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ jobs:
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Comment thread
Arzu-N marked this conversation as resolved.

- name: Spotless, Checkstyle, compile, and test
run: ./gradlew check --no-daemon
Empty file.
12 changes: 5 additions & 7 deletions backend/apps/api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ spring:
name: cleat-api
Comment thread
Arzu-N marked this conversation as resolved.
autoconfigure:
exclude:
# Temporary: database is not wired yet.
# Remove these excludes once datasource is configured in issue #5.
- org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
- org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration
# Temporary: database is not wired yet.
# Remove these excludes once datasource is configured in issue #5.
- org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
- org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration

server:
port: 8080
Expand All @@ -22,5 +22,3 @@ management:
enabled: true
redis:
enabled: false
db:
enabled: false
8 changes: 4 additions & 4 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.plugins.quality.CheckstyleExtension
import org.springframework.boot.gradle.plugin.SpringBootPlugin

plugins {
Expand Down Expand Up @@ -36,7 +35,8 @@ subprojects {
}
}

configure<SpotlessExtension> {

extensions.configure<SpotlessExtension> {
java {
palantirJavaFormat()
removeUnusedImports()
Expand All @@ -46,7 +46,7 @@ subprojects {
}
}

configure<CheckstyleExtension> {
extensions.configure<CheckstyleExtension> {
toolVersion = "10.26.1"
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
isIgnoreFailures = false
Expand All @@ -55,4 +55,4 @@ subprojects {
tasks.withType<Test> {
useJUnitPlatform()
}
}
}
1 change: 1 addition & 0 deletions backend/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configuration-cache=true

Empty file modified backend/gradlew
100755 → 100644
Empty file.
8 changes: 6 additions & 2 deletions backend/libs/persistence/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
plugins {
`java-library`
}

dependencies {
api(project(":libs:domain"))
implementation(project(":libs:common"))
api("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.flywaydb:flyway-core")
implementation("org.flywaydb:flyway-database-postgresql")
runtimeOnly("org.flywaydb:flyway-database-postgresql")
Comment thread
Arzu-N marked this conversation as resolved.
runtimeOnly("org.postgresql:postgresql")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:postgresql")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
package dev.cleat.persistence;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hibernate.annotations.CreationTimestamp;

@Entity
@Table(name = "account")
public class AccountEntity {

@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID id;

@Column(name = "login", nullable = false)
private String login;

@Column(name = "name", nullable = false)
private String name;

@Column(name = "type", nullable = false)
@Enumerated(EnumType.STRING)
private AccountType type;

@Column(name = "plan")
@Enumerated(EnumType.STRING)
private Plan plan;

@Column(name = "repo_count")
private Integer repoCount;

@Column(name = "member_count")
private Integer memberCount;

@Column(name = "posture_score")
private Integer postureScore;

@Column(name = "monthly_spend")
private BigDecimal monthlySpend;

@Column(name = "reclaimable")
private BigDecimal reclaimable;

@CreationTimestamp
@Column(name = "created_at", nullable = false, updatable = false)
private OffsetDateTime createdAt;

@OneToMany(mappedBy = "account", cascade = CascadeType.ALL, orphanRemoval = true)
private List<RepoEntity> repos = new ArrayList<>();

public AccountEntity(
UUID id,
String login,
String name,
AccountType type,
Plan plan,
Integer repoCount,
Integer memberCount,
Integer postureScore,
BigDecimal monthlySpend,
BigDecimal reclaimable,
OffsetDateTime createdAt,
List<RepoEntity> repos) {
this.id = id;
this.login = login;
this.name = name;
this.type = type;
this.plan = plan;
this.repoCount = repoCount;
this.memberCount = memberCount;
this.postureScore = postureScore;
this.monthlySpend = monthlySpend;
this.reclaimable = reclaimable;
this.createdAt = createdAt;
this.repos = repos;
}

public AccountEntity() {}

public UUID getId() {
return id;
}

public AccountEntity setId(UUID id) {
this.id = id;
return this;
}

public String getLogin() {
return login;
}

public AccountEntity setLogin(String login) {
this.login = login;
return this;
}

public String getName() {
return name;
}

public AccountEntity setName(String name) {
this.name = name;
return this;
}

public AccountType getType() {
return type;
}

public AccountEntity setType(AccountType type) {
this.type = type;
return this;
}

public Plan getPlan() {
return plan;
}

public AccountEntity setPlan(Plan plan) {
this.plan = plan;
return this;
}

public Integer getRepoCount() {
return repoCount;
}

public AccountEntity setRepoCount(Integer repoCount) {
this.repoCount = repoCount;
return this;
}

public Integer getMemberCount() {
return memberCount;
}

public AccountEntity setMemberCount(Integer memberCount) {
this.memberCount = memberCount;
return this;
}

public Integer getPostureScore() {
return postureScore;
}

public AccountEntity setPostureScore(Integer postureScore) {
this.postureScore = postureScore;
return this;
}

public BigDecimal getMonthlySpend() {
return monthlySpend;
}

public AccountEntity setMonthlySpend(BigDecimal monthlySpend) {
this.monthlySpend = monthlySpend;
return this;
}

public BigDecimal getReclaimable() {
return reclaimable;
}

public AccountEntity setReclaimable(BigDecimal reclaimable) {
this.reclaimable = reclaimable;
return this;
}

public OffsetDateTime getCreatedAt() {
return createdAt;
}

public AccountEntity setCreatedAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
return this;
}

public List<RepoEntity> getRepos() {
return repos;
}

public AccountEntity setRepos(List<RepoEntity> repos) {
this.repos = repos;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.cleat.persistence;

import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;

public interface AccountRepository extends JpaRepository<AccountEntity, UUID> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.cleat.persistence;

public enum AccountType {
USER,
ORG
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.cleat.persistence;

public enum Plan {
FREE,
TEAM
}
Loading
Loading