template-monorepo/internal/model/permission/domain/entity/role_permission.go

21 lines
793 B
Go
Raw Normal View History

package entity
import "go.mongodb.org/mongo-driver/v2/bson"
// RolePermission joins a Role to a Permission catalog entry. When the
// usecase adds a leaf permission it MUST also insert all parent permission
// IDs (see usecase.permission_tree.GetFullParentPermissionIDs).
type RolePermission struct {
ID bson.ObjectID `bson:"_id,omitempty"`
TenantID string `bson:"tenant_id"`
RoleID string `bson:"role_id"` // Role._id hex
PermissionID string `bson:"permission_id"` // Permission._id hex
CreateAt int64 `bson:"create_at"`
UpdateAt int64 `bson:"update_at"`
}
// CollectionName returns the MongoDB collection for role↔permission joins.
func (RolePermission) CollectionName() string {
return "role_permissions"
}