refactor(account): 移除卡类型字段、优化账号列表查询和权限检查
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m18s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m18s
- 移除 IoT 卡和号卡的 card_type 字段(数据库迁移) - 优化账号列表查询,支持按店铺和企业筛选 - 账号响应增加店铺名称和企业名称字段 - 实现批量加载店铺和企业名称,避免 N+1 查询 - 更新权限检查中间件,完善权限验证逻辑 - 更新相关测试用例,确保功能正确性
This commit is contained in:
@@ -25,9 +25,9 @@ func TestStandaloneCardAllocation_AllocateByList(t *testing.T) {
|
||||
agentAccount := env.CreateTestAccount("agent_alloc", "password123", constants.UserTypeAgent, &shop.ID, nil)
|
||||
|
||||
cards := []*model.IotCard{
|
||||
{ICCID: "ALLOC_TEST001", CardType: "data_card", CarrierID: 1, Status: constants.IotCardStatusInStock},
|
||||
{ICCID: "ALLOC_TEST002", CardType: "data_card", CarrierID: 1, Status: constants.IotCardStatusInStock},
|
||||
{ICCID: "ALLOC_TEST003", CardType: "data_card", CarrierID: 1, Status: constants.IotCardStatusInStock},
|
||||
{ICCID: "ALLOC_TEST001", CarrierID: 1, Status: constants.IotCardStatusInStock},
|
||||
{ICCID: "ALLOC_TEST002", CarrierID: 1, Status: constants.IotCardStatusInStock},
|
||||
{ICCID: "ALLOC_TEST003", CarrierID: 1, Status: constants.IotCardStatusInStock},
|
||||
}
|
||||
for _, card := range cards {
|
||||
require.NoError(t, env.TX.Create(card).Error)
|
||||
@@ -132,8 +132,8 @@ func TestStandaloneCardAllocation_Recall(t *testing.T) {
|
||||
|
||||
shopID := shop.ID
|
||||
cards := []*model.IotCard{
|
||||
{ICCID: "ALLOC_TEST101", CardType: "data_card", CarrierID: 1, Status: constants.IotCardStatusDistributed, ShopID: &shopID},
|
||||
{ICCID: "ALLOC_TEST102", CardType: "data_card", CarrierID: 1, Status: constants.IotCardStatusDistributed, ShopID: &shopID},
|
||||
{ICCID: "ALLOC_TEST101", CarrierID: 1, Status: constants.IotCardStatusDistributed, ShopID: &shopID},
|
||||
{ICCID: "ALLOC_TEST102", CarrierID: 1, Status: constants.IotCardStatusDistributed, ShopID: &shopID},
|
||||
}
|
||||
for _, card := range cards {
|
||||
require.NoError(t, env.TX.Create(card).Error)
|
||||
|
||||
Reference in New Issue
Block a user