Ignore error when partial are ok

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-07-03 10:07:21 +02:00
parent 771edcc4fd
commit 504cdc8f96
21 changed files with 153 additions and 29 deletions

View File

@@ -779,7 +779,7 @@ func (s *Service) GetCookieBannersByIDs(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
if err := banners.LoadByIDs(ctx, conn, scope, bannerIDs); err != nil {
if err := banners.LoadByIDs(ctx, conn, scope, bannerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load cookie banners by ids: %w", err)
}
@@ -1253,7 +1253,7 @@ func (s *Service) GetCookieCategoriesByIDs(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
if err := categories.LoadByIDs(ctx, conn, scope, categoryIDs); err != nil {
if err := categories.LoadByIDs(ctx, conn, scope, categoryIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load cookie categories by ids: %w", err)
}

View File

@@ -1238,7 +1238,7 @@ func (s *OrganizationService) GetProfilesByIDs(
conn,
scope,
profileIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load profiles by ids: %w", err)
}

View File

@@ -220,6 +220,13 @@ func (s AssetService) Update(
}
if req.ThirdPartyIDs != nil {
if len(req.ThirdPartyIDs) > 0 {
thirdParties := &coredata.ThirdParties{}
if err := thirdParties.LoadByIDs(ctx, conn, scope, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot load thirdParties: %w", err)
}
}
if err := assetThirdParties.Merge(ctx, conn, scope, asset.ID, asset.OrganizationID, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot update asset thirdParties: %w", err)
}
@@ -269,6 +276,11 @@ func (s AssetService) Create(
}
if len(req.ThirdPartyIDs) > 0 {
thirdParties := &coredata.ThirdParties{}
if err := thirdParties.LoadByIDs(ctx, conn, scope, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot load thirdParties: %w", err)
}
if err := assetThirdParties.Insert(ctx, conn, scope, asset.ID, asset.OrganizationID, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot create asset thirdParties: %w", err)
}

View File

@@ -117,6 +117,11 @@ func (s ComplianceFrameworkService) Create(
return fmt.Errorf("cannot load trust center: %w", err)
}
framework := &coredata.Framework{}
if err := framework.LoadByID(ctx, tx, scope, req.FrameworkID); err != nil {
return fmt.Errorf("cannot load framework: %w", err)
}
cf = &coredata.ComplianceFramework{
ID: cfID,
OrganizationID: trustCenter.OrganizationID,

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"time"
@@ -809,7 +810,7 @@ func (s ControlService) GetByIDs(
conn,
scope,
controlIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load controls by ids: %w", err)
}

View File

@@ -207,6 +207,13 @@ func (s DatumService) Update(
}
if req.ThirdPartyIDs != nil {
if len(req.ThirdPartyIDs) > 0 {
thirdParties := &coredata.ThirdParties{}
if err := thirdParties.LoadByIDs(ctx, conn, scope, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot load thirdParties: %w", err)
}
}
if err := datumThirdParties.Merge(ctx, conn, scope, datum.ID, datum.OrganizationID, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot update data thirdParties: %w", err)
}
@@ -256,6 +263,11 @@ func (s DatumService) Create(
}
if len(req.ThirdPartyIDs) > 0 {
thirdParties := &coredata.ThirdParties{}
if err := thirdParties.LoadByIDs(ctx, conn, scope, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot load thirdParties: %w", err)
}
if err := datumThirdParties.Insert(ctx, conn, scope, datum.ID, datum.OrganizationID, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot create data thirdParties: %w", err)
}

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"net/url"
"sort"
@@ -296,7 +297,7 @@ func (h *documentNotificationHandler) claimNextApprovalGroup(
scope := coredata.NewScopeFromObjectID(decisions[0].OrganizationID)
var quorums coredata.DocumentVersionApprovalQuorums
if err := quorums.LoadByIDs(ctx, tx, scope, quorumIDs); err != nil {
if err := quorums.LoadByIDs(ctx, tx, scope, quorumIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load approval quorums: %w", err)
}
@@ -343,7 +344,7 @@ func (s *DocumentService) sendNotification(
}
var versions coredata.DocumentVersions
if err := versions.LoadByIDs(ctx, tx, scope, versionIDs); err != nil {
if err := versions.LoadByIDs(ctx, tx, scope, versionIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load document versions for notification: %w", err)
}
@@ -352,7 +353,7 @@ func (s *DocumentService) sendNotification(
}
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, tx, scope, []gid.GID{recipientID}); err != nil {
if err := profiles.LoadByIDs(ctx, tx, scope, []gid.GID{recipientID}); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load notification recipient: %w", err)
}

View File

@@ -360,7 +360,11 @@ func (s *DocumentService) GetDefaultApprovers(
err = s.svc.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
return profiles.LoadByIDs(ctx, conn, scope, profileIDs)
if err := profiles.LoadByIDs(ctx, conn, scope, profileIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return err
}
return nil
},
)
if err != nil {
@@ -384,7 +388,7 @@ func (s *DocumentService) GetByIDs(
conn,
scope,
documentIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load documents by ids: %w", err)
}
@@ -784,6 +788,11 @@ func (s *DocumentService) Create(
}
if len(req.DefaultApproverIDs) > 0 {
profiles := &coredata.MembershipProfiles{}
if err := profiles.LoadByIDs(ctx, conn, scope, req.DefaultApproverIDs); err != nil {
return fmt.Errorf("cannot load approver profiles: %w", err)
}
approvers := &coredata.DocumentDefaultApprovers{}
if err := approvers.MergeByDocumentID(ctx, conn, scope, documentID, organization.ID, req.DefaultApproverIDs); err != nil {
return fmt.Errorf("cannot set default approvers: %w", err)
@@ -2142,6 +2151,13 @@ func (s *DocumentService) Update(
}
if req.DefaultApproverIDs != nil {
if len(*req.DefaultApproverIDs) > 0 {
profiles := &coredata.MembershipProfiles{}
if err := profiles.LoadByIDs(ctx, tx, scope, *req.DefaultApproverIDs); err != nil {
return fmt.Errorf("cannot load approver profiles: %w", err)
}
}
defaultApprovers := &coredata.DocumentDefaultApprovers{}
if err := defaultApprovers.MergeByDocumentID(ctx, tx, scope, req.DocumentID, document.OrganizationID, *req.DefaultApproverIDs); err != nil {
return fmt.Errorf("cannot update default approvers: %w", err)
@@ -2834,7 +2850,7 @@ func generateDocumentPDF(
if len(approverProfileIDs) > 0 {
approverProfiles := coredata.MembershipProfiles{}
if err := approverProfiles.LoadByIDs(ctx, conn, scope, approverProfileIDs); err != nil {
if err := approverProfiles.LoadByIDs(ctx, conn, scope, approverProfileIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return nil, fmt.Errorf("cannot load approver profiles: %w", err)
}

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"io"
"time"
@@ -85,7 +86,7 @@ func (s FileService) GetByIDs(
conn,
scope,
fileIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load files by ids: %w", err)
}

View File

@@ -173,6 +173,13 @@ func (s *FindingService) Create(
}
}
if req.RiskID != nil {
risk := &coredata.Risk{}
if err := risk.LoadByID(ctx, conn, scope, *req.RiskID); err != nil {
return fmt.Errorf("cannot load risk: %w", err)
}
}
if err := finding.Insert(ctx, conn, scope); err != nil {
return fmt.Errorf("cannot insert finding: %w", err)
}
@@ -246,6 +253,13 @@ func (s *FindingService) Update(
}
if req.RiskID != nil {
if *req.RiskID != nil {
risk := &coredata.Risk{}
if err := risk.LoadByID(ctx, conn, scope, **req.RiskID); err != nil {
return fmt.Errorf("cannot load risk: %w", err)
}
}
finding.RiskID = *req.RiskID
}

View File

@@ -18,6 +18,7 @@ import (
"archive/zip"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
@@ -467,7 +468,7 @@ func (s FrameworkService) GetByIDs(
conn,
scope,
frameworkIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load frameworks by ids: %w", err)
}

View File

@@ -183,7 +183,7 @@ func (s *GeneratedDocumentService) buildStatementOfApplicabilityDocumentData(
}
var controls coredata.Controls
if err := controls.LoadByIDs(ctx, conn, scope, controlIDs); err != nil {
if err := controls.LoadByIDs(ctx, conn, scope, controlIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.StatementOfApplicabilityData{}, fmt.Errorf("cannot load controls: %w", err)
}
@@ -201,7 +201,7 @@ func (s *GeneratedDocumentService) buildStatementOfApplicabilityDocumentData(
}
var frameworks coredata.Frameworks
if err := frameworks.LoadByIDs(ctx, conn, scope, frameworkIDs); err != nil {
if err := frameworks.LoadByIDs(ctx, conn, scope, frameworkIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.StatementOfApplicabilityData{}, fmt.Errorf("cannot load frameworks: %w", err)
}
@@ -475,7 +475,7 @@ func (s *GeneratedDocumentService) buildDataListDocumentData(
}
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.DataListData{}, fmt.Errorf("cannot load profiles: %w", err)
}
@@ -747,7 +747,7 @@ func (s *GeneratedDocumentService) buildAssetListDocumentData(
}
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.AssetListData{}, fmt.Errorf("cannot load profiles: %w", err)
}
@@ -1047,7 +1047,7 @@ func (s *GeneratedDocumentService) buildFindingListDocumentData(
if len(ownerIDs) > 0 {
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.FindingListData{}, fmt.Errorf("cannot load profiles: %w", err)
}
@@ -1375,7 +1375,7 @@ func (s *GeneratedDocumentService) buildObligationListDocumentData(
if len(ownerIDs) > 0 {
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.ObligationListData{}, fmt.Errorf("cannot load profiles: %w", err)
}
@@ -1674,7 +1674,7 @@ func (s *GeneratedDocumentService) buildProcessingActivityListDocumentData(
if len(dpoIDs) > 0 {
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, dpoIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, dpoIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.ProcessingActivityListData{}, fmt.Errorf("cannot load DPO profiles: %w", err)
}
@@ -2057,7 +2057,7 @@ func (s *GeneratedDocumentService) buildDataProtectionImpactAssessmentListDocume
}
var processingActivities coredata.ProcessingActivities
if err := processingActivities.LoadByIDs(ctx, conn, scope, processingActivityIDs); err != nil {
if err := processingActivities.LoadByIDs(ctx, conn, scope, processingActivityIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.DataProtectionImpactAssessmentListData{}, fmt.Errorf("cannot load processing activities: %w", err)
}
@@ -2289,7 +2289,7 @@ func (s *GeneratedDocumentService) buildTransferImpactAssessmentListDocumentData
}
var processingActivities coredata.ProcessingActivities
if err := processingActivities.LoadByIDs(ctx, conn, scope, processingActivityIDs); err != nil {
if err := processingActivities.LoadByIDs(ctx, conn, scope, processingActivityIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.TransferImpactAssessmentListData{}, fmt.Errorf("cannot load processing activities: %w", err)
}
@@ -2551,7 +2551,7 @@ func (s *GeneratedDocumentService) buildThirdPartyListDocumentData(
if len(ownerIDs) > 0 {
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.ThirdPartyListData{}, fmt.Errorf("cannot load owner profiles: %w", err)
}
@@ -3093,7 +3093,7 @@ func (s *GeneratedDocumentService) buildRiskListDocumentData(
if len(ownerIDs) > 0 {
var profiles coredata.MembershipProfiles
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil {
if err := profiles.LoadByIDs(ctx, conn, scope, ownerIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return docgen.RiskListData{}, fmt.Errorf("cannot load profiles: %w", err)
}
@@ -3274,6 +3274,11 @@ func (s *GeneratedDocumentService) publishOrRequestApproval(
}
if len(approverIDs) > 0 {
profiles := &coredata.MembershipProfiles{}
if err := profiles.LoadByIDs(ctx, tx, scope, approverIDs); err != nil {
return fmt.Errorf("cannot load approver profiles: %w", err)
}
defaultApprovers := &coredata.DocumentDefaultApprovers{}
if err := defaultApprovers.MergeByDocumentID(ctx, tx, scope, document.ID, organizationID, approverIDs); err != nil {
return fmt.Errorf("cannot save default approvers: %w", err)

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"time"
@@ -348,7 +349,7 @@ func (s MeasureService) GetByIDs(
conn,
scope,
measureIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load measures by ids: %w", err)
}

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"mime"
"net/mail"
@@ -124,7 +125,7 @@ func (s OrganizationService) GetByIDs(
conn,
scope,
organizationIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load organizations by ids: %w", err)
}

View File

@@ -195,11 +195,23 @@ func (s *ProcessingActivityService) Create(
return fmt.Errorf("cannot load organization: %w", err)
}
if req.DataProtectionOfficerID != nil {
dpo := &coredata.MembershipProfile{}
if err := dpo.LoadByID(ctx, conn, scope, *req.DataProtectionOfficerID); err != nil {
return fmt.Errorf("cannot load data protection officer profile: %w", err)
}
}
if err := processingActivity.Insert(ctx, conn, scope); err != nil {
return fmt.Errorf("cannot insert processing activity: %w", err)
}
if len(req.ThirdPartyIDs) > 0 {
thirdParties := &coredata.ThirdParties{}
if err := thirdParties.LoadByIDs(ctx, conn, scope, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot load thirdParties: %w", err)
}
if err := processingActivityThirdParties.Insert(ctx, conn, scope, processingActivity.ID, req.OrganizationID, req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot create processing activity thirdParties: %w", err)
}
@@ -302,6 +314,13 @@ func (s *ProcessingActivityService) Update(
}
if req.DataProtectionOfficerID != nil {
if *req.DataProtectionOfficerID != nil {
dpo := &coredata.MembershipProfile{}
if err := dpo.LoadByID(ctx, conn, scope, **req.DataProtectionOfficerID); err != nil {
return fmt.Errorf("cannot load data protection officer profile: %w", err)
}
}
processingActivity.DataProtectionOfficerID = *req.DataProtectionOfficerID
}
@@ -312,6 +331,13 @@ func (s *ProcessingActivityService) Update(
}
if req.ThirdPartyIDs != nil {
if len(*req.ThirdPartyIDs) > 0 {
thirdParties := &coredata.ThirdParties{}
if err := thirdParties.LoadByIDs(ctx, conn, scope, *req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot load thirdParties: %w", err)
}
}
if err := processingActivityThirdParties.Merge(ctx, conn, scope, processingActivity.ID, processingActivity.OrganizationID, *req.ThirdPartyIDs); err != nil {
return fmt.Errorf("cannot update processing activity thirdParties: %w", err)
}

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"time"
@@ -502,7 +503,7 @@ func (s RiskService) GetByIDs(
conn,
scope,
riskIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load risks by ids: %w", err)
}

View File

@@ -342,6 +342,11 @@ func (s StatementOfApplicabilityService) CreateApplicabilityStatement(
return fmt.Errorf("cannot load statement of applicability: %w", err)
}
control := &coredata.Control{}
if err := control.LoadByID(ctx, conn, scope, controlID); err != nil {
return fmt.Errorf("cannot load control: %w", err)
}
applicabilityStatement = &coredata.ApplicabilityStatement{
ID: gid.New(scope.GetTenantID(), coredata.ApplicabilityStatementEntityType),
StatementOfApplicabilityID: statementOfApplicabilityID,

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"time"
@@ -183,7 +184,7 @@ func (s TaskService) GetByIDs(
conn,
scope,
taskIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load tasks by ids: %w", err)
}

View File

@@ -526,7 +526,7 @@ func (s ThirdPartyService) GetByIDs(
conn,
scope,
thirdPartyIDs,
); err != nil {
); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load thirdParties by ids: %w", err)
}

View File

@@ -271,7 +271,7 @@ func (s *GeneratedDocumentService) buildTrackerPolicyThirdParties(
var thirdParties coredata.ThirdParties
if len(thirdPartyIDs) > 0 {
if err := thirdParties.LoadByIDs(ctx, conn, scope, thirdPartyIDs); err != nil {
if err := thirdParties.LoadByIDs(ctx, conn, scope, thirdPartyIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return nil, fmt.Errorf("cannot load third parties: %w", err)
}
}

View File

@@ -242,11 +242,18 @@ func (s TrustCenterAccessService) Update(
if len(req.DocumentAccesses) > 0 {
var documentData []coredata.MergeTrustCenterDocumentAccessesData
documentIDs := make([]gid.GID, 0, len(req.DocumentAccesses))
for _, d := range req.DocumentAccesses {
documentData = append(documentData, coredata.MergeTrustCenterDocumentAccessesData{
ID: d.ID,
Status: d.Status,
})
documentIDs = append(documentIDs, d.ID)
}
documents := &coredata.Documents{}
if err := documents.LoadByIDs(ctx, tx, scope, documentIDs); err != nil {
return fmt.Errorf("cannot load documents: %w", err)
}
if err := tcdas.MergeDocumentAccesses(ctx, tx, scope, access.OrganizationID, access.ID, documentData); err != nil {
@@ -256,11 +263,18 @@ func (s TrustCenterAccessService) Update(
if len(req.ReportAccesses) > 0 {
var reportData []coredata.MergeTrustCenterDocumentAccessesData
reportIDs := make([]gid.GID, 0, len(req.ReportAccesses))
for _, d := range req.ReportAccesses {
reportData = append(reportData, coredata.MergeTrustCenterDocumentAccessesData{
ID: d.ID,
Status: d.Status,
})
reportIDs = append(reportIDs, d.ID)
}
files := &coredata.Files{}
if err := files.LoadByIDs(ctx, tx, scope, reportIDs); err != nil {
return fmt.Errorf("cannot load report files: %w", err)
}
if err := tcdas.MergeReportFileAccesses(ctx, tx, scope, access.OrganizationID, access.ID, reportData); err != nil {
@@ -270,11 +284,18 @@ func (s TrustCenterAccessService) Update(
if len(req.TrustCenterFileAccesses) > 0 {
var fileData []coredata.MergeTrustCenterDocumentAccessesData
trustCenterFileIDs := make([]gid.GID, 0, len(req.TrustCenterFileAccesses))
for _, d := range req.TrustCenterFileAccesses {
fileData = append(fileData, coredata.MergeTrustCenterDocumentAccessesData{
ID: d.ID,
Status: d.Status,
})
trustCenterFileIDs = append(trustCenterFileIDs, d.ID)
}
trustCenterFiles := &coredata.TrustCenterFiles{}
if err := trustCenterFiles.LoadByIDs(ctx, tx, scope, trustCenterFileIDs); err != nil {
return fmt.Errorf("cannot load trust center files: %w", err)
}
if err := tcdas.MergeTrustCenterFileAccesses(ctx, tx, scope, access.OrganizationID, access.ID, fileData); err != nil {