mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Move models to typescript-sequelize
This commit is contained in:
parent
c893d4514e
commit
3fd3ab2d34
150 changed files with 3676 additions and 5074 deletions
|
@ -1,12 +1,12 @@
|
|||
import { ActivityAccept } from '../../../../shared/models/activitypub/activity'
|
||||
import { database as db } from '../../../initializers'
|
||||
import { AccountInstance } from '../../../models/account/account-interface'
|
||||
import { ActivityAccept } from '../../../../shared/models/activitypub'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { AccountFollowModel } from '../../../models/account/account-follow'
|
||||
import { addFetchOutboxJob } from '../fetch'
|
||||
|
||||
async function processAcceptActivity (activity: ActivityAccept, inboxAccount?: AccountInstance) {
|
||||
async function processAcceptActivity (activity: ActivityAccept, inboxAccount?: AccountModel) {
|
||||
if (inboxAccount === undefined) throw new Error('Need to accept on explicit inbox.')
|
||||
|
||||
const targetAccount = await db.Account.loadByUrl(activity.actor)
|
||||
const targetAccount = await AccountModel.loadByUrl(activity.actor)
|
||||
|
||||
return processAccept(inboxAccount, targetAccount)
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function processAccept (account: AccountInstance, targetAccount: AccountInstance) {
|
||||
const follow = await db.AccountFollow.loadByAccountAndTarget(account.id, targetAccount.id)
|
||||
async function processAccept (account: AccountModel, targetAccount: AccountModel) {
|
||||
const follow = await AccountFollowModel.loadByAccountAndTarget(account.id, targetAccount.id)
|
||||
if (!follow) throw new Error('Cannot find associated follow.')
|
||||
|
||||
follow.set('state', 'accepted')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue