Cleanup model types

This commit is contained in:
Chocobozzz 2019-08-20 13:52:49 +02:00
parent 96ca24f00e
commit 0283eaac2a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
50 changed files with 696 additions and 349 deletions

View file

@ -24,15 +24,17 @@ import { ActorFetchByUrlType, fetchActorByUrl } from '../../helpers/actor'
import { sequelizeTypescript } from '../../initializers/database'
import {
MAccount,
MAccountDefault,
MActor,
MActorAccountChannelId,
MActorAccountChannelIdActor,
MActorAccountId,
MActorDefault,
MActorFull,
MActorFullActor,
MActorId,
MActorAccountChannelIdActor,
MChannel,
MActorFullActor, MAccountActorDefault, MChannelActorDefault, MChannelActorAccountDefault
MChannelAccountDefault
} from '../../typings/models'
// Set account keys, this could be long so process after the account creation and do not block the client
@ -374,12 +376,11 @@ function saveActorAndServerAndModelIfNotExist (
})
if (actorCreated.type === 'Person' || actorCreated.type === 'Application') {
actorCreated.Account = await saveAccount(actorCreated, result, t) as MAccountActorDefault
actorCreated.Account = await saveAccount(actorCreated, result, t) as MAccountDefault
actorCreated.Account.Actor = actorCreated
} else if (actorCreated.type === 'Group') { // Video channel
actorCreated.VideoChannel = await saveVideoChannel(actorCreated, result, ownerActor, t) as MChannelActorAccountDefault
actorCreated.VideoChannel.Actor = actorCreated
actorCreated.VideoChannel.Account = ownerActor.Account
const channel = await saveVideoChannel(actorCreated, result, ownerActor, t)
actorCreated.VideoChannel = Object.assign(channel, { Actor: actorCreated, Account: ownerActor.Account })
}
actorCreated.Server = server