Add employee serial QR query support
This commit is contained in:
@@ -51,6 +51,15 @@ func TestUsersService_Create_EmployeeWithoutPasswordGeneratesSerial(t *testing.T
|
||||
assert.NoError(t, database.DB.Where("employee_no = ?", "employee_no_pwd").First(&user).Error)
|
||||
assert.Empty(t, user.Password)
|
||||
|
||||
serialService := EmployeeSerialsService{}
|
||||
serial, err := serialService.Query(dto.EmployeeSerials[0].SerialNumber)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, serial.Employee)
|
||||
assert.Equal(t, "普通员工", serial.Employee.Name)
|
||||
assert.Equal(t, "13800000002", serial.Employee.Phone)
|
||||
assert.Equal(t, "employee_no_pwd", serial.Employee.EmployeeNo)
|
||||
assert.Equal(t, "生产员工", serial.Employee.Position)
|
||||
|
||||
database.DB.Unscoped().Where("employee_id = ?", user.ID).Delete(&models.EmployeeSerial{})
|
||||
database.DB.Unscoped().Delete(&user)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user