解决合并后出现的问题,为swagger提供禁用选项,暂时移除wiki
This commit is contained in:
@@ -35,7 +35,6 @@ type ProfileRepository interface {
|
||||
Delete(ctx context.Context, uuid string) error
|
||||
BatchDelete(ctx context.Context, uuids []string) (int64, error) // 批量删除
|
||||
CountByUserID(ctx context.Context, userID int64) (int64, error)
|
||||
SetActive(ctx context.Context, uuid string, userID int64) error
|
||||
UpdateLastUsedAt(ctx context.Context, uuid string) error
|
||||
GetByNames(ctx context.Context, names []string) ([]*model.Profile, error)
|
||||
GetKeyPair(ctx context.Context, profileId string) (*model.KeyPair, error)
|
||||
@@ -67,14 +66,6 @@ type TextureRepository interface {
|
||||
CountByUploaderID(ctx context.Context, uploaderID int64) (int64, error)
|
||||
}
|
||||
|
||||
// SystemConfigRepository 系统配置仓储接口
|
||||
type SystemConfigRepository interface {
|
||||
GetByKey(ctx context.Context, key string) (*model.SystemConfig, error)
|
||||
GetPublic(ctx context.Context) ([]model.SystemConfig, error)
|
||||
GetAll(ctx context.Context) ([]model.SystemConfig, error)
|
||||
Update(ctx context.Context, config *model.SystemConfig) error
|
||||
UpdateValue(ctx context.Context, key, value string) error
|
||||
}
|
||||
|
||||
// YggdrasilRepository Yggdrasil仓储接口
|
||||
type YggdrasilRepository interface {
|
||||
|
||||
@@ -83,7 +83,7 @@ func TestProfileRepository_Basic(t *testing.T) {
|
||||
u := &model.User{Username: "u2", Email: "u2@test.com", Password: "pwd", Status: 1}
|
||||
_ = userRepo.Create(ctx, u)
|
||||
|
||||
p := &model.Profile{UUID: "p-uuid", UserID: u.ID, Name: "hero", IsActive: false}
|
||||
p := &model.Profile{UUID: "p-uuid", UserID: u.ID, Name: "hero"}
|
||||
if err := profileRepo.Create(ctx, p); err != nil {
|
||||
t.Fatalf("create profile err: %v", err)
|
||||
}
|
||||
@@ -98,9 +98,7 @@ func TestProfileRepository_Basic(t *testing.T) {
|
||||
t.Fatalf("CountByUserID mismatch: %d err=%v", count, err)
|
||||
}
|
||||
|
||||
if err := profileRepo.SetActive(ctx, "p-uuid", u.ID); err != nil {
|
||||
t.Fatalf("SetActive err: %v", err)
|
||||
}
|
||||
|
||||
if err := profileRepo.UpdateLastUsedAt(ctx, "p-uuid"); err != nil {
|
||||
t.Fatalf("UpdateLastUsedAt err: %v", err)
|
||||
}
|
||||
@@ -208,29 +206,6 @@ func TestTextureRepository_Basic(t *testing.T) {
|
||||
_ = textureRepo.Delete(ctx, tex.ID)
|
||||
}
|
||||
|
||||
func TestSystemConfigRepository_Basic(t *testing.T) {
|
||||
db := testutil.NewTestDB(t)
|
||||
repo := NewSystemConfigRepository(db)
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &model.SystemConfig{Key: "site_name", Value: "Carrot", IsPublic: true}
|
||||
if err := repo.Update(ctx, cfg); err != nil {
|
||||
t.Fatalf("Update err: %v", err)
|
||||
}
|
||||
if v, err := repo.GetByKey(ctx, "site_name"); err != nil || v.Value != "Carrot" {
|
||||
t.Fatalf("GetByKey mismatch")
|
||||
}
|
||||
_ = repo.UpdateValue(ctx, "site_name", "Carrot2")
|
||||
if list, _ := repo.GetPublic(ctx); len(list) == 0 {
|
||||
t.Fatalf("GetPublic expected entries")
|
||||
}
|
||||
if all, _ := repo.GetAll(ctx); len(all) == 0 {
|
||||
t.Fatalf("GetAll expected entries")
|
||||
}
|
||||
if v, _ := repo.GetByKey(ctx, "site_name"); v.Value != "Carrot2" {
|
||||
t.Fatalf("UpdateValue not applied")
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientRepository_Basic(t *testing.T) {
|
||||
db := testutil.NewTestDB(t)
|
||||
|
||||
Reference in New Issue
Block a user