Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
Types ¶
type CreateResourceRequest ¶
type CreateResourceRequest struct {
Identifier string `json:"identifier" bson:"identifier"`
DisplayName string `json:"display_name" bson:"display_name"`
Actions []mongo_entity.Action `json:"actions,omitempty" bson:"actions"`
Type mongo_entity.ResourceType `json:"type,omitempty" bson:"type"`
}
func (CreateResourceRequest) Validate ¶
func (m CreateResourceRequest) Validate() error
type Filter ¶
type Filter struct {
Cursor int `json:"cursor" query:"cursor"`
Limit int `json:"limit" query:"limit"`
Name string `json:"name" query:"name"`
}
Pagination filter.
type PatchResource ¶
type PatchResource struct {
AddedActions []mongo_entity.Action `json:"added_actions,omitempty" bson:"added_actions"`
RemovedActions []string `json:"removed_actions,omitempty" bson:"removed_actions"`
}
type PatchResourceRequest ¶
type PatchResourceRequest struct {
AddedActions []mongo_entity.Action `json:"added_actions,omitempty" bson:"added_actions"`
RemovedActions []string `json:"removed_actions,omitempty" bson:"removed_actions"`
}
type Repository ¶
type Repository interface {
Get(ctx context.Context, org_id string, id string) (*mongo_entity.Resource, error)
Query(ctx context.Context, org_id string) (*[]mongo_entity.Resource, error)
Create(ctx context.Context, org_id string, resource mongo_entity.Resource) error
Update(ctx context.Context, org_id string, id string, update_resource UpdateResource) error
Patch(ctx context.Context, org_id string, id string, patch_resource PatchResource) error
Delete(ctx context.Context, org_id string, id string) error
CheckResourceExistById(ctx context.Context, org_id string, id string) (bool, error)
CheckResourceExistsByIdentifier(ctx context.Context, org_id string, key string) (bool, error)
CheckActionAlreadyAddedToResourceByIdentifier(ctx context.Context, org_id string, resource_id string, action_identifier string) (bool, error)
CheckActionExistsByIdentifier(ctx context.Context, org_id string, resource_identifier string, action_identifier string) (bool, error)
}
func NewRepository ¶
func NewRepository(mongodb *db.MongoDB) Repository
type Resource ¶
type Resource struct {
mongo_entity.Resource
}
type Service ¶
type Service interface {
Get(ctx context.Context, org_id string, id string) (Resource, error)
Query(ctx context.Context, org_id string, filter Filter) ([]Resource, error)
Create(ctx context.Context, org_id string, input CreateResourceRequest) (Resource, error)
Update(ctx context.Context, org_id string, id string, input UpdateResourceRequest) (Resource, error)
Patch(ctx context.Context, org_id string, id string, input PatchResourceRequest) (Resource, error)
Delete(ctx context.Context, org_id string, id string) error
}
func NewService ¶
func NewService(repo Repository, logger *zap.Logger) Service
type UpdateResource ¶
type UpdateResource struct {
DisplayName *string `json:"display_name" bson:"display_name"`
}
type UpdateResourceRequest ¶
type UpdateResourceRequest struct {
DisplayName *string `json:"display_name" bson:"display_name"`
}
Click to show internal directories.
Click to hide internal directories.