Add bulk publish document version
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -139,61 +139,26 @@ func (s DocumentService) GenerateChangelog(
|
|||||||
return changelog, nil
|
return changelog, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DocumentService) PublishVersion(
|
func (s *DocumentService) BulkPublishVersions(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
documentID gid.GID,
|
documentIds []gid.GID,
|
||||||
publishedBy gid.GID,
|
publishedBy gid.GID,
|
||||||
changelog *string,
|
changelog string,
|
||||||
) (*coredata.Document, *coredata.DocumentVersion, error) {
|
) ([]*coredata.DocumentVersion, []*coredata.Document, error) {
|
||||||
document := &coredata.Document{}
|
var publishedVersions []*coredata.DocumentVersion
|
||||||
documentVersion := &coredata.DocumentVersion{}
|
var updatedDocuments []*coredata.Document
|
||||||
publishedVersion := &coredata.DocumentVersion{}
|
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
err := s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(tx pg.Conn) error {
|
func(tx pg.Conn) error {
|
||||||
if err := document.LoadByID(ctx, tx, s.svc.scope, documentID); err != nil {
|
for _, documentID := range documentIds {
|
||||||
return fmt.Errorf("cannot load document %q: %w", documentID, err)
|
document, version, err := s.publishVersionInTx(ctx, tx, documentID, publishedBy, &changelog)
|
||||||
}
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot publish document %q: %w", documentID, err)
|
||||||
if err := documentVersion.LoadLatestVersion(ctx, tx, s.svc.scope, documentID); err != nil {
|
|
||||||
return fmt.Errorf("cannot load current draft: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if documentVersion.Status != coredata.DocumentStatusDraft {
|
|
||||||
return fmt.Errorf("cannot publish version")
|
|
||||||
}
|
|
||||||
|
|
||||||
if document.CurrentPublishedVersion != nil {
|
|
||||||
if err := publishedVersion.LoadByDocumentIDAndVersionNumber(ctx, tx, s.svc.scope, documentID, *document.CurrentPublishedVersion); err != nil {
|
|
||||||
return fmt.Errorf("cannot load published version: %w", err)
|
|
||||||
}
|
}
|
||||||
if publishedVersion.Content == documentVersion.Content &&
|
|
||||||
publishedVersion.Title == documentVersion.Title &&
|
|
||||||
publishedVersion.OwnerID == documentVersion.OwnerID {
|
|
||||||
return fmt.Errorf("cannot publish version: no changes detected")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if changelog != nil {
|
publishedVersions = append(publishedVersions, version)
|
||||||
documentVersion.Changelog = *changelog
|
updatedDocuments = append(updatedDocuments, document)
|
||||||
}
|
|
||||||
|
|
||||||
document.CurrentPublishedVersion = &documentVersion.VersionNumber
|
|
||||||
document.UpdatedAt = now
|
|
||||||
|
|
||||||
documentVersion.Status = coredata.DocumentStatusPublished
|
|
||||||
documentVersion.PublishedAt = &now
|
|
||||||
documentVersion.PublishedBy = &publishedBy
|
|
||||||
documentVersion.UpdatedAt = now
|
|
||||||
|
|
||||||
if err := document.Update(ctx, tx, s.svc.scope); err != nil {
|
|
||||||
return fmt.Errorf("cannot update document: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := documentVersion.Update(ctx, tx, s.svc.scope); err != nil {
|
|
||||||
return fmt.Errorf("cannot update document version: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -204,6 +169,96 @@ func (s *DocumentService) PublishVersion(
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return publishedVersions, updatedDocuments, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DocumentService) PublishVersion(
|
||||||
|
ctx context.Context,
|
||||||
|
documentID gid.GID,
|
||||||
|
publishedBy gid.GID,
|
||||||
|
changelog *string,
|
||||||
|
) (*coredata.Document, *coredata.DocumentVersion, error) {
|
||||||
|
var document *coredata.Document
|
||||||
|
var documentVersion *coredata.DocumentVersion
|
||||||
|
|
||||||
|
err := s.svc.pg.WithTx(
|
||||||
|
ctx,
|
||||||
|
func(tx pg.Conn) error {
|
||||||
|
var err error
|
||||||
|
document, documentVersion, err = s.publishVersionInTx(ctx, tx, documentID, publishedBy, changelog)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return document, documentVersion, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DocumentService) publishVersionInTx(
|
||||||
|
ctx context.Context,
|
||||||
|
tx pg.Conn,
|
||||||
|
documentID gid.GID,
|
||||||
|
publishedBy gid.GID,
|
||||||
|
changelog *string,
|
||||||
|
) (*coredata.Document, *coredata.DocumentVersion, error) {
|
||||||
|
document := &coredata.Document{}
|
||||||
|
documentVersion := &coredata.DocumentVersion{}
|
||||||
|
publishedVersion := &coredata.DocumentVersion{}
|
||||||
|
people := &coredata.People{}
|
||||||
|
now := time.Now()
|
||||||
|
|
||||||
|
if err := people.LoadByID(ctx, tx, s.svc.scope, publishedBy); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("cannot load people: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := document.LoadByID(ctx, tx, s.svc.scope, documentID); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("cannot load document %q: %w", documentID, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := documentVersion.LoadLatestVersion(ctx, tx, s.svc.scope, documentID); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("cannot load current draft: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if documentVersion.Status != coredata.DocumentStatusDraft {
|
||||||
|
return nil, nil, fmt.Errorf("cannot publish version")
|
||||||
|
}
|
||||||
|
|
||||||
|
if document.CurrentPublishedVersion != nil {
|
||||||
|
if err := publishedVersion.LoadByDocumentIDAndVersionNumber(ctx, tx, s.svc.scope, documentID, *document.CurrentPublishedVersion); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("cannot load published version: %w", err)
|
||||||
|
}
|
||||||
|
if publishedVersion.Content == documentVersion.Content &&
|
||||||
|
publishedVersion.Title == documentVersion.Title &&
|
||||||
|
publishedVersion.OwnerID == documentVersion.OwnerID {
|
||||||
|
return nil, nil, fmt.Errorf("cannot publish version: no changes detected")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if changelog != nil {
|
||||||
|
documentVersion.Changelog = *changelog
|
||||||
|
}
|
||||||
|
|
||||||
|
document.CurrentPublishedVersion = &documentVersion.VersionNumber
|
||||||
|
document.UpdatedAt = now
|
||||||
|
|
||||||
|
documentVersion.Status = coredata.DocumentStatusPublished
|
||||||
|
documentVersion.PublishedAt = &now
|
||||||
|
if publishedBy != gid.Nil {
|
||||||
|
documentVersion.PublishedBy = &people.ID
|
||||||
|
}
|
||||||
|
documentVersion.UpdatedAt = now
|
||||||
|
|
||||||
|
if err := document.Update(ctx, tx, s.svc.scope); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("cannot update document: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := documentVersion.Update(ctx, tx, s.svc.scope); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("cannot update document version: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return document, documentVersion, nil
|
return document, documentVersion, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1384,6 +1384,9 @@ type Mutation {
|
|||||||
publishDocumentVersion(
|
publishDocumentVersion(
|
||||||
input: PublishDocumentVersionInput!
|
input: PublishDocumentVersionInput!
|
||||||
): PublishDocumentVersionPayload!
|
): PublishDocumentVersionPayload!
|
||||||
|
bulkPublishDocumentVersions(
|
||||||
|
input: BulkPublishDocumentVersionsInput!
|
||||||
|
): BulkPublishDocumentVersionsPayload!
|
||||||
generateDocumentChangelog(
|
generateDocumentChangelog(
|
||||||
input: GenerateDocumentChangelogInput!
|
input: GenerateDocumentChangelogInput!
|
||||||
): GenerateDocumentChangelogPayload!
|
): GenerateDocumentChangelogPayload!
|
||||||
@@ -2099,6 +2102,16 @@ type RequestSignaturePayload {
|
|||||||
documentVersionSignatureEdge: DocumentVersionSignatureEdge!
|
documentVersionSignatureEdge: DocumentVersionSignatureEdge!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input BulkPublishDocumentVersionsInput {
|
||||||
|
documentIds: [ID!]!
|
||||||
|
changelog: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type BulkPublishDocumentVersionsPayload {
|
||||||
|
documentVersionEdges: [DocumentVersionEdge!]!
|
||||||
|
documentEdges: [DocumentEdge!]!
|
||||||
|
}
|
||||||
|
|
||||||
input PublishDocumentVersionInput {
|
input PublishDocumentVersionInput {
|
||||||
documentId: ID!
|
documentId: ID!
|
||||||
changelog: String
|
changelog: String
|
||||||
|
|||||||
@@ -111,6 +111,11 @@ type ComplexityRoot struct {
|
|||||||
Task func(childComplexity int) int
|
Task func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BulkPublishDocumentVersionsPayload struct {
|
||||||
|
DocumentEdges func(childComplexity int) int
|
||||||
|
DocumentVersionEdges func(childComplexity int) int
|
||||||
|
}
|
||||||
|
|
||||||
CancelSignatureRequestPayload struct {
|
CancelSignatureRequestPayload struct {
|
||||||
DeletedDocumentVersionSignatureID func(childComplexity int) int
|
DeletedDocumentVersionSignatureID func(childComplexity int) int
|
||||||
}
|
}
|
||||||
@@ -508,6 +513,7 @@ type ComplexityRoot struct {
|
|||||||
Mutation struct {
|
Mutation struct {
|
||||||
AssessVendor func(childComplexity int, input types.AssessVendorInput) int
|
AssessVendor func(childComplexity int, input types.AssessVendorInput) int
|
||||||
AssignTask func(childComplexity int, input types.AssignTaskInput) int
|
AssignTask func(childComplexity int, input types.AssignTaskInput) int
|
||||||
|
BulkPublishDocumentVersions func(childComplexity int, input types.BulkPublishDocumentVersionsInput) int
|
||||||
CancelSignatureRequest func(childComplexity int, input types.CancelSignatureRequestInput) int
|
CancelSignatureRequest func(childComplexity int, input types.CancelSignatureRequestInput) int
|
||||||
ConfirmEmail func(childComplexity int, input types.ConfirmEmailInput) int
|
ConfirmEmail func(childComplexity int, input types.ConfirmEmailInput) int
|
||||||
CreateAsset func(childComplexity int, input types.CreateAssetInput) int
|
CreateAsset func(childComplexity int, input types.CreateAssetInput) int
|
||||||
@@ -1024,6 +1030,7 @@ type MutationResolver interface {
|
|||||||
UpdateDocument(ctx context.Context, input types.UpdateDocumentInput) (*types.UpdateDocumentPayload, error)
|
UpdateDocument(ctx context.Context, input types.UpdateDocumentInput) (*types.UpdateDocumentPayload, error)
|
||||||
DeleteDocument(ctx context.Context, input types.DeleteDocumentInput) (*types.DeleteDocumentPayload, error)
|
DeleteDocument(ctx context.Context, input types.DeleteDocumentInput) (*types.DeleteDocumentPayload, error)
|
||||||
PublishDocumentVersion(ctx context.Context, input types.PublishDocumentVersionInput) (*types.PublishDocumentVersionPayload, error)
|
PublishDocumentVersion(ctx context.Context, input types.PublishDocumentVersionInput) (*types.PublishDocumentVersionPayload, error)
|
||||||
|
BulkPublishDocumentVersions(ctx context.Context, input types.BulkPublishDocumentVersionsInput) (*types.BulkPublishDocumentVersionsPayload, error)
|
||||||
GenerateDocumentChangelog(ctx context.Context, input types.GenerateDocumentChangelogInput) (*types.GenerateDocumentChangelogPayload, error)
|
GenerateDocumentChangelog(ctx context.Context, input types.GenerateDocumentChangelogInput) (*types.GenerateDocumentChangelogPayload, error)
|
||||||
CreateDraftDocumentVersion(ctx context.Context, input types.CreateDraftDocumentVersionInput) (*types.CreateDraftDocumentVersionPayload, error)
|
CreateDraftDocumentVersion(ctx context.Context, input types.CreateDraftDocumentVersionInput) (*types.CreateDraftDocumentVersionPayload, error)
|
||||||
UpdateDocumentVersion(ctx context.Context, input types.UpdateDocumentVersionInput) (*types.UpdateDocumentVersionPayload, error)
|
UpdateDocumentVersion(ctx context.Context, input types.UpdateDocumentVersionInput) (*types.UpdateDocumentVersionPayload, error)
|
||||||
@@ -1259,6 +1266,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.AssignTaskPayload.Task(childComplexity), true
|
return e.complexity.AssignTaskPayload.Task(childComplexity), true
|
||||||
|
|
||||||
|
case "BulkPublishDocumentVersionsPayload.documentEdges":
|
||||||
|
if e.complexity.BulkPublishDocumentVersionsPayload.DocumentEdges == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.BulkPublishDocumentVersionsPayload.DocumentEdges(childComplexity), true
|
||||||
|
|
||||||
|
case "BulkPublishDocumentVersionsPayload.documentVersionEdges":
|
||||||
|
if e.complexity.BulkPublishDocumentVersionsPayload.DocumentVersionEdges == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.BulkPublishDocumentVersionsPayload.DocumentVersionEdges(childComplexity), true
|
||||||
|
|
||||||
case "CancelSignatureRequestPayload.deletedDocumentVersionSignatureId":
|
case "CancelSignatureRequestPayload.deletedDocumentVersionSignatureId":
|
||||||
if e.complexity.CancelSignatureRequestPayload.DeletedDocumentVersionSignatureID == nil {
|
if e.complexity.CancelSignatureRequestPayload.DeletedDocumentVersionSignatureID == nil {
|
||||||
break
|
break
|
||||||
@@ -2605,6 +2626,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.Mutation.AssignTask(childComplexity, args["input"].(types.AssignTaskInput)), true
|
return e.complexity.Mutation.AssignTask(childComplexity, args["input"].(types.AssignTaskInput)), true
|
||||||
|
|
||||||
|
case "Mutation.bulkPublishDocumentVersions":
|
||||||
|
if e.complexity.Mutation.BulkPublishDocumentVersions == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
args, err := ec.field_Mutation_bulkPublishDocumentVersions_args(ctx, rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Mutation.BulkPublishDocumentVersions(childComplexity, args["input"].(types.BulkPublishDocumentVersionsInput)), true
|
||||||
|
|
||||||
case "Mutation.cancelSignatureRequest":
|
case "Mutation.cancelSignatureRequest":
|
||||||
if e.complexity.Mutation.CancelSignatureRequest == nil {
|
if e.complexity.Mutation.CancelSignatureRequest == nil {
|
||||||
break
|
break
|
||||||
@@ -4721,6 +4754,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
|
|||||||
ec.unmarshalInputAssessVendorInput,
|
ec.unmarshalInputAssessVendorInput,
|
||||||
ec.unmarshalInputAssetOrder,
|
ec.unmarshalInputAssetOrder,
|
||||||
ec.unmarshalInputAssignTaskInput,
|
ec.unmarshalInputAssignTaskInput,
|
||||||
|
ec.unmarshalInputBulkPublishDocumentVersionsInput,
|
||||||
ec.unmarshalInputCancelSignatureRequestInput,
|
ec.unmarshalInputCancelSignatureRequestInput,
|
||||||
ec.unmarshalInputConfirmEmailInput,
|
ec.unmarshalInputConfirmEmailInput,
|
||||||
ec.unmarshalInputConnectorOrder,
|
ec.unmarshalInputConnectorOrder,
|
||||||
@@ -6291,6 +6325,9 @@ type Mutation {
|
|||||||
publishDocumentVersion(
|
publishDocumentVersion(
|
||||||
input: PublishDocumentVersionInput!
|
input: PublishDocumentVersionInput!
|
||||||
): PublishDocumentVersionPayload!
|
): PublishDocumentVersionPayload!
|
||||||
|
bulkPublishDocumentVersions(
|
||||||
|
input: BulkPublishDocumentVersionsInput!
|
||||||
|
): BulkPublishDocumentVersionsPayload!
|
||||||
generateDocumentChangelog(
|
generateDocumentChangelog(
|
||||||
input: GenerateDocumentChangelogInput!
|
input: GenerateDocumentChangelogInput!
|
||||||
): GenerateDocumentChangelogPayload!
|
): GenerateDocumentChangelogPayload!
|
||||||
@@ -7006,6 +7043,16 @@ type RequestSignaturePayload {
|
|||||||
documentVersionSignatureEdge: DocumentVersionSignatureEdge!
|
documentVersionSignatureEdge: DocumentVersionSignatureEdge!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input BulkPublishDocumentVersionsInput {
|
||||||
|
documentIds: [ID!]!
|
||||||
|
changelog: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type BulkPublishDocumentVersionsPayload {
|
||||||
|
documentVersionEdges: [DocumentVersionEdge!]!
|
||||||
|
documentEdges: [DocumentEdge!]!
|
||||||
|
}
|
||||||
|
|
||||||
input PublishDocumentVersionInput {
|
input PublishDocumentVersionInput {
|
||||||
documentId: ID!
|
documentId: ID!
|
||||||
changelog: String
|
changelog: String
|
||||||
@@ -8548,6 +8595,29 @@ func (ec *executionContext) field_Mutation_assignTask_argsInput(
|
|||||||
return zeroVal, nil
|
return zeroVal, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) field_Mutation_bulkPublishDocumentVersions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||||
|
var err error
|
||||||
|
args := map[string]any{}
|
||||||
|
arg0, err := ec.field_Mutation_bulkPublishDocumentVersions_argsInput(ctx, rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
args["input"] = arg0
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
func (ec *executionContext) field_Mutation_bulkPublishDocumentVersions_argsInput(
|
||||||
|
ctx context.Context,
|
||||||
|
rawArgs map[string]any,
|
||||||
|
) (types.BulkPublishDocumentVersionsInput, error) {
|
||||||
|
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
|
||||||
|
if tmp, ok := rawArgs["input"]; ok {
|
||||||
|
return ec.unmarshalNBulkPublishDocumentVersionsInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐBulkPublishDocumentVersionsInput(ctx, tmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
var zeroVal types.BulkPublishDocumentVersionsInput
|
||||||
|
return zeroVal, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Mutation_cancelSignatureRequest_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
func (ec *executionContext) field_Mutation_cancelSignatureRequest_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]any{}
|
args := map[string]any{}
|
||||||
@@ -13105,6 +13175,106 @@ func (ec *executionContext) fieldContext_AssignTaskPayload_task(_ context.Contex
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _BulkPublishDocumentVersionsPayload_documentVersionEdges(ctx context.Context, field graphql.CollectedField, obj *types.BulkPublishDocumentVersionsPayload) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_BulkPublishDocumentVersionsPayload_documentVersionEdges(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.DocumentVersionEdges, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.([]*types.DocumentVersionEdge)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNDocumentVersionEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDocumentVersionEdgeᚄ(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_BulkPublishDocumentVersionsPayload_documentVersionEdges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "BulkPublishDocumentVersionsPayload",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "cursor":
|
||||||
|
return ec.fieldContext_DocumentVersionEdge_cursor(ctx, field)
|
||||||
|
case "node":
|
||||||
|
return ec.fieldContext_DocumentVersionEdge_node(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type DocumentVersionEdge", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _BulkPublishDocumentVersionsPayload_documentEdges(ctx context.Context, field graphql.CollectedField, obj *types.BulkPublishDocumentVersionsPayload) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_BulkPublishDocumentVersionsPayload_documentEdges(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.DocumentEdges, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.([]*types.DocumentEdge)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNDocumentEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDocumentEdgeᚄ(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_BulkPublishDocumentVersionsPayload_documentEdges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "BulkPublishDocumentVersionsPayload",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "cursor":
|
||||||
|
return ec.fieldContext_DocumentEdge_cursor(ctx, field)
|
||||||
|
case "node":
|
||||||
|
return ec.fieldContext_DocumentEdge_node(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type DocumentEdge", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _CancelSignatureRequestPayload_deletedDocumentVersionSignatureId(ctx context.Context, field graphql.CollectedField, obj *types.CancelSignatureRequestPayload) (ret graphql.Marshaler) {
|
func (ec *executionContext) _CancelSignatureRequestPayload_deletedDocumentVersionSignatureId(ctx context.Context, field graphql.CollectedField, obj *types.CancelSignatureRequestPayload) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_CancelSignatureRequestPayload_deletedDocumentVersionSignatureId(ctx, field)
|
fc, err := ec.fieldContext_CancelSignatureRequestPayload_deletedDocumentVersionSignatureId(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -25071,6 +25241,67 @@ func (ec *executionContext) fieldContext_Mutation_publishDocumentVersion(ctx con
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Mutation_bulkPublishDocumentVersions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Mutation_bulkPublishDocumentVersions(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return ec.resolvers.Mutation().BulkPublishDocumentVersions(rctx, fc.Args["input"].(types.BulkPublishDocumentVersionsInput))
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*types.BulkPublishDocumentVersionsPayload)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNBulkPublishDocumentVersionsPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐBulkPublishDocumentVersionsPayload(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Mutation_bulkPublishDocumentVersions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Mutation",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: true,
|
||||||
|
IsResolver: true,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "documentVersionEdges":
|
||||||
|
return ec.fieldContext_BulkPublishDocumentVersionsPayload_documentVersionEdges(ctx, field)
|
||||||
|
case "documentEdges":
|
||||||
|
return ec.fieldContext_BulkPublishDocumentVersionsPayload_documentEdges(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type BulkPublishDocumentVersionsPayload", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
err = ec.Recover(ctx, r)
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
if fc.Args, err = ec.field_Mutation_bulkPublishDocumentVersions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return fc, err
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Mutation_generateDocumentChangelog(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Mutation_generateDocumentChangelog(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Mutation_generateDocumentChangelog(ctx, field)
|
fc, err := ec.fieldContext_Mutation_generateDocumentChangelog(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -37409,6 +37640,40 @@ func (ec *executionContext) unmarshalInputAssignTaskInput(ctx context.Context, o
|
|||||||
return it, nil
|
return it, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalInputBulkPublishDocumentVersionsInput(ctx context.Context, obj any) (types.BulkPublishDocumentVersionsInput, error) {
|
||||||
|
var it types.BulkPublishDocumentVersionsInput
|
||||||
|
asMap := map[string]any{}
|
||||||
|
for k, v := range obj.(map[string]any) {
|
||||||
|
asMap[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldsInOrder := [...]string{"documentIds", "changelog"}
|
||||||
|
for _, k := range fieldsInOrder {
|
||||||
|
v, ok := asMap[k]
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch k {
|
||||||
|
case "documentIds":
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentIds"))
|
||||||
|
data, err := ec.unmarshalNID2ᚕgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGIDᚄ(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
|
it.DocumentIds = data
|
||||||
|
case "changelog":
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("changelog"))
|
||||||
|
data, err := ec.unmarshalNString2string(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
|
it.Changelog = data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return it, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalInputCancelSignatureRequestInput(ctx context.Context, obj any) (types.CancelSignatureRequestInput, error) {
|
func (ec *executionContext) unmarshalInputCancelSignatureRequestInput(ctx context.Context, obj any) (types.CancelSignatureRequestInput, error) {
|
||||||
var it types.CancelSignatureRequestInput
|
var it types.CancelSignatureRequestInput
|
||||||
asMap := map[string]any{}
|
asMap := map[string]any{}
|
||||||
@@ -41622,6 +41887,50 @@ func (ec *executionContext) _AssignTaskPayload(ctx context.Context, sel ast.Sele
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bulkPublishDocumentVersionsPayloadImplementors = []string{"BulkPublishDocumentVersionsPayload"}
|
||||||
|
|
||||||
|
func (ec *executionContext) _BulkPublishDocumentVersionsPayload(ctx context.Context, sel ast.SelectionSet, obj *types.BulkPublishDocumentVersionsPayload) graphql.Marshaler {
|
||||||
|
fields := graphql.CollectFields(ec.OperationContext, sel, bulkPublishDocumentVersionsPayloadImplementors)
|
||||||
|
|
||||||
|
out := graphql.NewFieldSet(fields)
|
||||||
|
deferred := make(map[string]*graphql.FieldSet)
|
||||||
|
for i, field := range fields {
|
||||||
|
switch field.Name {
|
||||||
|
case "__typename":
|
||||||
|
out.Values[i] = graphql.MarshalString("BulkPublishDocumentVersionsPayload")
|
||||||
|
case "documentVersionEdges":
|
||||||
|
out.Values[i] = ec._BulkPublishDocumentVersionsPayload_documentVersionEdges(ctx, field, obj)
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
out.Invalids++
|
||||||
|
}
|
||||||
|
case "documentEdges":
|
||||||
|
out.Values[i] = ec._BulkPublishDocumentVersionsPayload_documentEdges(ctx, field, obj)
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
out.Invalids++
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
panic("unknown field " + strconv.Quote(field.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.Dispatch(ctx)
|
||||||
|
if out.Invalids > 0 {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
|
||||||
|
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
|
||||||
|
|
||||||
|
for label, dfs := range deferred {
|
||||||
|
ec.processDeferredGroup(graphql.DeferredGroup{
|
||||||
|
Label: label,
|
||||||
|
Path: graphql.GetPath(ctx),
|
||||||
|
FieldSet: dfs,
|
||||||
|
Context: ctx,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
var cancelSignatureRequestPayloadImplementors = []string{"CancelSignatureRequestPayload"}
|
var cancelSignatureRequestPayloadImplementors = []string{"CancelSignatureRequestPayload"}
|
||||||
|
|
||||||
func (ec *executionContext) _CancelSignatureRequestPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CancelSignatureRequestPayload) graphql.Marshaler {
|
func (ec *executionContext) _CancelSignatureRequestPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CancelSignatureRequestPayload) graphql.Marshaler {
|
||||||
@@ -46281,6 +46590,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
out.Invalids++
|
out.Invalids++
|
||||||
}
|
}
|
||||||
|
case "bulkPublishDocumentVersions":
|
||||||
|
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||||
|
return ec._Mutation_bulkPublishDocumentVersions(ctx, field)
|
||||||
|
})
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
out.Invalids++
|
||||||
|
}
|
||||||
case "generateDocumentChangelog":
|
case "generateDocumentChangelog":
|
||||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||||
return ec._Mutation_generateDocumentChangelog(ctx, field)
|
return ec._Mutation_generateDocumentChangelog(ctx, field)
|
||||||
@@ -50597,6 +50913,25 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalNBulkPublishDocumentVersionsInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐBulkPublishDocumentVersionsInput(ctx context.Context, v any) (types.BulkPublishDocumentVersionsInput, error) {
|
||||||
|
res, err := ec.unmarshalInputBulkPublishDocumentVersionsInput(ctx, v)
|
||||||
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNBulkPublishDocumentVersionsPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐBulkPublishDocumentVersionsPayload(ctx context.Context, sel ast.SelectionSet, v types.BulkPublishDocumentVersionsPayload) graphql.Marshaler {
|
||||||
|
return ec._BulkPublishDocumentVersionsPayload(ctx, sel, &v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNBulkPublishDocumentVersionsPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐBulkPublishDocumentVersionsPayload(ctx context.Context, sel ast.SelectionSet, v *types.BulkPublishDocumentVersionsPayload) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
|
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
return ec._BulkPublishDocumentVersionsPayload(ctx, sel, v)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNBusinessImpact2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐBusinessImpact(ctx context.Context, v any) (coredata.BusinessImpact, error) {
|
func (ec *executionContext) unmarshalNBusinessImpact2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐBusinessImpact(ctx context.Context, v any) (coredata.BusinessImpact, error) {
|
||||||
tmp, err := graphql.UnmarshalString(v)
|
tmp, err := graphql.UnmarshalString(v)
|
||||||
res := unmarshalNBusinessImpact2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐBusinessImpact[tmp]
|
res := unmarshalNBusinessImpact2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐBusinessImpact[tmp]
|
||||||
@@ -52526,6 +52861,36 @@ func (ec *executionContext) marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋg
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalNID2ᚕgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGIDᚄ(ctx context.Context, v any) ([]gid.GID, error) {
|
||||||
|
var vSlice []any
|
||||||
|
vSlice = graphql.CoerceList(v)
|
||||||
|
var err error
|
||||||
|
res := make([]gid.GID, len(vSlice))
|
||||||
|
for i := range vSlice {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
|
||||||
|
res[i], err = ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, vSlice[i])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNID2ᚕgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGIDᚄ(ctx context.Context, sel ast.SelectionSet, v []gid.GID) graphql.Marshaler {
|
||||||
|
ret := make(graphql.Array, len(v))
|
||||||
|
for i := range v {
|
||||||
|
ret[i] = ec.marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, sel, v[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, e := range ret {
|
||||||
|
if e == graphql.Null {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNImportFrameworkInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐImportFrameworkInput(ctx context.Context, v any) (types.ImportFrameworkInput, error) {
|
func (ec *executionContext) unmarshalNImportFrameworkInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐImportFrameworkInput(ctx context.Context, v any) (types.ImportFrameworkInput, error) {
|
||||||
res, err := ec.unmarshalInputImportFrameworkInput(ctx, v)
|
res, err := ec.unmarshalInputImportFrameworkInput(ctx, v)
|
||||||
return res, graphql.ErrorOnPath(ctx, err)
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
|
|||||||
@@ -56,6 +56,16 @@ func NewDocumentConnection(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewDocumentEdges(documents []*coredata.Document, orderBy coredata.DocumentOrderField) []*DocumentEdge {
|
||||||
|
edges := make([]*DocumentEdge, len(documents))
|
||||||
|
|
||||||
|
for i := range edges {
|
||||||
|
edges[i] = NewDocumentEdge(documents[i], orderBy)
|
||||||
|
}
|
||||||
|
|
||||||
|
return edges
|
||||||
|
}
|
||||||
|
|
||||||
func NewDocumentEdge(document *coredata.Document, orderBy coredata.DocumentOrderField) *DocumentEdge {
|
func NewDocumentEdge(document *coredata.Document, orderBy coredata.DocumentOrderField) *DocumentEdge {
|
||||||
return &DocumentEdge{
|
return &DocumentEdge{
|
||||||
Cursor: document.CursorKey(orderBy),
|
Cursor: document.CursorKey(orderBy),
|
||||||
|
|||||||
@@ -35,6 +35,16 @@ func NewDocumentVersionConnection(page *page.Page[*coredata.DocumentVersion, cor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewDocumentVersionEdges(documentVersions []*coredata.DocumentVersion, orderBy coredata.DocumentVersionOrderField) []*DocumentVersionEdge {
|
||||||
|
edges := make([]*DocumentVersionEdge, len(documentVersions))
|
||||||
|
|
||||||
|
for i := range edges {
|
||||||
|
edges[i] = NewDocumentVersionEdge(documentVersions[i], orderBy)
|
||||||
|
}
|
||||||
|
|
||||||
|
return edges
|
||||||
|
}
|
||||||
|
|
||||||
func NewDocumentVersionEdge(documentVersion *coredata.DocumentVersion, orderBy coredata.DocumentVersionOrderField) *DocumentVersionEdge {
|
func NewDocumentVersionEdge(documentVersion *coredata.DocumentVersion, orderBy coredata.DocumentVersionOrderField) *DocumentVersionEdge {
|
||||||
return &DocumentVersionEdge{
|
return &DocumentVersionEdge{
|
||||||
Cursor: documentVersion.CursorKey(orderBy),
|
Cursor: documentVersion.CursorKey(orderBy),
|
||||||
|
|||||||
@@ -56,6 +56,16 @@ type AssignTaskPayload struct {
|
|||||||
Task *Task `json:"task"`
|
Task *Task `json:"task"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BulkPublishDocumentVersionsInput struct {
|
||||||
|
DocumentIds []gid.GID `json:"documentIds"`
|
||||||
|
Changelog string `json:"changelog"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BulkPublishDocumentVersionsPayload struct {
|
||||||
|
DocumentVersionEdges []*DocumentVersionEdge `json:"documentVersionEdges"`
|
||||||
|
DocumentEdges []*DocumentEdge `json:"documentEdges"`
|
||||||
|
}
|
||||||
|
|
||||||
type CancelSignatureRequestInput struct {
|
type CancelSignatureRequestInput struct {
|
||||||
DocumentVersionSignatureID gid.GID `json:"documentVersionSignatureId"`
|
DocumentVersionSignatureID gid.GID `json:"documentVersionSignatureId"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1957,6 +1957,34 @@ func (r *mutationResolver) ExportDocumentVersionPDF(ctx context.Context, input t
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *mutationResolver) BulkPublishDocumentVersions(ctx context.Context, input types.BulkPublishDocumentVersionsInput) (*types.BulkPublishDocumentVersionsPayload, error) {
|
||||||
|
if len(input.DocumentIds) == 0 {
|
||||||
|
return &types.BulkPublishDocumentVersionsPayload{
|
||||||
|
DocumentVersionEdges: []*types.DocumentVersionEdge{},
|
||||||
|
DocumentEdges: []*types.DocumentEdge{},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
prb := r.ProboService(ctx, input.DocumentIds[0].TenantID())
|
||||||
|
|
||||||
|
user := UserFromContext(ctx)
|
||||||
|
|
||||||
|
people, err := prb.Peoples.GetByUserID(ctx, user.ID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot get people: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
documentVersions, documents, err := prb.Documents.BulkPublishVersions(ctx, input.DocumentIds, people.ID, input.Changelog)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot bulk publish document versions: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.BulkPublishDocumentVersionsPayload{
|
||||||
|
DocumentVersionEdges: types.NewDocumentVersionEdges(documentVersions, coredata.DocumentVersionOrderFieldCreatedAt),
|
||||||
|
DocumentEdges: types.NewDocumentEdges(documents, coredata.DocumentOrderFieldTitle),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// CreateVendorRiskAssessment is the resolver for the createVendorRiskAssessment field.
|
// CreateVendorRiskAssessment is the resolver for the createVendorRiskAssessment field.
|
||||||
func (r *mutationResolver) CreateVendorRiskAssessment(ctx context.Context, input types.CreateVendorRiskAssessmentInput) (*types.CreateVendorRiskAssessmentPayload, error) {
|
func (r *mutationResolver) CreateVendorRiskAssessment(ctx context.Context, input types.CreateVendorRiskAssessmentInput) (*types.CreateVendorRiskAssessmentPayload, error) {
|
||||||
prb := r.ProboService(ctx, input.VendorID.TenantID())
|
prb := r.ProboService(ctx, input.VendorID.TenantID())
|
||||||
|
|||||||
Reference in New Issue
Block a user