aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/user.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/lib/user.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip
Move models to typescript-sequelize
Diffstat (limited to 'server/lib/user.ts')
-rw-r--r--server/lib/user.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 5653d8e65..c4722fae2 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -1,14 +1,13 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' 2import { createPrivateAndPublicKeys, logger } from '../helpers'
3import { database as db } from '../initializers' 3import { CONFIG, sequelizeTypescript } from '../initializers'
4import { CONFIG } from '../initializers/constants' 4import { AccountModel } from '../models/account/account'
5import { UserInstance } from '../models' 5import { UserModel } from '../models/account/user'
6import { getAccountActivityPubUrl } from './activitypub'
6import { createVideoChannel } from './video-channel' 7import { createVideoChannel } from './video-channel'
7import { logger } from '../helpers/logger'
8import { getAccountActivityPubUrl } from './activitypub/url'
9 8
10async function createUserAccountAndChannel (user: UserInstance, validateUser = true) { 9async function createUserAccountAndChannel (user: UserModel, validateUser = true) {
11 const { account, videoChannel } = await db.sequelize.transaction(async t => { 10 const { account, videoChannel } = await sequelizeTypescript.transaction(async t => {
12 const userOptions = { 11 const userOptions = {
13 transaction: t, 12 transaction: t,
14 validate: validateUser 13 validate: validateUser
@@ -38,7 +37,7 @@ async function createUserAccountAndChannel (user: UserInstance, validateUser = t
38async function createLocalAccountWithoutKeys (name: string, userId: number, applicationId: number, t: Sequelize.Transaction) { 37async function createLocalAccountWithoutKeys (name: string, userId: number, applicationId: number, t: Sequelize.Transaction) {
39 const url = getAccountActivityPubUrl(name) 38 const url = getAccountActivityPubUrl(name)
40 39
41 const accountInstance = db.Account.build({ 40 const accountInstance = new AccountModel({
42 name, 41 name,
43 url, 42 url,
44 publicKey: null, 43 publicKey: null,