aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/application
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-23 09:32:53 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit8dc8a34ee8428e7657414115d1c137592efa174d (patch)
treee9b5ef0d7446d1b7766eac18da5a759edc7a9040 /server/models/application
parent7fed637506043e4432cbebe041ada0625171cceb (diff)
downloadPeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.gz
PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.zst
PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.zip
Avoir some circular dependencies
Diffstat (limited to 'server/models/application')
-rw-r--r--server/models/application/application.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/models/application/application.ts b/server/models/application/application.ts
index 81320b9af..3bba2c70e 100644
--- a/server/models/application/application.ts
+++ b/server/models/application/application.ts
@@ -1,5 +1,16 @@
1import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript' 1import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript'
2import { AccountModel } from '../account/account' 2import { AccountModel } from '../account/account'
3import * as memoizee from 'memoizee'
4
5export const getServerActor = memoizee(async function () {
6 const application = await ApplicationModel.load()
7 if (!application) throw Error('Could not load Application from database.')
8
9 const actor = application.Account.Actor
10 actor.Account = application.Account
11
12 return actor
13}, { promise: true })
3 14
4@DefaultScope(() => ({ 15@DefaultScope(() => ({
5 include: [ 16 include: [