mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Optimize view endpoint
This commit is contained in:
parent
943e519390
commit
2c8776fc31
6 changed files with 46 additions and 21 deletions
|
@ -462,6 +462,36 @@ export class ActorModel extends Model<ActorModel> {
|
|||
}, { where, transaction })
|
||||
}
|
||||
|
||||
static loadAccountActorByVideoId (videoId: number): Bluebird<MActor> {
|
||||
const query = {
|
||||
include: [
|
||||
{
|
||||
attributes: [ 'id' ],
|
||||
model: AccountModel.unscoped(),
|
||||
required: true,
|
||||
include: [
|
||||
{
|
||||
attributes: [ 'id', 'accountId' ],
|
||||
model: VideoChannelModel.unscoped(),
|
||||
required: true,
|
||||
include: [
|
||||
{
|
||||
attributes: [ 'id', 'channelId' ],
|
||||
model: VideoModel.unscoped(),
|
||||
where: {
|
||||
id: videoId
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
return ActorModel.unscoped().findOne(query)
|
||||
}
|
||||
|
||||
getSharedInbox (this: MActorWithInboxes) {
|
||||
return this.sharedInboxUrl || this.inboxUrl
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue