33 lines
1.4 KiB
Go
33 lines
1.4 KiB
Go
package interfaces
|
|
|
|
import (
|
|
"context"
|
|
"photography-backend/internal/model/entity"
|
|
)
|
|
|
|
// PhotoRepository 照片仓储接口
|
|
type PhotoRepository interface {
|
|
// 基本CRUD操作
|
|
Create(ctx context.Context, photo *entity.Photo) error
|
|
GetByID(ctx context.Context, id uint) (*entity.Photo, error)
|
|
Update(ctx context.Context, photo *entity.Photo) error
|
|
Delete(ctx context.Context, id uint) error
|
|
|
|
// 查询操作
|
|
List(ctx context.Context, params *entity.PhotoListParams) ([]*entity.Photo, int64, error)
|
|
ListByUserID(ctx context.Context, userID uint, params *entity.PhotoListParams) ([]*entity.Photo, int64, error)
|
|
ListByCategory(ctx context.Context, categoryID uint, params *entity.PhotoListParams) ([]*entity.Photo, int64, error)
|
|
Search(ctx context.Context, query string, params *entity.PhotoListParams) ([]*entity.Photo, int64, error)
|
|
|
|
// 批量操作
|
|
BatchUpdate(ctx context.Context, ids []uint, updates map[string]interface{}) error
|
|
BatchDelete(ctx context.Context, ids []uint) error
|
|
BatchUpdateCategories(ctx context.Context, photoIDs []uint, categoryIDs []uint) error
|
|
BatchUpdateTags(ctx context.Context, photoIDs []uint, tagIDs []uint) error
|
|
|
|
// 统计操作
|
|
Count(ctx context.Context) (int64, error)
|
|
CountByStatus(ctx context.Context, status string) (int64, error)
|
|
CountByUser(ctx context.Context, userID uint) (int64, error)
|
|
GetStats(ctx context.Context) (*entity.PhotoStats, error)
|
|
} |