template-monorepo/internal/model/permission/domain/repository/role_mapping.go

31 lines
839 B
Go

package repository
import (
"context"
"gateway/internal/model/permission/domain/entity"
"gateway/internal/model/permission/domain/enum"
)
// RoleMappingRepository persists external IdP group → internal role maps.
type RoleMappingRepository interface {
Insert(ctx context.Context, rm *entity.RoleMapping) error
Upsert(ctx context.Context, rm *entity.RoleMapping) error
Delete(ctx context.Context, tenantID string, source enum.RoleSource, externalKey string) error
DeleteByRole(ctx context.Context, tenantID, roleID string) (int64, error)
GetByExternal(
ctx context.Context,
tenantID string,
source enum.RoleSource,
externalKey string,
) (*entity.RoleMapping, error)
ListByTenant(
ctx context.Context,
tenantID string,
source *enum.RoleSource,
offset, limit int64,
) ([]*entity.RoleMapping, int64, error)
}