Bootstrap copied BFF and local accounts with public Sendico contracts (#34)
This commit is contained in:
1 parent
67dc5b5b1e
commit
7062672a87
556 files changed
+42291
-777
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/db/template"
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/mlogger"
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/model"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// ArchivableDB implements archive operations with permission checking
|
||||
type ArchivableDB[T model.PermissionBoundStorable] interface {
|
||||
// SetArchived sets the archived status of an entity with permission checking
|
||||
SetArchived(ctx context.Context, accountRef, objectRef bson.ObjectID, archived bool) error
|
||||
// IsArchived checks if an entity is archived with permission checking
|
||||
IsArchived(ctx context.Context, accountRef, objectRef bson.ObjectID) (bool, error)
|
||||
|
||||
// Archive archives an entity with permission checking (sets archived to true)
|
||||
Archive(ctx context.Context, accountRef, objectRef bson.ObjectID) error
|
||||
|
||||
// Unarchive unarchives an entity with permission checking (sets archived to false)
|
||||
Unarchive(ctx context.Context, accountRef, objectRef bson.ObjectID) error
|
||||
}
|
||||
|
||||
// NewArchivableDB creates a new auth.ArchivableDB instance
|
||||
func NewArchivableDB[T model.PermissionBoundStorable](
|
||||
dbImp *template.DBImp[T],
|
||||
logger mlogger.Logger,
|
||||
enforcer Enforcer,
|
||||
createEmpty func() T,
|
||||
getArchivable func(T) model.Archivable,
|
||||
) ArchivableDB[T] {
|
||||
return newArchivableDBImp(dbImp, logger, enforcer, createEmpty, getArchivable)
|
||||
}
|
||||
Reference in new issue
Block a user