diff --git a/settings-example.json b/settings-example.json index 9380fc679281fceff4fc0689b215a278b88a8ff6..7ad89b651a2664c13f704274b2122528a3ffdbde 100644 --- a/settings-example.json +++ b/settings-example.json @@ -21,16 +21,19 @@ "owncloudPassword": "", "owncloudDestinationPath": "MyFolder" }, - "retentionPolicies": [ - { - "numberOfMeasurementsPerDay": 24, - "ageInDays": 30 - }, - { - "numberOfMeasurementsPerDay": 2, - "ageInDays": 60 - } - ] + "cleanup": { + "forceBackupAfterCleanup": true, + "retentionPolicies": [ + { + "numberOfMeasurementsPerDay": 24, + "ageInDays": 30 + }, + { + "numberOfMeasurementsPerDay": 2, + "ageInDays": 60 + } + ] + } }, "api": { "url": "http://localhost:10003", diff --git a/src/logic/routers/GeneralRouter.py b/src/logic/routers/GeneralRouter.py index 90d59d9293349e101ce205b66a75e63f8ed3d6ee..84b0dcb648c1506aa8c6c4abe2647761d9627400 100644 --- a/src/logic/routers/GeneralRouter.py +++ b/src/logic/routers/GeneralRouter.py @@ -29,13 +29,13 @@ async def databaseInfo(db: Session = Depends(get_database)): @router.get('/databaseCleanup', - summary='Cleans up the database by enforcing the configured retention policies', + summary='Cleans up the database by enforcing the configured retention policies for each sensor', response_model=Schemas.DatabaseCleanupInfo, dependencies=[Depends(check_api_key)]) async def databaseCleanup(db: Session = Depends(get_database)): infoBefore = DatabaseInfoProvider.get_database_info(db) - retentionPolicies = SETTINGS['database']['retentionPolicies'] + retentionPolicies = SETTINGS['database']['cleanup']['retentionPolicies'] policies = [] for item in retentionPolicies: policies.append(RetentionPolicy(numberOfMeasurementsPerDay=item['numberOfMeasurementsPerDay'],