-import { omit, pick } from 'lodash'
+import { omit } from 'lodash'
+import { pick } from '@shared/core-utils'
import {
HttpStatusCode,
MyUser,
})).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.login.getAccessToken({ username, password })
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.login.getAccessToken({ username, password })
}