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/customer_account"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
@@ -34,7 +35,7 @@ func TestCustomerAccountService_List(t *testing.T) {
|
||||
t.Run("查询账号列表-空结果", func(t *testing.T) {
|
||||
ctx := createCustomerAccountTestContext(1)
|
||||
|
||||
req := &model.CustomerAccountListReq{
|
||||
req := &dto.CustomerAccountListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
}
|
||||
@@ -61,7 +62,7 @@ func TestCustomerAccountService_List(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
createReq := &model.CreateCustomerAccountReq{
|
||||
createReq := &dto.CreateCustomerAccountReq{
|
||||
Username: "测试账号用户",
|
||||
Phone: "13900000001",
|
||||
Password: "Test123456",
|
||||
@@ -70,7 +71,7 @@ func TestCustomerAccountService_List(t *testing.T) {
|
||||
_, err = service.Create(ctx, createReq)
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.CustomerAccountListReq{
|
||||
req := &dto.CustomerAccountListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
Username: "测试账号",
|
||||
@@ -98,7 +99,7 @@ func TestCustomerAccountService_List(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
createReq := &model.CreateCustomerAccountReq{
|
||||
createReq := &dto.CreateCustomerAccountReq{
|
||||
Username: "店铺筛选账号",
|
||||
Phone: "13900000002",
|
||||
Password: "Test123456",
|
||||
@@ -107,7 +108,7 @@ func TestCustomerAccountService_List(t *testing.T) {
|
||||
_, err = service.Create(ctx, createReq)
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.CustomerAccountListReq{
|
||||
req := &dto.CustomerAccountListReq{
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
ShopID: &shop.ID,
|
||||
@@ -146,7 +147,7 @@ func TestCustomerAccountService_Create(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &model.CreateCustomerAccountReq{
|
||||
req := &dto.CreateCustomerAccountReq{
|
||||
Username: "新代理账号",
|
||||
Phone: "13900000010",
|
||||
Password: "Test123456",
|
||||
@@ -178,7 +179,7 @@ func TestCustomerAccountService_Create(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
req1 := &model.CreateCustomerAccountReq{
|
||||
req1 := &dto.CreateCustomerAccountReq{
|
||||
Username: "账号一",
|
||||
Phone: "13900000011",
|
||||
Password: "Test123456",
|
||||
@@ -187,7 +188,7 @@ func TestCustomerAccountService_Create(t *testing.T) {
|
||||
_, err = service.Create(ctx, req1)
|
||||
require.NoError(t, err)
|
||||
|
||||
req2 := &model.CreateCustomerAccountReq{
|
||||
req2 := &dto.CreateCustomerAccountReq{
|
||||
Username: "账号二",
|
||||
Phone: "13900000011",
|
||||
Password: "Test123456",
|
||||
@@ -200,7 +201,7 @@ func TestCustomerAccountService_Create(t *testing.T) {
|
||||
t.Run("新增账号-店铺不存在应失败", func(t *testing.T) {
|
||||
ctx := createCustomerAccountTestContext(1)
|
||||
|
||||
req := &model.CreateCustomerAccountReq{
|
||||
req := &dto.CreateCustomerAccountReq{
|
||||
Username: "无效店铺账号",
|
||||
Phone: "13900000012",
|
||||
Password: "Test123456",
|
||||
@@ -214,7 +215,7 @@ func TestCustomerAccountService_Create(t *testing.T) {
|
||||
t.Run("新增账号-未授权用户应失败", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
req := &model.CreateCustomerAccountReq{
|
||||
req := &dto.CreateCustomerAccountReq{
|
||||
Username: "未授权账号",
|
||||
Phone: "13900000013",
|
||||
Password: "Test123456",
|
||||
@@ -252,7 +253,7 @@ func TestCustomerAccountService_Update(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
createReq := &model.CreateCustomerAccountReq{
|
||||
createReq := &dto.CreateCustomerAccountReq{
|
||||
Username: "待编辑账号",
|
||||
Phone: "13900000020",
|
||||
Password: "Test123456",
|
||||
@@ -262,7 +263,7 @@ func TestCustomerAccountService_Update(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
newName := "编辑后账号"
|
||||
updateReq := &model.UpdateCustomerAccountReq{
|
||||
updateReq := &dto.UpdateCustomerAccountRequest{
|
||||
Username: &newName,
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@ func TestCustomerAccountService_Update(t *testing.T) {
|
||||
ctx := createCustomerAccountTestContext(1)
|
||||
|
||||
newName := "不存在账号"
|
||||
updateReq := &model.UpdateCustomerAccountReq{
|
||||
updateReq := &dto.UpdateCustomerAccountRequest{
|
||||
Username: &newName,
|
||||
}
|
||||
|
||||
@@ -310,7 +311,7 @@ func TestCustomerAccountService_UpdatePassword(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
createReq := &model.CreateCustomerAccountReq{
|
||||
createReq := &dto.CreateCustomerAccountReq{
|
||||
Username: "密码测试账号",
|
||||
Phone: "13900000030",
|
||||
Password: "OldPass123",
|
||||
@@ -363,7 +364,7 @@ func TestCustomerAccountService_UpdateStatus(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
createReq := &model.CreateCustomerAccountReq{
|
||||
createReq := &dto.CreateCustomerAccountReq{
|
||||
Username: "状态测试账号",
|
||||
Phone: "13900000040",
|
||||
Password: "Test123456",
|
||||
@@ -397,7 +398,7 @@ func TestCustomerAccountService_UpdateStatus(t *testing.T) {
|
||||
err := db.Create(shop).Error
|
||||
require.NoError(t, err)
|
||||
|
||||
createReq := &model.CreateCustomerAccountReq{
|
||||
createReq := &dto.CreateCustomerAccountReq{
|
||||
Username: "启用测试账号",
|
||||
Phone: "13900000041",
|
||||
Password: "Test123456",
|
||||
|
||||
Reference in New Issue
Block a user