Replace presigned URL string fields (logoUrl, fileUrl, ndaFileName, etc.) with nested File references resolved through /api/files/v1/. Update console Relay queries and e2e coverage accordingly. Route NDA upload through filemanager.PutFile and return stable IAM org logo URLs for consistency with the files API. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
55 lines
1.7 KiB
Go
55 lines
1.7 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"
|
|
"fmt"
|
|
|
|
"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"
|
|
)
|
|
|
|
// Certificate is the resolver for the certificate field.
|
|
func (r *electronicSignatureResolver) Certificate(ctx context.Context, obj *types.ElectronicSignature) (*types.File, error) {
|
|
if _, err := r.authorize(ctx, obj.ID, probo.ActionElectronicSignatureGet); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if obj.Certificate == nil {
|
|
return nil, nil
|
|
}
|
|
|
|
return r.loadFile(ctx, obj.Certificate.ID)
|
|
}
|
|
|
|
// Events is the resolver for the events field.
|
|
func (r *electronicSignatureResolver) Events(ctx context.Context, obj *types.ElectronicSignature) ([]*types.ElectronicSignatureEvent, error) {
|
|
if _, err := r.authorize(ctx, obj.ID, probo.ActionElectronicSignatureGet); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
events, err := r.esign.GetEventsBySignatureID(ctx, obj.ID)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("cannot load signature events: %w", err)
|
|
}
|
|
|
|
result := make([]*types.ElectronicSignatureEvent, len(events))
|
|
for i := range events {
|
|
result[i] = types.NewElectronicSignatureEvent(events[i])
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ElectronicSignature returns schema.ElectronicSignatureResolver implementation.
|
|
func (r *Resolver) ElectronicSignature() schema.ElectronicSignatureResolver {
|
|
return &electronicSignatureResolver{r}
|
|
}
|
|
|
|
type electronicSignatureResolver struct{ *Resolver }
|