aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/database-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-11-15 15:06:03 +0100
committerChocobozzz <me@florianbigard.com>2019-11-25 10:59:43 +0100
commitd7a25329f9e607894d29ab342b9cb66638b56dc0 (patch)
tree6cd6bc4f2689f78944238b313c93427423a932ac /server/helpers/database-utils.ts
parent14981d7331da3f63fe6cfaf020ccb7c910006eaf (diff)
downloadPeerTube-d7a25329f9e607894d29ab342b9cb66638b56dc0.tar.gz
PeerTube-d7a25329f9e607894d29ab342b9cb66638b56dc0.tar.zst
PeerTube-d7a25329f9e607894d29ab342b9cb66638b56dc0.zip
Add ability to disable webtorrent
In favour of HLS
Diffstat (limited to 'server/helpers/database-utils.ts')
-rw-r--r--server/helpers/database-utils.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts
index 6c5068fb0..87f10f913 100644
--- a/server/helpers/database-utils.ts
+++ b/server/helpers/database-utils.ts
@@ -79,6 +79,15 @@ function afterCommitIfTransaction (t: Transaction, fn: Function) {
79 return fn() 79 return fn()
80} 80}
81 81
82function deleteNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean } & Model<T>> (
83 fromDatabase: T[],
84 newModels: T[],
85 t: Transaction
86) {
87 return fromDatabase.filter(f => !newModels.find(newModel => newModel.hasSameUniqueKeysThan(f)))
88 .map(f => f.destroy({ transaction: t }))
89}
90
82// --------------------------------------------------------------------------- 91// ---------------------------------------------------------------------------
83 92
84export { 93export {
@@ -86,5 +95,6 @@ export {
86 retryTransactionWrapper, 95 retryTransactionWrapper,
87 transactionRetryer, 96 transactionRetryer,
88 updateInstanceWithAnother, 97 updateInstanceWithAnother,
89 afterCommitIfTransaction 98 afterCommitIfTransaction,
99 deleteNonExistingModels
90} 100}