mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Add deleting session durations when deleting families
For the automatic deletion, they were always already deleted. However, for manual deletion, this is required.
This commit is contained in:
parent
73465ebe6e
commit
dc5e2baebd
1 changed files with 11 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2023 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
|
||||
|
@ -79,6 +79,16 @@ export async function deleteFamilies ({ database, familiyIds }: {
|
|||
transaction
|
||||
})
|
||||
|
||||
// session durations
|
||||
await database.sessionDuration.destroy({
|
||||
where: {
|
||||
familyId: {
|
||||
[Sequelize.Op.in]: familiyIds
|
||||
}
|
||||
},
|
||||
transaction
|
||||
})
|
||||
|
||||
// user
|
||||
await database.user.destroy({
|
||||
where: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue