refactor(backend): 引入端口接口模式
This commit is contained in:
22
backend/internal/service/ports/redeem_code.go
Normal file
22
backend/internal/service/ports/redeem_code.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package ports
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sub2api/internal/model"
|
||||
"sub2api/internal/pkg/pagination"
|
||||
)
|
||||
|
||||
type RedeemCodeRepository interface {
|
||||
Create(ctx context.Context, code *model.RedeemCode) error
|
||||
CreateBatch(ctx context.Context, codes []model.RedeemCode) error
|
||||
GetByID(ctx context.Context, id int64) (*model.RedeemCode, error)
|
||||
GetByCode(ctx context.Context, code string) (*model.RedeemCode, error)
|
||||
Update(ctx context.Context, code *model.RedeemCode) error
|
||||
Delete(ctx context.Context, id int64) error
|
||||
Use(ctx context.Context, id, userID int64) error
|
||||
|
||||
List(ctx context.Context, params pagination.PaginationParams) ([]model.RedeemCode, *pagination.PaginationResult, error)
|
||||
ListWithFilters(ctx context.Context, params pagination.PaginationParams, codeType, status, search string) ([]model.RedeemCode, *pagination.PaginationResult, error)
|
||||
ListByUser(ctx context.Context, userID int64, limit int) ([]model.RedeemCode, error)
|
||||
}
|
||||
Reference in New Issue
Block a user