diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-23 09:32:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-04 16:21:39 +0200 |
commit | 8dc8a34ee8428e7657414115d1c137592efa174d (patch) | |
tree | e9b5ef0d7446d1b7766eac18da5a759edc7a9040 /server/models/application/application.ts | |
parent | 7fed637506043e4432cbebe041ada0625171cceb (diff) | |
download | PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.gz PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.zst PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.zip |
Avoir some circular dependencies
Diffstat (limited to 'server/models/application/application.ts')
-rw-r--r-- | server/models/application/application.ts | 11 |
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 @@ | |||
1 | import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript' | 1 | import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript' |
2 | import { AccountModel } from '../account/account' | 2 | import { AccountModel } from '../account/account' |
3 | import * as memoizee from 'memoizee' | ||
4 | |||
5 | export 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: [ |