Enhance ProductRoutes to include component report handling and related routes

This commit is contained in:
2025-12-17 16:13:13 +08:00
parent 451d869361
commit cc3472ff40
5 changed files with 1171 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
package repositories
import (
"context"
"tyapi-server/internal/domains/product/entities"
)
// ComponentReportRepository 组件报告仓储接口
type ComponentReportRepository interface {
// 下载记录相关
CreateDownload(ctx context.Context, download *entities.ComponentReportDownload) (*entities.ComponentReportDownload, error)
UpdateDownload(ctx context.Context, download *entities.ComponentReportDownload) error
GetDownloadByID(ctx context.Context, id string) (*entities.ComponentReportDownload, error)
GetUserDownloads(ctx context.Context, userID string, productID *string) ([]*entities.ComponentReportDownload, error)
HasUserDownloaded(ctx context.Context, userID string, productCode string) (bool, error)
GetUserDownloadedProductCodes(ctx context.Context, userID string) ([]string, error)
GetDownloadByPaymentOrderID(ctx context.Context, orderID string) (*entities.ComponentReportDownload, error)
// 缓存相关
GetCacheByProductCode(ctx context.Context, productCode string) (*entities.ComponentReportCache, error)
CreateCache(ctx context.Context, cache *entities.ComponentReportCache) error
UpdateCache(ctx context.Context, cache *entities.ComponentReportCache) error
}