fix(users): allow external intake business role
This commit is contained in:
parent
a962c8d1c7
commit
2ad2994f22
@ -122,6 +122,16 @@ describe('userService master-data normalization', () => {
|
||||
}))
|
||||
})
|
||||
|
||||
it('update 允许保存外部录入员业务类型', async () => {
|
||||
await userService.update('user-1', {
|
||||
businessRoles: ['EXTERNAL_INTAKE'],
|
||||
})
|
||||
|
||||
expect(mockUpdateWithScalars).toHaveBeenCalledWith('user-1', expect.objectContaining({
|
||||
businessRoles: ['EXTERNAL_INTAKE'],
|
||||
}))
|
||||
})
|
||||
|
||||
it('业务类型出现游离值时拒绝写入', async () => {
|
||||
await expect(
|
||||
userService.create({
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { hashPassword, validatePasswordStrength, verifyPassword } from '@/lib/password'
|
||||
import { BUSINESS_ACCOUNT_TYPE_OPTIONS } from '@/lib/business-account-types'
|
||||
import { AppError, ErrorCode } from '@/server/core/errors'
|
||||
import type { BusinessAccountType, EmployeeSourceStatus, Role, UserStatus } from '@prisma/client'
|
||||
import { departmentRepository } from '../repositories/department.repository'
|
||||
@ -89,13 +90,9 @@ export interface UserDTO {
|
||||
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
const NAME_REGEX = /^[\u4e00-\u9fa5a-zA-Z0-9_]{2,20}$/
|
||||
const GENERIC_LOGIN_ERROR_MESSAGE = '账号或密码错误'
|
||||
const BUSINESS_ROLE_SET = new Set<BusinessAccountType>([
|
||||
'DESIGN',
|
||||
'PLANNING',
|
||||
'PURCHASING',
|
||||
'WAREHOUSE',
|
||||
'SUPPLIER',
|
||||
])
|
||||
const BUSINESS_ROLE_SET = new Set<string>(
|
||||
BUSINESS_ACCOUNT_TYPE_OPTIONS.map((option) => option.value),
|
||||
)
|
||||
|
||||
function normalizeEmail(email: string): string {
|
||||
return email.trim().toLowerCase()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user