diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/lib/user.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-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.ts | 17 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' | 2 | import { createPrivateAndPublicKeys, logger } from '../helpers' |
3 | import { database as db } from '../initializers' | 3 | import { CONFIG, sequelizeTypescript } from '../initializers' |
4 | import { CONFIG } from '../initializers/constants' | 4 | import { AccountModel } from '../models/account/account' |
5 | import { UserInstance } from '../models' | 5 | import { UserModel } from '../models/account/user' |
6 | import { getAccountActivityPubUrl } from './activitypub' | ||
6 | import { createVideoChannel } from './video-channel' | 7 | import { createVideoChannel } from './video-channel' |
7 | import { logger } from '../helpers/logger' | ||
8 | import { getAccountActivityPubUrl } from './activitypub/url' | ||
9 | 8 | ||
10 | async function createUserAccountAndChannel (user: UserInstance, validateUser = true) { | 9 | async 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 | |||
38 | async function createLocalAccountWithoutKeys (name: string, userId: number, applicationId: number, t: Sequelize.Transaction) { | 37 | async 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, |