fix: resolve CI failures — RetentionService bean, frontend types, artifact upload
CI — Build, Lint & Security Scan / backend (push) Failing after 1m24s
CI — Build, Lint & Security Scan / frontend (push) Failing after 48s
CI — Build, Lint & Security Scan / image-scan (push) Has been skipped
CI — Build, Lint & Security Scan / secrets-scan (push) Failing after 27s
Deploy to TrueNAS / deploy (push) Successful in 3m0s
CI — Build, Lint & Security Scan / backend (push) Failing after 1m24s
CI — Build, Lint & Security Scan / frontend (push) Failing after 48s
CI — Build, Lint & Security Scan / image-scan (push) Has been skipped
CI — Build, Lint & Security Scan / secrets-scan (push) Failing after 27s
Deploy to TrueNAS / deploy (push) Successful in 3m0s
- Remove @ConditionalOnProperty from RetentionService class; guard only @Scheduled method - Fix QuotaStatus property references in frontend tests - Downgrade upload-artifact to v3 for Gitea compatibility
This commit is contained in:
@@ -65,7 +65,7 @@ jobs:
|
||||
|
||||
- name: Upload dependency-check report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dependency-check-report
|
||||
path: target/dependency-check-report.*
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
|
||||
- name: Upload Trivy reports
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: trivy-reports
|
||||
path: trivy-*.json
|
||||
@@ -189,7 +189,7 @@ jobs:
|
||||
|
||||
- name: Upload Gitleaks report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: gitleaks-report
|
||||
path: gitleaks-report.json
|
||||
|
||||
@@ -98,11 +98,11 @@ export const mockStaffList = [
|
||||
]
|
||||
|
||||
export const mockQuotaStatus = {
|
||||
memberId: "m1",
|
||||
dailyUsedGrams: 15,
|
||||
dailyLimitGrams: 25,
|
||||
monthlyUsedGrams: 15,
|
||||
monthlyLimitGrams: 50,
|
||||
usedGrams: 15,
|
||||
remainingGrams: 35,
|
||||
distributionCount: 3,
|
||||
isUnder21: false,
|
||||
}
|
||||
|
||||
export const mockRecentDistributions = [
|
||||
|
||||
@@ -62,7 +62,7 @@ describe("useQuotaQuery", () => {
|
||||
await waitFor(() => expect(result.current.isSuccess).toBe(true))
|
||||
expect(result.current.data).toEqual(mockQuotaStatus)
|
||||
expect(result.current.data?.monthlyLimitGrams).toBe(50)
|
||||
expect(result.current.data?.usedGrams).toBe(15)
|
||||
expect(result.current.data?.dailyUsedGrams).toBe(15)
|
||||
})
|
||||
|
||||
it("is disabled when memberId is empty", async () => {
|
||||
|
||||
@@ -91,7 +91,7 @@ describe("useMemberQuotaQuery", () => {
|
||||
|
||||
await waitFor(() => expect(result.current.isSuccess).toBe(true))
|
||||
expect(result.current.data).toEqual(mockQuotaStatus)
|
||||
expect(result.current.data?.remainingGrams).toBe(35)
|
||||
expect(result.current.data?.monthlyUsedGrams).toBe(15)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import de.cannamanage.service.repository.DistributionRepository;
|
||||
import de.cannamanage.service.repository.MemberRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -29,9 +29,11 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(name = "cannamanage.schedulers.enabled", havingValue = "true", matchIfMissing = false)
|
||||
public class RetentionService {
|
||||
|
||||
@Value("${cannamanage.schedulers.enabled:false}")
|
||||
private boolean schedulersEnabled;
|
||||
|
||||
private final ClubRepository clubRepository;
|
||||
private final MemberRepository memberRepository;
|
||||
private final DistributionRepository distributionRepository;
|
||||
@@ -39,11 +41,15 @@ public class RetentionService {
|
||||
|
||||
/**
|
||||
* Daily scheduled retention processing at 2:00 AM.
|
||||
* Only runs when schedulers are enabled.
|
||||
* Processes each club independently.
|
||||
*/
|
||||
@Scheduled(cron = "0 0 2 * * *")
|
||||
@Transactional
|
||||
public void processRetention() {
|
||||
if (!schedulersEnabled) {
|
||||
return;
|
||||
}
|
||||
log.info("Starting scheduled retention processing");
|
||||
List<Club> clubs = clubRepository.findAll();
|
||||
int totalAnonymized = 0;
|
||||
|
||||
Reference in New Issue
Block a user