Expose alias field and set/remove mutations in console API
Adds an alias field to Document, Audit, and TrustCenterFile types. Introduces setTrustCenterAlias and removeTrustCenterAlias mutations with proper authorization and error handling. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -27,6 +27,16 @@ import (
|
||||
"go.probo.inc/probo/pkg/validator"
|
||||
)
|
||||
|
||||
// Alias is the resolver for the alias field.
|
||||
func (r *documentResolver) Alias(ctx context.Context, obj *types.Document) (*string, error) {
|
||||
scope, err := r.authorize(ctx, obj.ID, probo.ActionDocumentGet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return r.probo.TrustCenterAliases.GetByResourceID(ctx, scope, obj.ID)
|
||||
}
|
||||
|
||||
// Organization is the resolver for the organization field.
|
||||
func (r *documentResolver) Organization(ctx context.Context, obj *types.Document) (*types.Organization, error) {
|
||||
if _, err := r.authorize(ctx, obj.ID, probo.ActionOrganizationGet); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user