Update dependencies

This commit is contained in:
Jonas Lochmann
2020-12-28 01:00:00 +01:00
parent 2bb3777484
commit eca9473e11
133 changed files with 2298 additions and 2495 deletions
@@ -195,7 +195,7 @@ export async function dispatchAddUsedTimeVersion2 ({ deviceId, action, cache, ev
startMinuteOfDay: limit.start,
endMinuteOfDay: limit.end,
// end of primary key
lastUsage: action.trustedTimestamp,
lastUsage: action.trustedTimestamp.toString(10),
lastSessionDuration: item.timeToAdd,
roundedLastUpdate: roundedTimestampForSessionDuration
}, { transaction: cache.transaction })
@@ -90,7 +90,7 @@ export async function dispatchMarkTaskPendingAction ({ action, cache, deviceId }
const childInfo = { name: childInfoUnsafe.name }
await cache.database.childTask.update({ pendingRequest: true }, {
await cache.database.childTask.update({ pendingRequest: 1 }, {
where: {
familyId: cache.familyId,
taskId: action.taskId
@@ -50,21 +50,21 @@ export async function dispatchAddCategoryApps ({ action, cache, fromChildSelfLim
}
}
const categoriesOfSameChild = await cache.database.category.findAll({
const categoriesOfSameChild = (await cache.database.category.findAll({
where: {
familyId: cache.familyId,
childId
},
attributes: ['categoryId', 'parentCategoryId'],
transaction: cache.transaction
}).map((item) => ({
})).map((item) => ({
categoryId: item.categoryId,
parentCategoryId: item.parentCategoryId
}))
const userCategoryIds = categoriesOfSameChild.map((item) => item.categoryId)
const oldCategories = await cache.database.categoryApp.findAll({
const oldCategories = (await cache.database.categoryApp.findAll({
attributes: [ 'categoryId' ],
group: [ 'categoryId' ],
where: {
@@ -77,7 +77,7 @@ export async function dispatchAddCategoryApps ({ action, cache, fromChildSelfLim
}
},
transaction: cache.transaction
}).map((item) => item.categoryId)
})).map((item) => item.categoryId)
if (fromChildSelfLimitAddChildUserId !== null) {
try {
@@ -65,7 +65,7 @@ export async function dispatchCreateCategory ({ action, cache, fromChildSelfLimi
title: action.title,
blockedMinutesInWeek: '',
temporarilyBlocked: false,
temporarilyBlockedEndTime: 0,
temporarilyBlockedEndTime: '0',
extraTimeInMillis: 0,
extraTimeDay: -1,
timeLimitRulesVersion: generateVersionId(),
@@ -76,8 +76,10 @@ export async function dispatchCreateCategory ({ action, cache, fromChildSelfLimi
blockAllNotifications: false,
timeWarningFlags: 0,
sort,
disableLimitsUntil: 0,
taskListVersion: generateVersionId()
disableLimitsUntil: '0',
taskListVersion: generateVersionId(),
minBatteryCharging: 0,
minBatteryMobile: 0
}, { transaction: cache.transaction })
// update the cache
@@ -60,7 +60,7 @@ export async function dispatchUpdateCategoryDisableLimits ({ action, cache, from
}
const [affectedRows] = await cache.database.category.update({
disableLimitsUntil: action.endTime
disableLimitsUntil: action.endTime.toString(10)
}, {
where: {
familyId: cache.familyId,
@@ -48,7 +48,7 @@ export async function dispatchUpdateCategoryTemporarilyBlocked ({ action, cache,
const categoryEntry = {
childId: categoryEntryUnsafe.childId,
temporarilyBlocked: categoryEntryUnsafe.temporarilyBlocked,
temporarilyBlockedEndTime: categoryEntryUnsafe.temporarilyBlockedEndTime
temporarilyBlockedEndTime: parseInt(categoryEntryUnsafe.temporarilyBlockedEndTime, 10)
}
if (fromChildSelfLimitAddChildUserId !== null) {
@@ -69,7 +69,7 @@ export async function dispatchUpdateCategoryTemporarilyBlocked ({ action, cache,
const [affectedRows] = await cache.database.category.update({
temporarilyBlocked: action.blocked,
temporarilyBlockedEndTime: action.blocked ? (action.endTime ?? 0) : 0
temporarilyBlockedEndTime: action.blocked ? (action.endTime ?? 0).toString(10) : '0'
}, {
where: {
familyId: cache.familyId,
@@ -64,48 +64,52 @@ export async function getAppList ({ database, transaction, familyEntry, appsStat
if (idsOfDevicesWhereInstalledAppsMustBeSynced.length > 0) {
const [appsToSync, activitiesToSync] = await Promise.all([
database.app.findAll({
where: {
familyId: familyEntry.familyId,
deviceId: {
[Sequelize.Op.in]: idsOfDevicesWhereInstalledAppsMustBeSynced
}
},
attributes: [
'deviceId',
'packageName',
'title',
'isLaunchable',
'recommendation'
],
transaction
}).map((item) => ({
deviceId: item.deviceId,
packageName: item.packageName,
title: item.title,
isLaunchable: item.isLaunchable,
recommendation: item.recommendation
})),
database.appActivity.findAll({
where: {
familyId: familyEntry.familyId,
deviceId: {
[Sequelize.Op.in]: idsOfDevicesWhereInstalledAppsMustBeSynced
}
},
attributes: [
'deviceId',
'packageName',
'title',
'activityName'
],
transaction
}).map((item) => ({
deviceId: item.deviceId,
packageName: item.packageName,
activityName: item.activityName,
title: item.title
}))
(async () => {
return (await database.app.findAll({
where: {
familyId: familyEntry.familyId,
deviceId: {
[Sequelize.Op.in]: idsOfDevicesWhereInstalledAppsMustBeSynced
}
},
attributes: [
'deviceId',
'packageName',
'title',
'isLaunchable',
'recommendation'
],
transaction
})).map((item) => ({
deviceId: item.deviceId,
packageName: item.packageName,
title: item.title,
isLaunchable: item.isLaunchable,
recommendation: item.recommendation
}))
})(),
(async () => {
return (await database.appActivity.findAll({
where: {
familyId: familyEntry.familyId,
deviceId: {
[Sequelize.Op.in]: idsOfDevicesWhereInstalledAppsMustBeSynced
}
},
attributes: [
'deviceId',
'packageName',
'title',
'activityName'
],
transaction
})).map((item) => ({
deviceId: item.deviceId,
packageName: item.packageName,
activityName: item.activityName,
title: item.title
}))
})()
])
return idsOfDevicesWhereInstalledAppsMustBeSynced.map((deviceId): ServerInstalledAppsData => ({
@@ -106,7 +106,7 @@ export async function getCategoryBaseDatas ({
timeWarnings: item.timeWarningFlags,
mblMobile: item.minBatteryMobile,
mblCharging: item.minBatteryCharging,
tempBlockTime: item.temporarilyBlockedEndTime,
tempBlockTime: parseInt(item.temporarilyBlockedEndTime, 10),
sort: item.sort,
networks: networkIdsForSyncing
.filter((network) => network.categoryId === item.categoryId)