Files
probo/pkg/server/api/console/v1/common_third_party_resolvers.go
Ludovic Vielle 6c072a2f7b Use stable files API URLs for vendor logo fields
CommonThirdParty.logoUrl and TrustCenterReference.logoUrl were
returning expiring S3 presigned URLs, which break if cached or
shared past their TTL.

Replace with stable /api/files/v1/{id} application URLs.
file.Service now generates these via baseurl; a new filesign
package owns presigning for the files/v1 HTTP handler that
does the internal redirect.

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
2026-06-03 10:30:29 +02:00

43 lines
1.3 KiB
Go

package console_v1
// This file will be automatically regenerated based on the schema, any resolver
// implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.90
import (
"context"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/probo"
"go.probo.inc/probo/pkg/server/api/console/v1/schema"
"go.probo.inc/probo/pkg/server/api/console/v1/types"
"go.probo.inc/probo/pkg/server/gqlutils"
)
// LogoURL is the resolver for the logoUrl field.
func (r *commonThirdPartyResolver) LogoURL(ctx context.Context, obj *types.CommonThirdParty) (*string, error) {
if _, err := r.authorize(ctx, obj.ID, probo.ActionCommonThirdPartyGet); err != nil {
return nil, err
}
if obj.LogoFileID == nil {
return nil, nil
}
logoURL, err := r.thirdParty.GenerateLogoURL(ctx, *obj.LogoFileID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot generate common third party logo URL", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return logoURL, nil
}
// CommonThirdParty returns schema.CommonThirdPartyResolver implementation.
func (r *Resolver) CommonThirdParty() schema.CommonThirdPartyResolver {
return &commonThirdPartyResolver{r}
}
type commonThirdPartyResolver struct{ *Resolver }