mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
expliciting type checks and predicates (server only)
This commit is contained in:
parent
5f7021c33d
commit
c1e791bad0
34 changed files with 127 additions and 84 deletions
|
@ -6,6 +6,7 @@ import { UserModel } from '../models/account/user'
|
|||
import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub'
|
||||
import { createVideoChannel } from './video-channel'
|
||||
import { VideoChannelModel } from '../models/video/video-channel'
|
||||
import { FilteredModelAttributes } from 'sequelize-typescript/lib/models/Model'
|
||||
|
||||
async function createUserAccountAndChannel (userToCreate: UserModel, validateUser = true) {
|
||||
const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => {
|
||||
|
@ -34,9 +35,9 @@ async function createUserAccountAndChannel (userToCreate: UserModel, validateUse
|
|||
|
||||
async function createLocalAccountWithoutKeys (
|
||||
name: string,
|
||||
userId: number,
|
||||
applicationId: number,
|
||||
t: Sequelize.Transaction,
|
||||
userId: number | null,
|
||||
applicationId: number | null,
|
||||
t: Sequelize.Transaction | undefined,
|
||||
type: ActivityPubActorType= 'Person'
|
||||
) {
|
||||
const url = getAccountActivityPubUrl(name)
|
||||
|
@ -49,7 +50,7 @@ async function createLocalAccountWithoutKeys (
|
|||
userId,
|
||||
applicationId,
|
||||
actorId: actorInstanceCreated.id
|
||||
})
|
||||
} as FilteredModelAttributes<AccountModel>)
|
||||
|
||||
const accountInstanceCreated = await accountInstance.save({ transaction: t })
|
||||
accountInstanceCreated.Actor = actorInstanceCreated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue