aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/account/account.ts')
-rw-r--r--server/models/account/account.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 6f425024e..bf2ed0a61 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -1,4 +1,3 @@
1import * as Sequelize from 'sequelize'
2import { 1import {
3 AllowNull, 2 AllowNull,
4 BeforeDestroy, 3 BeforeDestroy,
@@ -28,6 +27,7 @@ import { UserModel } from './user'
28import { AvatarModel } from '../avatar/avatar' 27import { AvatarModel } from '../avatar/avatar'
29import { VideoPlaylistModel } from '../video/video-playlist' 28import { VideoPlaylistModel } from '../video/video-playlist'
30import { WEBSERVER } from '../../initializers/constants' 29import { WEBSERVER } from '../../initializers/constants'
30import { Op, Transaction, WhereOptions } from 'sequelize'
31 31
32export enum ScopeNames { 32export enum ScopeNames {
33 SUMMARY = 'SUMMARY' 33 SUMMARY = 'SUMMARY'
@@ -42,7 +42,7 @@ export enum ScopeNames {
42 ] 42 ]
43}) 43})
44@Scopes({ 44@Scopes({
45 [ ScopeNames.SUMMARY ]: (whereActor?: Sequelize.WhereOptions<ActorModel>) => { 45 [ ScopeNames.SUMMARY ]: (whereActor?: WhereOptions) => {
46 return { 46 return {
47 attributes: [ 'id', 'name' ], 47 attributes: [ 'id', 'name' ],
48 include: [ 48 include: [
@@ -90,7 +90,7 @@ export class AccountModel extends Model<AccountModel> {
90 90
91 @AllowNull(true) 91 @AllowNull(true)
92 @Default(null) 92 @Default(null)
93 @Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description')) 93 @Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description', true))
94 @Column 94 @Column
95 description: string 95 description: string
96 96
@@ -176,7 +176,7 @@ export class AccountModel extends Model<AccountModel> {
176 return undefined 176 return undefined
177 } 177 }
178 178
179 static load (id: number, transaction?: Sequelize.Transaction) { 179 static load (id: number, transaction?: Transaction) {
180 return AccountModel.findByPk(id, { transaction }) 180 return AccountModel.findByPk(id, { transaction })
181 } 181 }
182 182
@@ -207,15 +207,15 @@ export class AccountModel extends Model<AccountModel> {
207 static loadLocalByName (name: string) { 207 static loadLocalByName (name: string) {
208 const query = { 208 const query = {
209 where: { 209 where: {
210 [ Sequelize.Op.or ]: [ 210 [ Op.or ]: [
211 { 211 {
212 userId: { 212 userId: {
213 [ Sequelize.Op.ne ]: null 213 [ Op.ne ]: null
214 } 214 }
215 }, 215 },
216 { 216 {
217 applicationId: { 217 applicationId: {
218 [ Sequelize.Op.ne ]: null 218 [ Op.ne ]: null
219 } 219 }
220 } 220 }
221 ] 221 ]
@@ -259,7 +259,7 @@ export class AccountModel extends Model<AccountModel> {
259 return AccountModel.findOne(query) 259 return AccountModel.findOne(query)
260 } 260 }
261 261
262 static loadByUrl (url: string, transaction?: Sequelize.Transaction) { 262 static loadByUrl (url: string, transaction?: Transaction) {
263 const query = { 263 const query = {
264 include: [ 264 include: [
265 { 265 {