-import { omit, pick } from 'lodash'
-import { HttpStatusCode } from '@shared/core-utils'
+import { omit } from 'lodash'
+import { pick } from '@shared/core-utils'
import {
+ HttpStatusCode,
MyUser,
ResultList,
User,
})).then(res => res.user)
}
- async generate (username: string) {
+ async generate (username: string, role?: UserRole) {
const password = 'password'
- const user = await this.create({ username, password })
+ const user = await this.create({ username, password, role })
- const token = await this.server.loginCommand.getAccessToken({ username, password })
+ const token = await this.server.login.getAccessToken({ username, password })
const me = await this.getMyInfo({ token })
return {
token,
userId: user.id,
- userChannelId: me.videoChannels[0].id
+ userChannelId: me.videoChannels[0].id,
+ userChannelName: me.videoChannels[0].name
}
}
- async generateUserAndToken (username: string) {
+ async generateUserAndToken (username: string, role?: UserRole) {
const password = 'password'
- await this.create({ username, password })
+ await this.create({ username, password, role })
- return this.server.loginCommand.getAccessToken({ username, password })
+ return this.server.login.getAccessToken({ username, password })
}
register (options: OverrideCommandOptions & {