From 3d215dc5f978b58b8a6d0154c3feae27f13f1600 Mon Sep 17 00:00:00 2001 From: kimsible Date: Wed, 29 Jul 2020 15:49:04 +0200 Subject: [PATCH] Add channelName to user-create server-side and models --- server/controllers/api/users/index.ts | 6 +++++- shared/models/users/user-create.model.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index d339c2a1c..869f31d84 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -176,6 +176,7 @@ export { async function createUser (req: express.Request, res: express.Response) { const body: UserCreate = req.body + const userToCreate = new UserModel({ username: body.username, password: body.password, @@ -194,7 +195,10 @@ async function createUser (req: express.Request, res: express.Response) { userToCreate.password = await generateRandomString(20) } - const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({ userToCreate: userToCreate }) + const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({ + userToCreate, + channelNames: { name: body.channelName, displayName: body.channelName } + }) auditLogger.create(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) logger.info('User %s with its channel and account created.', body.username) diff --git a/shared/models/users/user-create.model.ts b/shared/models/users/user-create.model.ts index 6677b42aa..601c531cd 100644 --- a/shared/models/users/user-create.model.ts +++ b/shared/models/users/user-create.model.ts @@ -9,4 +9,5 @@ export interface UserCreate { videoQuotaDaily: number role: UserRole adminFlags?: UserAdminFlag + channelName: string }