mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Add support for temporarily blocking with end time
This commit is contained in:
@@ -45,6 +45,7 @@ export async function dispatchCreateCategory ({ action, cache }: {
|
||||
title: action.title,
|
||||
blockedMinutesInWeek: '',
|
||||
temporarilyBlocked: false,
|
||||
temporarilyBlockedEndTime: 0,
|
||||
extraTimeInMillis: 0,
|
||||
timeLimitRulesVersion: generateVersionId(),
|
||||
baseVersion: generateVersionId(),
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2020 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
|
||||
@@ -29,7 +29,8 @@ export async function dispatchUpdateCategoryTemporarilyBlocked ({ action, cache
|
||||
}
|
||||
|
||||
const [affectedRows] = await cache.database.category.update({
|
||||
temporarilyBlocked: action.blocked
|
||||
temporarilyBlocked: action.blocked,
|
||||
temporarilyBlockedEndTime: action.blocked ? (action.endTime ?? 0) : 0
|
||||
}, {
|
||||
where: {
|
||||
familyId: cache.familyId,
|
||||
|
||||
@@ -341,7 +341,8 @@ export const generateServerDataStatus = async ({ database, clientStatus, familyI
|
||||
'blockAllNotifications',
|
||||
'timeWarningFlags',
|
||||
'minBatteryCharging',
|
||||
'minBatteryMobile'
|
||||
'minBatteryMobile',
|
||||
'temporarilyBlockedEndTime'
|
||||
],
|
||||
transaction
|
||||
})).map((item) => ({
|
||||
@@ -356,7 +357,8 @@ export const generateServerDataStatus = async ({ database, clientStatus, familyI
|
||||
blockAllNotifications: item.blockAllNotifications,
|
||||
timeWarningFlags: item.timeWarningFlags,
|
||||
minBatteryCharging: item.minBatteryCharging,
|
||||
minBatteryMobile: item.minBatteryMobile
|
||||
minBatteryMobile: item.minBatteryMobile,
|
||||
temporarilyBlockedEndTime: item.temporarilyBlockedEndTime
|
||||
}))
|
||||
|
||||
result.categoryBase = dataForSyncing.map((item): ServerUpdatedCategoryBaseData => ({
|
||||
@@ -371,7 +373,8 @@ export const generateServerDataStatus = async ({ database, clientStatus, familyI
|
||||
blockAllNotifications: item.blockAllNotifications,
|
||||
timeWarnings: item.timeWarningFlags,
|
||||
mblMobile: item.minBatteryMobile,
|
||||
mblCharging: item.minBatteryCharging
|
||||
mblCharging: item.minBatteryCharging,
|
||||
tempBlockTime: item.temporarilyBlockedEndTime
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user