Add employee serial QR query support

This commit is contained in:
Frudrax Cheng
2026-05-28 10:24:32 +08:00
parent d3ee215f61
commit 2aab9203a0
2 changed files with 11 additions and 2 deletions
+9
View File
@@ -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)
}