Add export document pdf options
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -3303,6 +3303,9 @@ input UpdateDocumentInput {
|
||||
|
||||
input ExportDocumentVersionPDFInput {
|
||||
documentVersionId: ID!
|
||||
withWatermark: Boolean!
|
||||
watermarkEmail: String
|
||||
withSignatures: Boolean!
|
||||
}
|
||||
|
||||
input DeleteDocumentInput {
|
||||
@@ -4002,6 +4005,9 @@ input BulkDeleteDocumentsInput {
|
||||
|
||||
input BulkExportDocumentsInput {
|
||||
documentIds: [ID!]!
|
||||
withWatermark: Boolean!
|
||||
watermarkEmail: String
|
||||
withSignatures: Boolean!
|
||||
}
|
||||
|
||||
type BulkDeleteDocumentsPayload {
|
||||
|
||||
@@ -11713,6 +11713,9 @@ input UpdateDocumentInput {
|
||||
|
||||
input ExportDocumentVersionPDFInput {
|
||||
documentVersionId: ID!
|
||||
withWatermark: Boolean!
|
||||
watermarkEmail: String
|
||||
withSignatures: Boolean!
|
||||
}
|
||||
|
||||
input DeleteDocumentInput {
|
||||
@@ -12412,6 +12415,9 @@ input BulkDeleteDocumentsInput {
|
||||
|
||||
input BulkExportDocumentsInput {
|
||||
documentIds: [ID!]!
|
||||
withWatermark: Boolean!
|
||||
watermarkEmail: String
|
||||
withSignatures: Boolean!
|
||||
}
|
||||
|
||||
type BulkDeleteDocumentsPayload {
|
||||
@@ -63447,7 +63453,7 @@ func (ec *executionContext) unmarshalInputBulkExportDocumentsInput(ctx context.C
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"documentIds"}
|
||||
fieldsInOrder := [...]string{"documentIds", "withWatermark", "watermarkEmail", "withSignatures"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -63461,6 +63467,27 @@ func (ec *executionContext) unmarshalInputBulkExportDocumentsInput(ctx context.C
|
||||
return it, err
|
||||
}
|
||||
it.DocumentIds = data
|
||||
case "withWatermark":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("withWatermark"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.WithWatermark = data
|
||||
case "watermarkEmail":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("watermarkEmail"))
|
||||
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.WatermarkEmail = data
|
||||
case "withSignatures":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("withSignatures"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.WithSignatures = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66867,7 +66894,7 @@ func (ec *executionContext) unmarshalInputExportDocumentVersionPDFInput(ctx cont
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"documentVersionId"}
|
||||
fieldsInOrder := [...]string{"documentVersionId", "withWatermark", "watermarkEmail", "withSignatures"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -66881,6 +66908,27 @@ func (ec *executionContext) unmarshalInputExportDocumentVersionPDFInput(ctx cont
|
||||
return it, err
|
||||
}
|
||||
it.DocumentVersionID = data
|
||||
case "withWatermark":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("withWatermark"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.WithWatermark = data
|
||||
case "watermarkEmail":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("watermarkEmail"))
|
||||
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.WatermarkEmail = data
|
||||
case "withSignatures":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("withSignatures"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.WithSignatures = data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,10 @@ type BulkDeleteDocumentsPayload struct {
|
||||
}
|
||||
|
||||
type BulkExportDocumentsInput struct {
|
||||
DocumentIds []gid.GID `json:"documentIds"`
|
||||
DocumentIds []gid.GID `json:"documentIds"`
|
||||
WithWatermark bool `json:"withWatermark"`
|
||||
WatermarkEmail *string `json:"watermarkEmail,omitempty"`
|
||||
WithSignatures bool `json:"withSignatures"`
|
||||
}
|
||||
|
||||
type BulkExportDocumentsPayload struct {
|
||||
@@ -1053,6 +1056,9 @@ type EvidenceEdge struct {
|
||||
|
||||
type ExportDocumentVersionPDFInput struct {
|
||||
DocumentVersionID gid.GID `json:"documentVersionId"`
|
||||
WithWatermark bool `json:"withWatermark"`
|
||||
WatermarkEmail *string `json:"watermarkEmail,omitempty"`
|
||||
WithSignatures bool `json:"withSignatures"`
|
||||
}
|
||||
|
||||
type ExportDocumentVersionPDFPayload struct {
|
||||
|
||||
@@ -2628,7 +2628,13 @@ func (r *mutationResolver) BulkExportDocuments(ctx context.Context, input types.
|
||||
panic(fmt.Errorf("user not found"))
|
||||
}
|
||||
|
||||
documentExport, err := prb.Documents.RequestExport(ctx, input.DocumentIds, user.EmailAddress, user.FullName)
|
||||
options := probo.BulkExportOptions{
|
||||
WithWatermark: input.WithWatermark,
|
||||
WithSignatures: input.WithSignatures,
|
||||
WatermarkEmail: input.WatermarkEmail,
|
||||
}
|
||||
|
||||
documentExport, err := prb.Documents.RequestExport(ctx, input.DocumentIds, user.EmailAddress, user.FullName, options)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot request document export: %w", err))
|
||||
}
|
||||
@@ -2775,7 +2781,13 @@ func (r *mutationResolver) CancelSignatureRequest(ctx context.Context, input typ
|
||||
func (r *mutationResolver) ExportDocumentVersionPDF(ctx context.Context, input types.ExportDocumentVersionPDFInput) (*types.ExportDocumentVersionPDFPayload, error) {
|
||||
prb := r.ProboService(ctx, input.DocumentVersionID.TenantID())
|
||||
|
||||
pdf, err := prb.Documents.ExportPDF(ctx, input.DocumentVersionID)
|
||||
options := probo.ExportPDFOptions{
|
||||
WithSignatures: input.WithSignatures,
|
||||
WithWatermark: input.WithWatermark,
|
||||
WatermarkEmail: input.WatermarkEmail,
|
||||
}
|
||||
|
||||
pdf, err := prb.Documents.ExportPDF(ctx, input.DocumentVersionID, options)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot export document version PDF: %w", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user