refactor: 将 DTO 文件从 internal/model 移动到 internal/model/dto 目录
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m22s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m22s
- 移动 17 个 DTO 文件到 internal/model/dto/ 目录 - 更新所有 DTO 文件的 package 声明从 model 改为 dto - 更新所有引用文件的 import 和类型引用 - Handler 层:admin 和 h5 所有处理器 - Service 层:所有业务服务 - Routes 层:所有路由定义 - Tests 层:单元测试和集成测试 - 清理未使用的 import 语句 - 验证:项目构建成功,测试编译通过,LSP 无错误
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
"github.com/break/junhong_cmp_fiber/internal/service/enterprise_card"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
@@ -34,7 +35,7 @@ func TestEnterpriseCardService_AllocateCardsPreview(t *testing.T) {
|
||||
t.Run("授权预检-企业不存在应失败", func(t *testing.T) {
|
||||
ctx := createEnterpriseCardTestContext(1, 1)
|
||||
|
||||
req := &model.AllocateCardsPreviewReq{
|
||||
req := &dto.AllocateCardsPreviewReq{
|
||||
ICCIDs: []string{"898600000001"},
|
||||
}
|
||||
|
||||
@@ -45,7 +46,7 @@ func TestEnterpriseCardService_AllocateCardsPreview(t *testing.T) {
|
||||
t.Run("授权预检-未授权用户应失败", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
req := &model.AllocateCardsPreviewReq{
|
||||
req := &dto.AllocateCardsPreviewReq{
|
||||
ICCIDs: []string{"898600000001"},
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ func TestEnterpriseCardService_AllocateCardsPreview(t *testing.T) {
|
||||
err := db.Create(ent).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.AllocateCardsPreviewReq{
|
||||
req := &dto.AllocateCardsPreviewReq{
|
||||
ICCIDs: []string{},
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ func TestEnterpriseCardService_AllocateCardsPreview(t *testing.T) {
|
||||
err := db.Create(ent).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.AllocateCardsPreviewReq{
|
||||
req := &dto.AllocateCardsPreviewReq{
|
||||
ICCIDs: []string{"NON_EXIST_ICCID"},
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ func TestEnterpriseCardService_AllocateCardsPreview(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.AllocateCardsPreviewReq{
|
||||
req := &dto.AllocateCardsPreviewReq{
|
||||
ICCIDs: []string{"898600001234567890"},
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ func TestEnterpriseCardService_AllocateCards(t *testing.T) {
|
||||
t.Run("授权卡-企业不存在应失败", func(t *testing.T) {
|
||||
ctx := createEnterpriseCardTestContext(1, 1)
|
||||
|
||||
req := &model.AllocateCardsReq{
|
||||
req := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600000001"},
|
||||
}
|
||||
|
||||
@@ -179,7 +180,7 @@ func TestEnterpriseCardService_AllocateCards(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.AllocateCardsReq{
|
||||
req := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600002345678901"},
|
||||
}
|
||||
|
||||
@@ -212,7 +213,7 @@ func TestEnterpriseCardService_AllocateCards(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.AllocateCardsReq{
|
||||
req := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600003456789012"},
|
||||
}
|
||||
|
||||
@@ -242,7 +243,7 @@ func TestEnterpriseCardService_RecallCards(t *testing.T) {
|
||||
t.Run("回收授权-企业不存在应失败", func(t *testing.T) {
|
||||
ctx := createEnterpriseCardTestContext(1, 1)
|
||||
|
||||
req := &model.RecallCardsReq{
|
||||
req := &dto.RecallCardsReq{
|
||||
ICCIDs: []string{"898600000001"},
|
||||
}
|
||||
|
||||
@@ -273,7 +274,7 @@ func TestEnterpriseCardService_RecallCards(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.RecallCardsReq{
|
||||
req := &dto.RecallCardsReq{
|
||||
ICCIDs: []string{"898600004567890123"},
|
||||
}
|
||||
|
||||
@@ -306,13 +307,13 @@ func TestEnterpriseCardService_RecallCards(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
allocReq := &model.AllocateCardsReq{
|
||||
allocReq := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600005678901234"},
|
||||
}
|
||||
_, err = service.AllocateCards(ctx, ent.ID, allocReq)
|
||||
require.NoError(t, err)
|
||||
|
||||
recallReq := &model.RecallCardsReq{
|
||||
recallReq := &dto.RecallCardsReq{
|
||||
ICCIDs: []string{"898600005678901234"},
|
||||
}
|
||||
result, err := service.RecallCards(ctx, ent.ID, recallReq)
|
||||
@@ -334,7 +335,7 @@ func TestEnterpriseCardService_ListCards(t *testing.T) {
|
||||
t.Run("查询企业卡列表-企业不存在应失败", func(t *testing.T) {
|
||||
ctx := createEnterpriseCardTestContext(1, 1)
|
||||
|
||||
req := &model.EnterpriseCardListReq{
|
||||
req := &dto.EnterpriseCardListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
}
|
||||
@@ -356,7 +357,7 @@ func TestEnterpriseCardService_ListCards(t *testing.T) {
|
||||
err := db.Create(ent).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.EnterpriseCardListReq{
|
||||
req := &dto.EnterpriseCardListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
}
|
||||
@@ -390,13 +391,13 @@ func TestEnterpriseCardService_ListCards(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
allocReq := &model.AllocateCardsReq{
|
||||
allocReq := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600006789012345"},
|
||||
}
|
||||
_, err = service.AllocateCards(ctx, ent.ID, allocReq)
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.EnterpriseCardListReq{
|
||||
req := &dto.EnterpriseCardListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
}
|
||||
@@ -432,13 +433,13 @@ func TestEnterpriseCardService_ListCards(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
allocReq := &model.AllocateCardsReq{
|
||||
allocReq := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600007890123456"},
|
||||
}
|
||||
_, err = service.AllocateCards(ctx, ent.ID, allocReq)
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.EnterpriseCardListReq{
|
||||
req := &dto.EnterpriseCardListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
ICCID: "78901",
|
||||
@@ -511,7 +512,7 @@ func TestEnterpriseCardService_SuspendAndResumeCard(t *testing.T) {
|
||||
err = db.Create(card).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
allocReq := &model.AllocateCardsReq{
|
||||
allocReq := &dto.AllocateCardsReq{
|
||||
ICCIDs: []string{"898600009012345678"},
|
||||
}
|
||||
_, err = service.AllocateCards(ctx, ent.ID, allocReq)
|
||||
|
||||
Reference in New Issue
Block a user