v0.1
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"tyapi-server/internal/domains/product/entities"
|
||||
)
|
||||
|
||||
// ProductApiConfigRepository 产品API配置仓库接口
|
||||
type ProductApiConfigRepository interface {
|
||||
// 基础CRUD操作
|
||||
Create(ctx context.Context, config entities.ProductApiConfig) error
|
||||
Update(ctx context.Context, config entities.ProductApiConfig) error
|
||||
Delete(ctx context.Context, id string) error
|
||||
GetByID(ctx context.Context, id string) (*entities.ProductApiConfig, error)
|
||||
|
||||
// 根据产品ID查找配置
|
||||
FindByProductID(ctx context.Context, productID string) (*entities.ProductApiConfig, error)
|
||||
|
||||
// 根据产品代码查找配置
|
||||
FindByProductCode(ctx context.Context, productCode string) (*entities.ProductApiConfig, error)
|
||||
|
||||
// 批量获取配置
|
||||
FindByProductIDs(ctx context.Context, productIDs []string) ([]*entities.ProductApiConfig, error)
|
||||
|
||||
// 检查配置是否存在
|
||||
ExistsByProductID(ctx context.Context, productID string) (bool, error)
|
||||
}
|
||||
@@ -10,22 +10,30 @@ import (
|
||||
// ProductRepository 产品仓储接口
|
||||
type ProductRepository interface {
|
||||
interfaces.Repository[entities.Product]
|
||||
|
||||
|
||||
// 基础查询方法
|
||||
FindByCode(ctx context.Context, code string) (*entities.Product, error)
|
||||
FindByCategoryID(ctx context.Context, categoryID string) ([]*entities.Product, error)
|
||||
FindVisible(ctx context.Context) ([]*entities.Product, error)
|
||||
FindEnabled(ctx context.Context) ([]*entities.Product, error)
|
||||
|
||||
|
||||
// 复杂查询方法
|
||||
ListProducts(ctx context.Context, query *queries.ListProductsQuery) ([]*entities.Product, int64, error)
|
||||
|
||||
|
||||
// 业务查询方法
|
||||
FindSubscribableProducts(ctx context.Context, userID string) ([]*entities.Product, error)
|
||||
FindProductsByIDs(ctx context.Context, ids []string) ([]*entities.Product, error)
|
||||
|
||||
|
||||
// 统计方法
|
||||
CountByCategory(ctx context.Context, categoryID string) (int64, error)
|
||||
CountEnabled(ctx context.Context) (int64, error)
|
||||
CountVisible(ctx context.Context) (int64, error)
|
||||
}
|
||||
|
||||
// 组合包相关方法
|
||||
GetPackageItems(ctx context.Context, packageID string) ([]*entities.ProductPackageItem, error)
|
||||
CreatePackageItem(ctx context.Context, packageItem *entities.ProductPackageItem) error
|
||||
GetPackageItemByID(ctx context.Context, itemID string) (*entities.ProductPackageItem, error)
|
||||
UpdatePackageItem(ctx context.Context, packageItem *entities.ProductPackageItem) error
|
||||
DeletePackageItem(ctx context.Context, itemID string) error
|
||||
DeletePackageItemsByPackageID(ctx context.Context, packageID string) error
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package queries
|
||||
|
||||
// ListSubscriptionsQuery 订阅列表查询
|
||||
type ListSubscriptionsQuery struct {
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
UserID string `json:"user_id"`
|
||||
Keyword string `json:"keyword"`
|
||||
SortBy string `json:"sort_by"`
|
||||
SortOrder string `json:"sort_order"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
UserID string `json:"user_id"`
|
||||
Keyword string `json:"keyword"`
|
||||
SortBy string `json:"sort_by"`
|
||||
SortOrder string `json:"sort_order"`
|
||||
}
|
||||
|
||||
// GetSubscriptionQuery 获取订阅详情查询
|
||||
@@ -23,4 +23,4 @@ type GetUserSubscriptionsQuery struct {
|
||||
// GetProductSubscriptionsQuery 获取产品订阅查询
|
||||
type GetProductSubscriptionsQuery struct {
|
||||
ProductID string `json:"product_id"`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user