aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-09 10:29:23 +0100
committerChocobozzz <me@florianbigard.com>2023-01-09 10:29:23 +0100
commiteb66ee88351a93eb68c366cfbe30d35ed7c57b03 (patch)
treefb2ebb3b5accbbf06438709ae7e222f7ea7c9ffd /server/models/account/account.ts
parent0a8a79552cf59c800011c9f63eaa8658230acddc (diff)
downloadPeerTube-eb66ee88351a93eb68c366cfbe30d35ed7c57b03.tar.gz
PeerTube-eb66ee88351a93eb68c366cfbe30d35ed7c57b03.tar.zst
PeerTube-eb66ee88351a93eb68c366cfbe30d35ed7c57b03.zip
Refactor table attributes
Diffstat (limited to 'server/models/account/account.ts')
-rw-r--r--server/models/account/account.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 8a7dfba94..fca1b7b6d 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -38,7 +38,7 @@ import { ApplicationModel } from '../application/application'
38import { ServerModel } from '../server/server' 38import { ServerModel } from '../server/server'
39import { ServerBlocklistModel } from '../server/server-blocklist' 39import { ServerBlocklistModel } from '../server/server-blocklist'
40import { UserModel } from '../user/user' 40import { UserModel } from '../user/user'
41import { getSort, throwIfNotValid } from '../utils' 41import { buildSQLAttributes, getSort, throwIfNotValid } from '../utils'
42import { VideoModel } from '../video/video' 42import { VideoModel } from '../video/video'
43import { VideoChannelModel } from '../video/video-channel' 43import { VideoChannelModel } from '../video/video-channel'
44import { VideoCommentModel } from '../video/video-comment' 44import { VideoCommentModel } from '../video/video-comment'
@@ -251,6 +251,18 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {
251 return undefined 251 return undefined
252 } 252 }
253 253
254 // ---------------------------------------------------------------------------
255
256 static getSQLAttributes (tableName: string, aliasPrefix = '') {
257 return buildSQLAttributes({
258 model: this,
259 tableName,
260 aliasPrefix
261 })
262 }
263
264 // ---------------------------------------------------------------------------
265
254 static load (id: number, transaction?: Transaction): Promise<MAccountDefault> { 266 static load (id: number, transaction?: Transaction): Promise<MAccountDefault> {
255 return AccountModel.findByPk(id, { transaction }) 267 return AccountModel.findByPk(id, { transaction })
256 } 268 }