Rename resolver files from dot to underscore separation
Change gqlgen filename_template from {name}.resolvers.go to
{name}_resolvers.go across all three APIs for consistent Go naming.
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
56
pkg/server/api/console/v1/electronic_signature_resolvers.go
Normal file
56
pkg/server/api/console/v1/electronic_signature_resolvers.go
Normal file
@@ -0,0 +1,56 @@
|
||||
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.87
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.probo.inc/probo/pkg/server/api/console/v1/schema"
|
||||
"go.probo.inc/probo/pkg/server/api/console/v1/types"
|
||||
)
|
||||
|
||||
// CertificateFileURL is the resolver for the certificateFileUrl field.
|
||||
func (r *electronicSignatureResolver) CertificateFileURL(ctx context.Context, obj *types.ElectronicSignature) (*string, error) {
|
||||
signature, err := r.esign.GetSignatureByID(ctx, obj.ID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot load signature: %w", err)
|
||||
}
|
||||
|
||||
if signature.CertificateFileID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
url, err := r.esign.GenerateCertificateFileURL(ctx, *signature.CertificateFileID, 1*time.Hour)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot generate certificate file URL: %w", err)
|
||||
}
|
||||
|
||||
return &url, nil
|
||||
}
|
||||
|
||||
// Events is the resolver for the events field.
|
||||
func (r *electronicSignatureResolver) Events(ctx context.Context, obj *types.ElectronicSignature) ([]*types.ElectronicSignatureEvent, error) {
|
||||
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 }
|
||||
Reference in New Issue
Block a user