feat(kol): marketplace and admin subscription repo queries
This commit is contained in:
@@ -54,6 +54,7 @@ type CreateAccessRowInput struct {
|
||||
type KolSubscriptionRepository interface {
|
||||
Create(ctx context.Context, tenantID, packageID int64) (*KolSubscription, error)
|
||||
GetByID(ctx context.Context, tenantID, id int64) (*KolSubscription, error)
|
||||
GetByIDAny(ctx context.Context, id int64) (*KolSubscription, error)
|
||||
GetActiveForTenant(ctx context.Context, tenantID, packageID int64) (*KolSubscription, error)
|
||||
ListByTenant(ctx context.Context, tenantID int64) ([]KolSubscription, error)
|
||||
ListActiveSubscribersForPackage(ctx context.Context, packageID int64) ([]KolSubscription, error)
|
||||
@@ -117,6 +118,18 @@ func (r *kolSubscriptionRepository) GetByID(ctx context.Context, tenantID, id in
|
||||
return &sub, nil
|
||||
}
|
||||
|
||||
func (r *kolSubscriptionRepository) GetByIDAny(ctx context.Context, id int64) (*KolSubscription, error) {
|
||||
row, err := r.q.GetKolSubscriptionByIDAny(ctx, id)
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
sub := mapKolSubscription(row)
|
||||
return &sub, nil
|
||||
}
|
||||
|
||||
func (r *kolSubscriptionRepository) GetActiveForTenant(ctx context.Context, tenantID, packageID int64) (*KolSubscription, error) {
|
||||
row, err := r.q.GetActiveKolSubscription(ctx, generated.GetActiveKolSubscriptionParams{
|
||||
TenantID: tenantID,
|
||||
|
||||
Reference in New Issue
Block a user