mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Update dependencies
This commit is contained in:
@@ -110,7 +110,7 @@ export async function deleteFamilies ({ database, familiyIds }: {
|
||||
})
|
||||
|
||||
// device
|
||||
const oldDeviceAuthTokens = await database.device.findAll({
|
||||
const oldDeviceAuthTokens = (await database.device.findAll({
|
||||
where: {
|
||||
familyId: {
|
||||
[Sequelize.Op.in]: familiyIds
|
||||
@@ -118,7 +118,7 @@ export async function deleteFamilies ({ database, familiyIds }: {
|
||||
},
|
||||
attributes: ['deviceAuthToken'],
|
||||
transaction
|
||||
}).map((item) => item.deviceAuthToken)
|
||||
})).map((item) => item.deviceAuthToken)
|
||||
|
||||
await database.device.destroy({
|
||||
where: {
|
||||
@@ -131,14 +131,14 @@ export async function deleteFamilies ({ database, familiyIds }: {
|
||||
|
||||
// olddevice
|
||||
if (oldDeviceAuthTokens.length > 0) {
|
||||
const knownOldDeviceAuthTokens = await database.oldDevice.findAll({
|
||||
const knownOldDeviceAuthTokens = (await database.oldDevice.findAll({
|
||||
where: {
|
||||
deviceAuthToken: {
|
||||
[Sequelize.Op.in]: oldDeviceAuthTokens
|
||||
}
|
||||
},
|
||||
transaction
|
||||
}).map((item) => item.deviceAuthToken)
|
||||
})).map((item) => item.deviceAuthToken)
|
||||
|
||||
const oldDeviceAuthTokensToAdd = difference(oldDeviceAuthTokens, knownOldDeviceAuthTokens)
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function deleteOldFamilies (database: Database) {
|
||||
|
||||
export async function findOldFamilyIds (database: Database) {
|
||||
return database.transaction(async (transaction) => {
|
||||
const familyIdsWithExpiredLicenses = await database.family.findAll({
|
||||
const familyIdsWithExpiredLicenses = (await database.family.findAll({
|
||||
where: {
|
||||
fullVersionUntil: {
|
||||
[Sequelize.Op.lt]: (Date.now() - 1000 * 60 * 60 * 24 * 90 /* 90 days */).toString(10)
|
||||
@@ -43,13 +43,13 @@ export async function findOldFamilyIds (database: Database) {
|
||||
},
|
||||
attributes: ['familyId'],
|
||||
transaction
|
||||
}).map((item) => item.familyId)
|
||||
})).map((item) => item.familyId)
|
||||
|
||||
if (familyIdsWithExpiredLicenses.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
const recentlyUsedFamilyIds = await database.device.findAll({
|
||||
const recentlyUsedFamilyIds = (await database.device.findAll({
|
||||
where: {
|
||||
familyId: {
|
||||
[Sequelize.Op.in]: familyIdsWithExpiredLicenses
|
||||
@@ -60,7 +60,7 @@ export async function findOldFamilyIds (database: Database) {
|
||||
},
|
||||
attributes: ['familyId'],
|
||||
transaction
|
||||
}).map((item) => item.familyId)
|
||||
})).map((item) => item.familyId)
|
||||
|
||||
return difference(familyIdsWithExpiredLicenses, recentlyUsedFamilyIds)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user