Files
photography/backend-old/internal/repository/interfaces/photo_repository.go
xujiang 010fe2a8c7
Some checks failed
部署后端服务 / 🧪 测试后端 (push) Failing after 5m8s
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped
fix
2025-07-10 18:09:11 +08:00

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)
}