From a206de79ccec3e9bf96a05fa8f58b590db0adc8a Mon Sep 17 00:00:00 2001 From: John Schaeffer Date: Thu, 7 Sep 2023 19:40:01 +0000 Subject: [PATCH] Remove unused types and functions Signed-off-by: John Schaeffer --- internal/api/relationships.go | 37 ----------------------------------- internal/api/types.go | 22 --------------------- 2 files changed, 59 deletions(-) diff --git a/internal/api/relationships.go b/internal/api/relationships.go index 90974f48..c633da81 100644 --- a/internal/api/relationships.go +++ b/internal/api/relationships.go @@ -3,49 +3,12 @@ package api import ( "net/http" - "go.infratographer.com/permissions-api/internal/types" - "github.com/labstack/echo/v4" "go.infratographer.com/x/gidx" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) -func (r *Router) buildRelationship(resource types.Resource, item createRelationshipItem) (types.Relationship, error) { - itemID, err := gidx.Parse(item.SubjectID) - if err != nil { - return types.Relationship{}, err - } - - itemResource, err := r.engine.NewResourceFromID(itemID) - if err != nil { - return types.Relationship{}, err - } - - out := types.Relationship{ - Subject: itemResource, - Relation: item.Relation, - Resource: resource, - } - - return out, nil -} - -func (r *Router) buildRelationships(subjResource types.Resource, items []createRelationshipItem) ([]types.Relationship, error) { - out := make([]types.Relationship, len(items)) - - for i, item := range items { - rel, err := r.buildRelationship(subjResource, item) - if err != nil { - return nil, err - } - - out[i] = rel - } - - return out, nil -} - func (r *Router) relationshipListFrom(c echo.Context) error { resourceIDStr := c.Param("id") diff --git a/internal/api/types.go b/internal/api/types.go index dbab6e9a..018ea06d 100644 --- a/internal/api/types.go +++ b/internal/api/types.go @@ -25,28 +25,6 @@ type listRolesResponse struct { Data []roleResponse `json:"data"` } -type createRelationshipItem struct { - Relation string `json:"relation" binding:"required"` - SubjectID string `json:"subject_id" binding:"required"` -} - -type createRelationshipsRequest struct { - Relationships []createRelationshipItem `json:"relationships" binding:"required"` -} - -type createRelationshipsResponse struct { - Success bool `json:"success"` -} - -type deleteRelationshipRequest struct { - Relation string `json:"relation" binding:"required"` - SubjectID string `json:"subject_id" binding:"required"` -} - -type deleteRelationshipsResponse struct { - Success bool `json:"success"` -} - type relationshipItem struct { ResourceID string `json:"resource_id,omitempty"` Relation string `json:"relation"`