mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Add support for time limit rules that expire
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2024 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -45,7 +45,8 @@ export async function getRules ({ database, transaction, categoryIdsToSyncRules,
|
||||
'endMinuteOfDay',
|
||||
'sessionDurationMilliseconds',
|
||||
'sessionPauseMilliseconds',
|
||||
'perDay'
|
||||
'perDay',
|
||||
'expiresAt'
|
||||
],
|
||||
transaction
|
||||
})).map((item) => ({
|
||||
@@ -58,7 +59,8 @@ export async function getRules ({ database, transaction, categoryIdsToSyncRules,
|
||||
endMinuteOfDay: item.endMinuteOfDay,
|
||||
sessionDurationMilliseconds: item.sessionDurationMilliseconds,
|
||||
sessionPauseMilliseconds: item.sessionPauseMilliseconds,
|
||||
perDay: item.perDay
|
||||
perDay: item.perDay,
|
||||
expiresAt: item.expiresAt ? parseInt(item.expiresAt, 10) : undefined
|
||||
}))
|
||||
|
||||
const getCategoryRulesVersion = (categoryId: string) => (
|
||||
@@ -76,7 +78,8 @@ export async function getRules ({ database, transaction, categoryIdsToSyncRules,
|
||||
end: item.endMinuteOfDay,
|
||||
session: item.sessionDurationMilliseconds,
|
||||
pause: item.sessionPauseMilliseconds,
|
||||
perDay: item.perDay !== 0 ? true : false
|
||||
perDay: item.perDay !== 0 ? true : false,
|
||||
e: item.expiresAt
|
||||
})),
|
||||
version: getCategoryRulesVersion(categoryId)
|
||||
}))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2024 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -58,7 +58,7 @@ export const generateServerDataStatus = async ({
|
||||
familyEntry.hasFullVersion ? parseInt(familyEntry.fullVersionUntil, 10) : 0
|
||||
),
|
||||
message: await getStatusMessage({ database, transaction }) || undefined,
|
||||
apiLevel: 7
|
||||
apiLevel: 8
|
||||
}
|
||||
|
||||
if (familyEntry.deviceListVersion !== clientStatus.devices) {
|
||||
|
||||
Reference in New Issue
Block a user