Some checks failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
29 lines
748 B
Go
29 lines
748 B
Go
package recipientdb
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/tech/sendico/pkg/db/repository"
|
|
"github.com/tech/sendico/pkg/merrors"
|
|
"github.com/tech/sendico/pkg/model"
|
|
mauth "github.com/tech/sendico/pkg/mutil/db/auth"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
func (db *RecipientDB) List(ctx context.Context, accountRef, organizationRef, _ primitive.ObjectID, cursor *model.ViewCursor) ([]model.Recipient, error) {
|
|
res, err := mauth.GetProtectedObjects[model.Recipient](
|
|
ctx,
|
|
db.DBImp.Logger,
|
|
accountRef, organizationRef, model.ActionRead,
|
|
repository.OrgFilter(organizationRef),
|
|
cursor,
|
|
db.Enforcer,
|
|
db.DBImp.Repository,
|
|
)
|
|
if errors.Is(err, merrors.ErrNoData) {
|
|
return []model.Recipient{}, nil
|
|
}
|
|
return res, err
|
|
}
|