Add support for temporarily blocking with end time

This commit is contained in:
Jonas Lochmann
2020-01-27 01:00:00 +01:00
parent b55c375506
commit 719af663f5
8 changed files with 92 additions and 13 deletions
@@ -45,6 +45,7 @@ export async function dispatchCreateCategory ({ action, cache }: {
title: action.title,
blockedMinutesInWeek: '',
temporarilyBlocked: false,
temporarilyBlockedEndTime: 0,
extraTimeInMillis: 0,
timeLimitRulesVersion: generateVersionId(),
baseVersion: generateVersionId(),
@@ -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,