Remove dead code

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-01-05 19:54:06 +01:00
parent f8accc2d40
commit c4597b34fd
8 changed files with 49 additions and 1191 deletions

View File

@@ -269,64 +269,6 @@ LIMIT 1;
}, nil
}
func LoadRoleByIdentityAndEntityIDOnly(
ctx context.Context,
conn pg.Conn,
scope Scoper,
identityID gid.GID,
entityID gid.GID,
) (MembershipRole, error) {
entityType := entityID.EntityType()
if entityType == OrganizationEntityType {
query := `
SELECT role
FROM iam_memberships
WHERE
identity_id = $1
AND tenant_id = $2
AND organization_id = $3
LIMIT 1;
`
var role MembershipRole
err := conn.QueryRow(ctx, query, identityID, scope.GetTenantID(), entityID).Scan(&role)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
return "", ErrResourceNotFound
}
return "", fmt.Errorf("cannot query role: %w", err)
}
return role, nil
}
tableName, ok := EntityTable(entityType)
if !ok {
return "", fmt.Errorf("unsupported entity type for role lookup: %d", entityType)
}
query := `
SELECT m.role
FROM iam_memberships m
WHERE
m.identity_id = $1
AND tenant_id = $2
AND m.organization_id = (SELECT organization_id FROM ` + tableName + ` WHERE id = $3)
LIMIT 1;
`
var role MembershipRole
err := conn.QueryRow(ctx, query, identityID, scope.GetTenantID(), entityID).Scan(&role)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
return "", ErrResourceNotFound
}
return "", fmt.Errorf("cannot query role: %w", err)
}
return role, nil
}
func (m *Membership) LoadByIdentityAndOrg(
ctx context.Context,
conn pg.Conn,