add: 提交部分表设计

update: 1.所有model嵌入gorm公用model 2.所有model嵌入BaseModel
This commit is contained in:
2025-12-15 11:32:33 +08:00
parent 4455b39e42
commit ad946af5ee
21 changed files with 1109 additions and 321 deletions

View File

@@ -28,8 +28,6 @@ func TestAccountModel_Create(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypeRoot,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
@@ -47,8 +45,6 @@ func TestAccountModel_Create(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, parent)
require.NoError(t, err)
@@ -61,8 +57,6 @@ func TestAccountModel_Create(t *testing.T) {
UserType: constants.UserTypeAgent,
ParentID: &parent.ID,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err = store.Create(ctx, child)
require.NoError(t, err)
@@ -79,8 +73,6 @@ func TestAccountModel_Create(t *testing.T) {
UserType: constants.UserTypePlatform,
ShopID: &shopID,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
@@ -105,8 +97,6 @@ func TestAccountModel_GetByID(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
require.NoError(t, err)
@@ -140,8 +130,6 @@ func TestAccountModel_GetByUsername(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
require.NoError(t, err)
@@ -173,8 +161,6 @@ func TestAccountModel_GetByPhone(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
require.NoError(t, err)
@@ -206,8 +192,6 @@ func TestAccountModel_Update(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
require.NoError(t, err)
@@ -242,8 +226,6 @@ func TestAccountModel_List(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
require.NoError(t, err)
@@ -283,8 +265,6 @@ func TestAccountModel_UniqueConstraints(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, account)
require.NoError(t, err)
@@ -296,8 +276,6 @@ func TestAccountModel_UniqueConstraints(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, duplicate)
assert.Error(t, err)
@@ -310,8 +288,6 @@ func TestAccountModel_UniqueConstraints(t *testing.T) {
Password: "hashed_password",
UserType: constants.UserTypePlatform,
Status: constants.StatusEnabled,
Creator: 1,
Updater: 1,
}
err := store.Create(ctx, duplicate)
assert.Error(t, err)