feat: Add script to refresh README from OpenAPI document

refactor: Improve error handling in PowerDNSAPIClient and streamline response processing

fix: Update RecordController to directly return records without unnecessary mapping

refactor: Update DomainRepository and RecordRepository to remove nullable types for IDs

fix: Change User domains fetch strategy to lazy loading for performance improvement

fix: Enhance user authentication handling in UserFilter to ensure authenticated user presence

refactor: Improve DomainService to enforce ownership checks before domain deletion

refactor: Update RecordService to streamline record retrieval and ensure proper domain association

test: Add OpenAPI generation test to validate API documentation endpoint

test: Implement PowerDNSAPIClient tests to verify HTTP method usage and error handling

test: Create DomainService tests to validate domain ownership and deletion logic

test: Add application-test.properties for in-memory database configuration during tests
This commit is contained in:
dalbodeule committed 2026-10-29 23:11:21 +09:00
1 parent 5936622f64
commit 47461c505f
24 files changed
+920 -1329

No files matched your search

@@ -20,7 +20,6 @@ class DomainService(
try {
val user = getCurrentUser()
val domain = domainRepository.findAllByUser(user)
if (domain.isEmpty()) throw RuntimeException("Unauthorized")
return domain
} catch(ex: Error) {
@@ -62,14 +61,17 @@ class DomainService(
val domain = domainRepository.findByCfid(domain_id).orElseThrow {
throw RuntimeException("Domain with CFID $domain_id not found")
}
val user = getCurrentUser()
if (domain.user.id != user.id)
throw RuntimeException("Unauthorized to delete domain in API: $domain_id")
powerDNSApiClient.deleteZone(domain.name)
val count = domainRepository.deleteByCfid(domain_id)
if (count > 0) throw RuntimeException("Domain with CFID $domain_id not found")
if (count == 0) throw RuntimeException("Domain with CFID $domain_id not found")
return domain_id
} catch(ex: Error) {
throw ex
}
}
}
}