feat(settings): add audit retention days to general settings API - #308
Merged
Merged
Conversation
Move the audit log retention days configuration into the existing GET/PUT /api/settings/general endpoint so administrators can configure it alongside other general settings without a separate API. Changes: - Add auditRetentionDays field to GeneralSettingsDto and UpdateGeneralSettingsDto with @ISINT and @min(0) validation (0 disables auto-cleanup, which is the default) - Add getAuditRetentionDays() to GeneralSettingsService for AuditCleanupService to consume - Update AuditCleanupService to inject GeneralSettingsService instead of AuditSettingsService - Remove the now-obsolete AuditSettingsService and its registration in SettingsModule - Add tests for persistence, invalid value fallback, and DTO validation
hashbk
force-pushed
the
feat/audit-retention-via-general-settings
branch
from
August 26, 2026 11:50
0274a9e to
f0ea49e
Compare
YuZhiYuanDev
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET/PUT /api/settings/generalendpoint, replacing the standaloneAuditSettingsServicethat had no API exposureChanges
dto/general-settings.dto.tsauditRetentionDaystoGeneralSettingsDtoandUpdateGeneralSettingsDtowith@IsIntand@Min(0)services/general-settings.service.tsAUDIT_RETENTION_DAYS_KEY,getAuditRetentionDays(), andreadAuditRetentionDays()audit/services/audit-cleanup.service.tsGeneralSettingsServiceinstead ofAuditSettingsServiceservices/audit-settings.service.tsGeneralSettingsServicesettings.module.tsAuditSettingsServicefrom providers/exportsgeneral-settings.service.spec.tsUsage
A value of
0disables auto-cleanup (default). The daily cron job inAuditCleanupServicereads this setting and deletes audit records older than the configured number of days.