Default,
DefaultScope,
ForeignKey,
- HasMany, IFindOptions,
+ HasMany,
+ IFindOptions,
Is,
Model,
Scopes,
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
-import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers'
+import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
import { ServerModel } from '../server/server'
import { DefineIndexesOptions } from 'sequelize'
import { AvatarModel } from '../avatar/avatar'
]
})
@Scopes({
- [ScopeNames.SUMMARY]: (required: boolean, withAccount: boolean) => {
+ [ScopeNames.SUMMARY]: (withAccount = false) => {
const base: IFindOptions<VideoChannelModel> = {
- attributes: [ 'name', 'description', 'id' ],
+ attributes: [ 'name', 'description', 'id', 'actorId' ],
include: [
{
attributes: [ 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ],
@HasMany(() => VideoPlaylistModel, {
foreignKey: {
- allowNull: false
+ allowNull: true
},
- onDelete: 'cascade',
+ onDelete: 'CASCADE',
hooks: true
})
VideoPlaylists: VideoPlaylistModel[]
static loadByNameWithHostAndPopulateAccount (nameWithHost: string) {
const [ name, host ] = nameWithHost.split('@')
- if (!host || host === CONFIG.WEBSERVER.HOST) return VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
+ if (!host || host === WEBSERVER.HOST) return VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host)
}