Rename backend services for portal

Point domain services, bootstrap, and related
packages at Compliance Portal types so callers
stop depending on the old Trust Center names.

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-07-20 18:08:21 +02:00
parent 4bf3d4df79
commit 0f0f6643ad
47 changed files with 727 additions and 727 deletions

View File

@@ -38,32 +38,32 @@ import (
type (
CreateAccessRequest struct {
TrustCenterID gid.GID
IdentityID gid.GID
CompliancePortalID gid.GID
IdentityID gid.GID
}
UpdateDocumentAccessRequest struct {
ID gid.GID
Status coredata.TrustCenterDocumentAccessStatus
Status coredata.CompliancePortalDocumentAccessStatus
}
UpdateAccessRequest struct {
ID gid.GID
DocumentAccesses []UpdateDocumentAccessRequest
ReportAccesses []UpdateDocumentAccessRequest
TrustCenterFileAccesses []UpdateDocumentAccessRequest
ID gid.GID
DocumentAccesses []UpdateDocumentAccessRequest
ReportAccesses []UpdateDocumentAccessRequest
CompliancePortalFileAccesses []UpdateDocumentAccessRequest
}
AccessData struct {
TrustCenterID gid.GID `json:"trust_center_id"`
Email mail.Addr `json:"email"`
CompliancePortalID gid.GID `json:"trust_center_id"`
Email mail.Addr `json:"email"`
}
)
func (utcar *UpdateAccessRequest) Validate() error {
v := validator.New()
v.Check(utcar.ID, "id", validator.Required(), validator.GID(coredata.TrustCenterAccessEntityType))
v.Check(utcar.ID, "id", validator.Required(), validator.GID(coredata.CompliancePortalAccessEntityType))
for i, docAccess := range utcar.DocumentAccesses {
v.Check(docAccess.ID, fmt.Sprintf("documentAccesses[%d].ID", i), validator.Required(), validator.GID(coredata.DocumentEntityType))
@@ -73,8 +73,8 @@ func (utcar *UpdateAccessRequest) Validate() error {
v.Check(reportAccess.ID, fmt.Sprintf("reportAccesses[%d].ID", i), validator.Required(), validator.GID(coredata.FileEntityType))
}
for i, reportAccess := range utcar.TrustCenterFileAccesses {
v.Check(reportAccess.ID, fmt.Sprintf("trustCenterFileAccesses[%d].ID", i), validator.Required(), validator.GID(coredata.TrustCenterFileEntityType))
for i, reportAccess := range utcar.CompliancePortalFileAccesses {
v.Check(reportAccess.ID, fmt.Sprintf("compliancePortalFileAccesses[%d].ID", i), validator.Required(), validator.GID(coredata.CompliancePortalFileEntityType))
}
return v.Error()
@@ -84,14 +84,14 @@ func (s *Service) ListAccesses(
ctx context.Context,
scope coredata.Scoper,
compliancePageID gid.GID,
cursor *page.Cursor[coredata.TrustCenterAccessOrderField],
) (*page.Page[*coredata.TrustCenterAccess, coredata.TrustCenterAccessOrderField], error) {
var accesses coredata.TrustCenterAccesses
cursor *page.Cursor[coredata.CompliancePortalAccessOrderField],
) (*page.Page[*coredata.CompliancePortalAccess, coredata.CompliancePortalAccessOrderField], error) {
var accesses coredata.CompliancePortalAccesses
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
return accesses.LoadByTrustCenterID(ctx, conn, scope, compliancePageID, cursor)
return accesses.LoadByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor)
},
)
if err != nil {
@@ -104,15 +104,15 @@ func (s *Service) ListAccesses(
func (s *Service) ListAvailableDocumentAccesses(
ctx context.Context,
scope coredata.Scoper,
trustCenterAccessID gid.GID,
cursor *page.Cursor[coredata.TrustCenterDocumentAccessOrderField],
) (*page.Page[*coredata.TrustCenterDocumentAccess, coredata.TrustCenterDocumentAccessOrderField], error) {
var documentAccesses coredata.TrustCenterDocumentAccesses
compliancePortalAccessID gid.GID,
cursor *page.Cursor[coredata.CompliancePortalDocumentAccessOrderField],
) (*page.Page[*coredata.CompliancePortalDocumentAccess, coredata.CompliancePortalDocumentAccessOrderField], error) {
var documentAccesses coredata.CompliancePortalDocumentAccesses
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
return documentAccesses.LoadAvailableByTrustCenterAccessID(ctx, conn, scope, trustCenterAccessID, cursor)
return documentAccesses.LoadAvailableByCompliancePortalAccessID(ctx, conn, scope, compliancePortalAccessID, cursor)
},
)
if err != nil {
@@ -126,8 +126,8 @@ func (s *Service) GetAccess(
ctx context.Context,
scope coredata.Scoper,
accessID gid.GID,
) (*coredata.TrustCenterAccess, error) {
var access coredata.TrustCenterAccess
) (*coredata.CompliancePortalAccess, error) {
var access coredata.CompliancePortalAccess
err := s.pg.WithConn(
ctx,
@@ -145,7 +145,7 @@ func (s *Service) GetAccess(
func (s *Service) CountDocumentAccesses(
ctx context.Context,
scope coredata.Scoper,
trustCenterAccessID gid.GID,
compliancePortalAccessID gid.GID,
) (int, error) {
var count int
@@ -153,11 +153,11 @@ func (s *Service) CountDocumentAccesses(
ctx,
func(ctx context.Context, conn pg.Querier) error {
var (
documentAccesses coredata.TrustCenterDocumentAccesses
documentAccesses coredata.CompliancePortalDocumentAccesses
err error
)
count, err = documentAccesses.CountByTrustCenterAccessID(ctx, conn, scope, trustCenterAccessID)
count, err = documentAccesses.CountByCompliancePortalAccessID(ctx, conn, scope, compliancePortalAccessID)
return err
},
@@ -172,7 +172,7 @@ func (s *Service) CountDocumentAccesses(
func (s *Service) CountPendingRequestDocumentAccesses(
ctx context.Context,
scope coredata.Scoper,
trustCenterAccessID gid.GID,
compliancePortalAccessID gid.GID,
) (int, error) {
var count int
@@ -180,11 +180,11 @@ func (s *Service) CountPendingRequestDocumentAccesses(
ctx,
func(ctx context.Context, conn pg.Querier) error {
var (
documentAccesses coredata.TrustCenterDocumentAccesses
documentAccesses coredata.CompliancePortalDocumentAccesses
err error
)
count, err = documentAccesses.CountPendingRequestByTrustCenterAccessID(ctx, conn, scope, trustCenterAccessID)
count, err = documentAccesses.CountPendingRequestByCompliancePortalAccessID(ctx, conn, scope, compliancePortalAccessID)
return err
},
@@ -199,7 +199,7 @@ func (s *Service) CountPendingRequestDocumentAccesses(
func (s *Service) CountActiveDocumentAccesses(
ctx context.Context,
scope coredata.Scoper,
trustCenterAccessID gid.GID,
compliancePortalAccessID gid.GID,
) (int, error) {
var count int
@@ -207,11 +207,11 @@ func (s *Service) CountActiveDocumentAccesses(
ctx,
func(ctx context.Context, conn pg.Querier) error {
var (
documentAccesses coredata.TrustCenterDocumentAccesses
documentAccesses coredata.CompliancePortalDocumentAccesses
err error
)
count, err = documentAccesses.CountActiveByTrustCenterAccessID(ctx, conn, scope, trustCenterAccessID)
count, err = documentAccesses.CountActiveByCompliancePortalAccessID(ctx, conn, scope, compliancePortalAccessID)
return err
},
@@ -227,34 +227,34 @@ func (s *Service) UpdateAccess(
ctx context.Context,
scope coredata.Scoper,
req *UpdateAccessRequest,
) (*coredata.TrustCenterAccess, error) {
) (*coredata.CompliancePortalAccess, error) {
if err := req.Validate(); err != nil {
return nil, err
}
var (
access *coredata.TrustCenterAccess
trustCenterAcessActivated bool
shouldUpdateSlackMessage bool
access *coredata.CompliancePortalAccess
compliancePortalAcessActivated bool
shouldUpdateSlackMessage bool
)
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
access = &coredata.TrustCenterAccess{}
access = &coredata.CompliancePortalAccess{}
if err := access.LoadByID(ctx, tx, scope, req.ID); err != nil {
return fmt.Errorf("cannot load compliance page access: %w", err)
}
var tcdas coredata.TrustCenterDocumentAccesses
var tcdas coredata.CompliancePortalDocumentAccesses
if len(req.DocumentAccesses) > 0 {
var documentData []coredata.MergeTrustCenterDocumentAccessesData
var documentData []coredata.MergeCompliancePortalDocumentAccessesData
documentIDs := make([]gid.GID, 0, len(req.DocumentAccesses))
for _, d := range req.DocumentAccesses {
documentData = append(documentData, coredata.MergeTrustCenterDocumentAccessesData{
documentData = append(documentData, coredata.MergeCompliancePortalDocumentAccessesData{
ID: d.ID,
Status: d.Status,
})
@@ -273,11 +273,11 @@ func (s *Service) UpdateAccess(
}
if len(req.ReportAccesses) > 0 {
var reportData []coredata.MergeTrustCenterDocumentAccessesData
var reportData []coredata.MergeCompliancePortalDocumentAccessesData
reportIDs := make([]gid.GID, 0, len(req.ReportAccesses))
for _, d := range req.ReportAccesses {
reportData = append(reportData, coredata.MergeTrustCenterDocumentAccessesData{
reportData = append(reportData, coredata.MergeCompliancePortalDocumentAccessesData{
ID: d.ID,
Status: d.Status,
})
@@ -295,39 +295,39 @@ func (s *Service) UpdateAccess(
}
}
if len(req.TrustCenterFileAccesses) > 0 {
var fileData []coredata.MergeTrustCenterDocumentAccessesData
if len(req.CompliancePortalFileAccesses) > 0 {
var fileData []coredata.MergeCompliancePortalDocumentAccessesData
trustCenterFileIDs := make([]gid.GID, 0, len(req.TrustCenterFileAccesses))
for _, d := range req.TrustCenterFileAccesses {
fileData = append(fileData, coredata.MergeTrustCenterDocumentAccessesData{
compliancePortalFileIDs := make([]gid.GID, 0, len(req.CompliancePortalFileAccesses))
for _, d := range req.CompliancePortalFileAccesses {
fileData = append(fileData, coredata.MergeCompliancePortalDocumentAccessesData{
ID: d.ID,
Status: d.Status,
})
trustCenterFileIDs = append(trustCenterFileIDs, d.ID)
compliancePortalFileIDs = append(compliancePortalFileIDs, d.ID)
}
trustCenterFiles := &coredata.TrustCenterFiles{}
if err := trustCenterFiles.LoadByIDs(ctx, tx, scope, trustCenterFileIDs); err != nil {
compliancePortalFiles := &coredata.CompliancePortalFiles{}
if err := compliancePortalFiles.LoadByIDs(ctx, tx, scope, compliancePortalFileIDs); err != nil {
return fmt.Errorf("cannot load compliance page files: %w", err)
}
if err := tcdas.MergeTrustCenterFileAccesses(ctx, tx, scope, access.OrganizationID, access.ID, fileData); err != nil {
if err := tcdas.MergeCompliancePortalFileAccesses(ctx, tx, scope, access.OrganizationID, access.ID, fileData); err != nil {
return fmt.Errorf("cannot merge compliance page file accesses: %w", err)
}
}
if trustCenterAcessActivated {
if compliancePortalAcessActivated {
if err := s.sendAccessEmail(ctx, scope, tx, access); err != nil {
return fmt.Errorf("cannot send access email: %w", err)
}
}
shouldUpdateSlackMessage = trustCenterAcessActivated ||
shouldUpdateSlackMessage = compliancePortalAcessActivated ||
len(req.DocumentAccesses) > 0 ||
len(req.ReportAccesses) > 0 ||
len(req.TrustCenterFileAccesses) > 0
len(req.CompliancePortalFileAccesses) > 0
return nil
},
@@ -337,7 +337,7 @@ func (s *Service) UpdateAccess(
}
if shouldUpdateSlackMessage {
if err := s.SlackMessages.QueueSlackNotification(ctx, scope, access.IdentityID, access.TrustCenterID); err != nil {
if err := s.SlackMessages.QueueSlackNotification(ctx, scope, access.IdentityID, access.CompliancePortalID); err != nil {
if !errors.Is(err, slack.ErrNoSlackConnector) {
return nil, fmt.Errorf("cannot queue slack notification: %w", err)
}
@@ -350,14 +350,14 @@ func (s *Service) UpdateAccess(
func (s *Service) DeleteAccess(
ctx context.Context,
scope coredata.Scoper,
trustCenterAccessID gid.GID,
compliancePortalAccessID gid.GID,
) error {
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
access := &coredata.TrustCenterAccess{}
access := &coredata.CompliancePortalAccess{}
if err := access.LoadByID(ctx, tx, scope, trustCenterAccessID); err != nil {
if err := access.LoadByID(ctx, tx, scope, compliancePortalAccessID); err != nil {
return fmt.Errorf("cannot load compliance page access: %w", err)
}
@@ -376,7 +376,7 @@ func (s *Service) sendAccessEmail(
ctx context.Context,
scope coredata.Scoper,
tx pg.Tx,
access *coredata.TrustCenterAccess,
access *coredata.CompliancePortalAccess,
) error {
organization := &coredata.Organization{}
if err := organization.LoadByID(ctx, tx, scope, access.OrganizationID); err != nil {
@@ -401,14 +401,14 @@ func (s *Service) sendAccessEmail(
return fmt.Errorf("cannot load profile: %w", err)
}
emailPresenterCfg, err := s.EmailPresenterConfig(ctx, scope, access.TrustCenterID)
emailPresenterCfg, err := s.EmailPresenterConfig(ctx, scope, access.CompliancePortalID)
if err != nil {
return fmt.Errorf("cannot get compliance page email presenter config: %w", err)
}
emailPresenter := emails.NewPresenterFromConfig(emailPresenterCfg, profile.FullName)
subject, textBody, htmlBody, err := emailPresenter.RenderTrustCenterAccess(ctx, organization.Name)
subject, textBody, htmlBody, err := emailPresenter.RenderCompliancePortalAccess(ctx, organization.Name)
if err != nil {
return fmt.Errorf("cannot render compliance page access email: %w", err)
}

View File

@@ -34,9 +34,9 @@ import (
type (
CreateCompliancePortalCommitmentGroupRequest struct {
TrustCenterID gid.GID
Title string
Description string
CompliancePortalID gid.GID
Title string
Description string
}
UpdateCompliancePortalCommitmentGroupRequest struct {
@@ -50,7 +50,7 @@ type (
func (r *CreateCompliancePortalCommitmentGroupRequest) Validate() error {
v := validator.New()
v.Check(r.TrustCenterID, "trust_center_id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(r.CompliancePortalID, "trust_center_id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(r.Title, "title", validator.Required(), validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(r.Description, "description", validator.SafeText(ContentMaxLength))
@@ -70,7 +70,7 @@ func (r *UpdateCompliancePortalCommitmentGroupRequest) Validate() error {
func (s *Service) ListCommitmentGroups(
ctx context.Context,
scope coredata.Scoper,
trustCenterID gid.GID,
compliancePortalID gid.GID,
cursor *page.Cursor[coredata.CompliancePortalCommitmentGroupOrderField],
) (*page.Page[*coredata.CompliancePortalCommitmentGroup, coredata.CompliancePortalCommitmentGroupOrderField], error) {
var groups coredata.CompliancePortalCommitmentGroups
@@ -78,7 +78,7 @@ func (s *Service) ListCommitmentGroups(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := groups.LoadByTrustCenterID(ctx, conn, scope, trustCenterID, cursor)
err := groups.LoadByCompliancePortalID(ctx, conn, scope, compliancePortalID, cursor)
if err != nil {
return fmt.Errorf("cannot load compliance portal commitment groups: %w", err)
}
@@ -96,7 +96,7 @@ func (s *Service) ListCommitmentGroups(
func (s *Service) CountCommitmentGroups(
ctx context.Context,
scope coredata.Scoper,
trustCenterID gid.GID,
compliancePortalID gid.GID,
) (int, error) {
var count int
@@ -105,7 +105,7 @@ func (s *Service) CountCommitmentGroups(
func(ctx context.Context, conn pg.Querier) (err error) {
groups := coredata.CompliancePortalCommitmentGroups{}
count, err = groups.CountByTrustCenterID(ctx, conn, scope, trustCenterID)
count, err = groups.CountByCompliancePortalID(ctx, conn, scope, compliancePortalID)
if err != nil {
return fmt.Errorf("cannot count compliance portal commitment groups: %w", err)
}
@@ -163,19 +163,19 @@ func (s *Service) CreateCommitmentGroup(
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
trustCenter := &coredata.TrustCenter{}
if err := trustCenter.LoadByID(ctx, tx, scope, req.TrustCenterID); err != nil {
return fmt.Errorf("cannot load trust center: %w", err)
compliancePortal := &coredata.CompliancePortal{}
if err := compliancePortal.LoadByID(ctx, tx, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance portal: %w", err)
}
group = &coredata.CompliancePortalCommitmentGroup{
ID: groupID,
OrganizationID: trustCenter.OrganizationID,
TrustCenterID: req.TrustCenterID,
Title: req.Title,
Description: req.Description,
CreatedAt: now,
UpdatedAt: now,
ID: groupID,
OrganizationID: compliancePortal.OrganizationID,
CompliancePortalID: req.CompliancePortalID,
Title: req.Title,
Description: req.Description,
CreatedAt: now,
UpdatedAt: now,
}
if err := group.Insert(ctx, tx, scope); err != nil {

View File

@@ -181,16 +181,16 @@ func (s *Service) CreateCommitment(
}
commitment = &coredata.CompliancePortalCommitment{
ID: commitmentID,
OrganizationID: group.OrganizationID,
TrustCenterID: group.TrustCenterID,
GroupID: req.GroupID,
Icon: req.Icon,
Eyebrow: req.Eyebrow,
Title: req.Title,
Description: req.Description,
CreatedAt: now,
UpdatedAt: now,
ID: commitmentID,
OrganizationID: group.OrganizationID,
CompliancePortalID: group.CompliancePortalID,
GroupID: req.GroupID,
Icon: req.Icon,
Eyebrow: req.Eyebrow,
Title: req.Title,
Description: req.Description,
CreatedAt: now,
UpdatedAt: now,
}
if err := commitment.Insert(ctx, tx, scope); err != nil {

View File

@@ -34,9 +34,9 @@ import (
type (
CreateCustomLinkRequest struct {
TrustCenterID gid.GID
Name string
URL string
CompliancePortalID gid.GID
Name string
URL string
}
UpdateCustomLinkRequest struct {
@@ -53,7 +53,7 @@ type (
func (r *CreateCustomLinkRequest) Validate() error {
v := validator.New()
v.Check(r.TrustCenterID, "trust_center_id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(r.CompliancePortalID, "trust_center_id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(r.URL, "url", validator.Required(), validator.URL())
return v.Error()
@@ -86,7 +86,7 @@ func (s *Service) ListCustomLinks(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
if err := items.LoadByTrustCenterID(ctx, conn, scope, compliancePageID, cursor); err != nil {
if err := items.LoadByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor); err != nil {
return fmt.Errorf("cannot load custom links: %w", err)
}
@@ -117,19 +117,19 @@ func (s *Service) CreateCustomLink(
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.TrustCenterID); err != nil {
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
item = &coredata.ComplianceCustomLink{
ID: id,
OrganizationID: compliancePage.OrganizationID,
TrustCenterID: req.TrustCenterID,
Name: req.Name,
URL: req.URL,
CreatedAt: now,
UpdatedAt: now,
ID: id,
OrganizationID: compliancePage.OrganizationID,
CompliancePortalID: req.CompliancePortalID,
Name: req.Name,
URL: req.URL,
CreatedAt: now,
UpdatedAt: now,
}
if err := item.Insert(ctx, tx, scope); err != nil {

View File

@@ -23,11 +23,11 @@ import (
"go.probo.inc/probo/pkg/gid"
)
func (s *Service) EffectiveDomainForCompliancePage(
func (s *Service) EffectiveDomainForCompliancePortal(
ctx context.Context,
conn pg.Querier,
scope coredata.Scoper,
compliancePage *coredata.TrustCenter,
compliancePage *coredata.CompliancePortal,
) (*coredata.CustomDomain, error) {
byID, active, err := loadDomains(ctx, conn, scope, compliancePage)
if err != nil {
@@ -49,11 +49,11 @@ func (s *Service) EffectiveDomainForCompliancePage(
return nil, nil
}
func (s *Service) PublicURLForCompliancePage(
func (s *Service) PublicURLForCompliancePortal(
ctx context.Context,
conn pg.Querier,
scope coredata.Scoper,
compliancePage *coredata.TrustCenter,
compliancePage *coredata.CompliancePortal,
) (string, error) {
byID, active, err := loadDomains(ctx, conn, scope, compliancePage)
if err != nil {
@@ -80,7 +80,7 @@ func loadDomains(
ctx context.Context,
conn pg.Querier,
scope coredata.Scoper,
compliancePage *coredata.TrustCenter,
compliancePage *coredata.CompliancePortal,
) (map[gid.GID]*coredata.CustomDomain, map[gid.GID]bool, error) {
var ids []gid.GID
if compliancePage.CustomDomainID != nil {

View File

@@ -35,7 +35,7 @@ func (s *Service) AddCustomDomain(
domain string,
) (*coredata.CustomDomain, error) {
v := validator.New()
v.Check(compliancePageID, "compliance_page_id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(compliancePageID, "compliance_page_id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(domain, "domain", validator.Required(), validator.NotEmpty(), validator.Domain())
if err := v.Error(); err != nil {
@@ -47,7 +47,7 @@ func (s *Service) AddCustomDomain(
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -107,7 +107,7 @@ func (s *Service) RemoveCustomDomain(
return ErrCustomDomainManaged
}
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
err := compliancePage.LoadByDomainID(ctx, tx, customDomainID)
switch {
@@ -177,14 +177,14 @@ func (s *Service) PublicURL(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
var err error
publicURL, err = s.PublicURLForCompliancePage(ctx, conn, scope, compliancePage)
publicURL, err = s.PublicURLForCompliancePortal(ctx, conn, scope, compliancePage)
if err != nil {
return fmt.Errorf("cannot resolve public url: %w", err)
}

View File

@@ -41,18 +41,18 @@ import (
type (
CreateFileRequest struct {
OrganizationID gid.GID
Name string
Category string
File File
TrustCenterVisibility coredata.TrustCenterVisibility
OrganizationID gid.GID
Name string
Category string
File File
CompliancePortalVisibility coredata.CompliancePortalVisibility
}
UpdateFileRequest struct {
ID gid.GID
Name *string
Category *string
TrustCenterVisibility *coredata.TrustCenterVisibility
ID gid.GID
Name *string
Category *string
CompliancePortalVisibility *coredata.CompliancePortalVisibility
}
)
@@ -63,7 +63,7 @@ func (ctcfr *CreateFileRequest) Validate() error {
v.Check(ctcfr.Name, "name", validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(ctcfr.Category, "category", validator.Required(), validator.SafeText(TitleMaxLength))
v.Check(ctcfr.File, "file", validator.Required())
v.Check(ctcfr.TrustCenterVisibility, "trust_center_visibility", validator.Required(), validator.OneOfSlice(coredata.TrustCenterVisibilities()))
v.Check(ctcfr.CompliancePortalVisibility, "trust_center_visibility", validator.Required(), validator.OneOfSlice(coredata.CompliancePortalVisibilities()))
return v.Error()
}
@@ -71,10 +71,10 @@ func (ctcfr *CreateFileRequest) Validate() error {
func (utcfr *UpdateFileRequest) Validate() error {
v := validator.New()
v.Check(utcfr.ID, "id", validator.Required(), validator.GID(coredata.TrustCenterFileEntityType))
v.Check(utcfr.ID, "id", validator.Required(), validator.GID(coredata.CompliancePortalFileEntityType))
v.Check(utcfr.Name, "name", validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(utcfr.Category, "category", validator.SafeText(TitleMaxLength))
v.Check(utcfr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities()))
v.Check(utcfr.CompliancePortalVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.CompliancePortalVisibilities()))
return v.Error()
}
@@ -83,10 +83,10 @@ func (s *Service) ListFilesForOrganizationID(
ctx context.Context,
scope coredata.Scoper,
organizationID gid.GID,
cursor *page.Cursor[coredata.TrustCenterFileOrderField],
filter *coredata.TrustCenterFileFilter,
) (*page.Page[*coredata.TrustCenterFile, coredata.TrustCenterFileOrderField], error) {
var files coredata.TrustCenterFiles
cursor *page.Cursor[coredata.CompliancePortalFileOrderField],
filter *coredata.CompliancePortalFileFilter,
) (*page.Page[*coredata.CompliancePortalFile, coredata.CompliancePortalFileOrderField], error) {
var files coredata.CompliancePortalFiles
err := s.pg.WithConn(
ctx,
@@ -116,7 +116,7 @@ func (s *Service) CountFilesForOrganizationID(
func(ctx context.Context, conn pg.Querier) error {
var err error
count, err = (&coredata.TrustCenterFiles{}).CountByOrganizationID(ctx, conn, scope, organizationID)
count, err = (&coredata.CompliancePortalFiles{}).CountByOrganizationID(ctx, conn, scope, organizationID)
if err != nil {
return fmt.Errorf("cannot count compliance page files: %w", err)
}
@@ -134,13 +134,13 @@ func (s *Service) GetFile(
ctx context.Context,
scope coredata.Scoper,
id gid.GID,
) (*coredata.TrustCenterFile, error) {
var file *coredata.TrustCenterFile
) (*coredata.CompliancePortalFile, error) {
var file *coredata.CompliancePortalFile
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
file = &coredata.TrustCenterFile{}
file = &coredata.CompliancePortalFile{}
if err := file.LoadByID(ctx, conn, scope, id); err != nil {
return fmt.Errorf("cannot load compliance page file: %w", err)
}
@@ -159,7 +159,7 @@ func (s *Service) CreateFile(
ctx context.Context,
scope coredata.Scoper,
req *CreateFileRequest,
) (*coredata.TrustCenterFile, error) {
) (*coredata.CompliancePortalFile, error) {
if err := req.Validate(); err != nil {
return nil, err
}
@@ -179,32 +179,32 @@ func (s *Service) CreateFile(
now := time.Now()
trustCenterFileID := gid.New(scope.GetTenantID(), coredata.TrustCenterFileEntityType)
compliancePortalFileID := gid.New(scope.GetTenantID(), coredata.CompliancePortalFileEntityType)
var (
file *coredata.TrustCenterFile
file *coredata.CompliancePortalFile
s3Key string
)
err = s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
fileID, objectKey, err := s.uploadFile(ctx, scope, tx, req.File, trustCenterFileID, req.OrganizationID, now)
fileID, objectKey, err := s.uploadFile(ctx, scope, tx, req.File, compliancePortalFileID, req.OrganizationID, now)
if err != nil {
return fmt.Errorf("cannot upload file: %w", err)
}
s3Key = objectKey
file = &coredata.TrustCenterFile{
ID: trustCenterFileID,
OrganizationID: req.OrganizationID,
Name: req.Name,
Category: req.Category,
FileID: fileID,
TrustCenterVisibility: req.TrustCenterVisibility,
CreatedAt: now,
UpdatedAt: now,
file = &coredata.CompliancePortalFile{
ID: compliancePortalFileID,
OrganizationID: req.OrganizationID,
Name: req.Name,
Category: req.Category,
FileID: fileID,
CompliancePortalVisibility: req.CompliancePortalVisibility,
CreatedAt: now,
UpdatedAt: now,
}
if err := file.Insert(ctx, tx, scope); err != nil {
@@ -226,19 +226,19 @@ func (s *Service) UpdateFile(
ctx context.Context,
scope coredata.Scoper,
req *UpdateFileRequest,
) (*coredata.TrustCenterFile, error) {
) (*coredata.CompliancePortalFile, error) {
if err := req.Validate(); err != nil {
return nil, err
}
now := time.Now()
var file *coredata.TrustCenterFile
var file *coredata.CompliancePortalFile
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
file = &coredata.TrustCenterFile{}
file = &coredata.CompliancePortalFile{}
if err := file.LoadByID(ctx, tx, scope, req.ID); err != nil {
return fmt.Errorf("cannot load compliance page file: %w", err)
@@ -252,8 +252,8 @@ func (s *Service) UpdateFile(
file.Category = *req.Category
}
if req.TrustCenterVisibility != nil {
file.TrustCenterVisibility = *req.TrustCenterVisibility
if req.CompliancePortalVisibility != nil {
file.CompliancePortalVisibility = *req.CompliancePortalVisibility
}
file.UpdatedAt = now
@@ -275,14 +275,14 @@ func (s *Service) UpdateFile(
func (s *Service) DeleteFile(
ctx context.Context,
scope coredata.Scoper,
trustCenterFileID gid.GID,
compliancePortalFileID gid.GID,
) error {
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
file := &coredata.TrustCenterFile{}
file := &coredata.CompliancePortalFile{}
if err := file.LoadByID(ctx, tx, scope, trustCenterFileID); err != nil {
if err := file.LoadByID(ctx, tx, scope, compliancePortalFileID); err != nil {
return fmt.Errorf("cannot load compliance page file: %w", err)
}
@@ -299,7 +299,7 @@ func (s *Service) DeleteFile(
func (s *Service) GenerateFileURL(
ctx context.Context,
scope coredata.Scoper,
trustCenterFileID gid.GID,
compliancePortalFileID gid.GID,
duration time.Duration,
) (string, error) {
var storedFile *coredata.File
@@ -307,8 +307,8 @@ func (s *Service) GenerateFileURL(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
file := &coredata.TrustCenterFile{}
if err := file.LoadByID(ctx, conn, scope, trustCenterFileID); err != nil {
file := &coredata.CompliancePortalFile{}
if err := file.LoadByID(ctx, conn, scope, compliancePortalFileID); err != nil {
return fmt.Errorf("cannot load compliance page file: %w", err)
}
@@ -337,7 +337,7 @@ func (s *Service) uploadFile(
scope coredata.Scoper,
tx pg.Tx,
file File,
trustCenterFileID gid.GID,
compliancePortalFileID gid.GID,
organizationID gid.GID,
now time.Time,
) (gid.GID, string, error) {
@@ -404,7 +404,7 @@ func (s *Service) uploadFile(
CacheControl: new("private, max-age=3600"),
Metadata: map[string]string{
"type": "compliance-page-file",
"compliance-page-file-id": trustCenterFileID.String(),
"compliance-page-file-id": compliancePortalFileID.String(),
"organization-id": organizationID.String(),
},
},

View File

@@ -34,8 +34,8 @@ import (
type (
CreateFrameworkRequest struct {
TrustCenterID gid.GID
FrameworkID gid.GID
CompliancePortalID gid.GID
FrameworkID gid.GID
}
UpdateFrameworkRequest struct {
@@ -51,7 +51,7 @@ type (
func (r *CreateFrameworkRequest) Validate() error {
v := validator.New()
v.Check(r.TrustCenterID, "trust_center_id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(r.CompliancePortalID, "trust_center_id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(r.FrameworkID, "framework_id", validator.Required(), validator.GID(coredata.FrameworkEntityType))
return v.Error()
@@ -84,7 +84,7 @@ func (s *Service) ListFrameworksWithHidden(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
if err := cfs.LoadWithHiddenByTrustCenterID(ctx, conn, scope, compliancePageID, cursor); err != nil {
if err := cfs.LoadWithHiddenByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor); err != nil {
return fmt.Errorf("cannot load frameworks with hidden: %w", err)
}
@@ -116,8 +116,8 @@ func (s *Service) CreateFramework(
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.TrustCenterID); err != nil {
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -127,12 +127,12 @@ func (s *Service) CreateFramework(
}
cf = &coredata.ComplianceFramework{
ID: cfID,
OrganizationID: compliancePage.OrganizationID,
TrustCenterID: req.TrustCenterID,
FrameworkID: req.FrameworkID,
CreatedAt: now,
UpdatedAt: now,
ID: cfID,
OrganizationID: compliancePage.OrganizationID,
CompliancePortalID: req.CompliancePortalID,
FrameworkID: req.FrameworkID,
CreatedAt: now,
UpdatedAt: now,
}
if err := cf.Insert(ctx, tx, scope); err != nil {

View File

@@ -54,15 +54,15 @@ type (
}
UploadNDARequest struct {
TrustCenterID gid.GID
File io.Reader
FileName string
CompliancePortalID gid.GID
File io.Reader
FileName string
}
UpdateBrandRequest struct {
TrustCenterID gid.GID
LogoFile **FileUpload
DarkLogoFile **FileUpload
CompliancePortalID gid.GID
LogoFile **FileUpload
DarkLogoFile **FileUpload
}
)
@@ -71,7 +71,7 @@ const maxBrandFileSize = 5 * 1024 * 1024 // 5MB
func (utcr *UpdateRequest) Validate() error {
v := validator.New()
v.Check(utcr.ID, "id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(utcr.ID, "id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(utcr.Slug, "slug", validator.SafeText(NameMaxLength))
v.Check(utcr.NonDisclosureAgreementFileID, "non_disclosure_agreement_file_id", validator.GID(coredata.FileEntityType))
@@ -101,7 +101,7 @@ func (utcr *UpdateRequest) Validate() error {
func (utcndar *UploadNDARequest) Validate() error {
v := validator.New()
v.Check(utcndar.TrustCenterID, "trust_center_id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(utcndar.CompliancePortalID, "trust_center_id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(utcndar.FileName, "file_name", validator.SafeTextNoNewLine(TitleMaxLength))
return v.Error()
@@ -134,13 +134,13 @@ func (s *Service) Get(
ctx context.Context,
scope coredata.Scoper,
compliancePageID gid.GID,
) (*coredata.TrustCenter, error) {
var compliancePage *coredata.TrustCenter
) (*coredata.CompliancePortal, error) {
var compliancePage *coredata.CompliancePortal
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -159,13 +159,13 @@ func (s *Service) GetByOrganizationID(
ctx context.Context,
scope coredata.Scoper,
organizationID gid.GID,
) (*coredata.TrustCenter, error) {
var compliancePage *coredata.TrustCenter
) (*coredata.CompliancePortal, error) {
var compliancePage *coredata.CompliancePortal
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByOrganizationID(ctx, conn, scope, organizationID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -184,20 +184,20 @@ func (s *Service) Update(
ctx context.Context,
scope coredata.Scoper,
req *UpdateRequest,
) (*coredata.TrustCenter, *coredata.File, error) {
) (*coredata.CompliancePortal, *coredata.File, error) {
if err := req.Validate(); err != nil {
return nil, nil, err
}
var (
compliancePage *coredata.TrustCenter
compliancePage *coredata.CompliancePortal
file *coredata.File
)
err := s.pg.WithTx(
ctx,
func(ctx context.Context, conn pg.Tx) error {
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, req.ID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -267,26 +267,26 @@ func (s *Service) UploadNDA(
ctx context.Context,
scope coredata.Scoper,
req *UploadNDARequest,
) (*coredata.TrustCenter, *coredata.File, error) {
) (*coredata.CompliancePortal, *coredata.File, error) {
if err := req.Validate(); err != nil {
return nil, nil, err
}
var (
compliancePage *coredata.TrustCenter
compliancePage *coredata.CompliancePortal
file *coredata.File
)
err := s.pg.WithTx(
ctx,
func(ctx context.Context, conn pg.Tx) error {
compliancePage = &coredata.TrustCenter{}
if err := compliancePage.LoadByID(ctx, conn, scope, req.TrustCenterID); err != nil {
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
if compliancePage.OrganizationID == gid.Nil {
return fmt.Errorf("compliance page %s has no organization", req.TrustCenterID)
return fmt.Errorf("compliance page %s has no organization", req.CompliancePortalID)
}
objectKey, err := uuid.NewV7()
@@ -320,7 +320,7 @@ func (s *Service) UploadNDA(
req.File,
map[string]string{
"type": "compliance-page-nda",
"compliance-page-id": req.TrustCenterID.String(),
"compliance-page-id": req.CompliancePortalID.String(),
"organization-id": compliancePage.OrganizationID.String(),
},
)
@@ -355,13 +355,13 @@ func (s *Service) DeleteNDA(
ctx context.Context,
scope coredata.Scoper,
compliancePageID gid.GID,
) (*coredata.TrustCenter, *coredata.File, error) {
var compliancePage *coredata.TrustCenter
) (*coredata.CompliancePortal, *coredata.File, error) {
var compliancePage *coredata.CompliancePortal
err := s.pg.WithTx(
ctx,
func(ctx context.Context, conn pg.Tx) error {
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -387,21 +387,21 @@ func (s *Service) UpdateBrand(
ctx context.Context,
scope coredata.Scoper,
req *UpdateBrandRequest,
) (*coredata.TrustCenter, *coredata.File, error) {
) (*coredata.CompliancePortal, *coredata.File, error) {
if err := req.Validate(); err != nil {
return nil, nil, err
}
var (
compliancePage *coredata.TrustCenter
compliancePage *coredata.CompliancePortal
ndaFile *coredata.File
)
err := s.pg.WithTx(
ctx,
func(ctx context.Context, conn pg.Tx) error {
compliancePage = &coredata.TrustCenter{}
if err := compliancePage.LoadByID(ctx, conn, scope, req.TrustCenterID); err != nil {
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -462,7 +462,7 @@ func (s *Service) uploadBrandFile(
conn pg.Tx,
fileUpload *FileUpload,
fileType string,
compliancePage *coredata.TrustCenter,
compliancePage *coredata.CompliancePortal,
) (*coredata.File, error) {
objectKey, err := uuid.NewV7()
if err != nil {
@@ -529,7 +529,7 @@ func (s *Service) GenerateNDAFileURL(
) (*string, error) {
var file *coredata.File
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
err := s.pg.WithConn(
ctx,
@@ -573,7 +573,7 @@ func (s *Service) GenerateLogoURL(
expiresIn time.Duration,
) (*string, error) {
file := &coredata.File{}
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
err := s.pg.WithConn(
ctx,
@@ -620,7 +620,7 @@ func (s *Service) GenerateDarkLogoURL(
expiresIn time.Duration,
) (*string, error) {
file := &coredata.File{}
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
err := s.pg.WithConn(
ctx,
@@ -666,7 +666,7 @@ func (s *Service) EmailPresenterConfig(
compliancePageID gid.GID,
) (emails.PresenterConfig, error) {
var (
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
organization = &coredata.Organization{}
logoFile = &coredata.File{}
compliancePageURL string
@@ -690,7 +690,7 @@ func (s *Service) EmailPresenterConfig(
return fmt.Errorf("cannot load organization: %w", err)
}
publicURL, err := s.PublicURLForCompliancePage(ctx, conn, scope, compliancePage)
publicURL, err := s.PublicURLForCompliancePortal(ctx, conn, scope, compliancePage)
if err != nil {
return fmt.Errorf("cannot resolve compliance page URL: %w", err)
}
@@ -736,7 +736,7 @@ func (s *Service) GetMailingList(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}

View File

@@ -40,11 +40,11 @@ import (
type (
CreateReferenceRequest struct {
TrustCenterID gid.GID
Name string
Description *string
WebsiteURL string
LogoFile File
CompliancePortalID gid.GID
Name string
Description *string
WebsiteURL string
LogoFile File
}
UpdateReferenceRequest struct {
@@ -60,7 +60,7 @@ type (
func (ctcrr *CreateReferenceRequest) Validate() error {
v := validator.New()
v.Check(ctcrr.TrustCenterID, "trust_center_id", validator.Required(), validator.GID(coredata.TrustCenterEntityType))
v.Check(ctcrr.CompliancePortalID, "trust_center_id", validator.Required(), validator.GID(coredata.CompliancePortalEntityType))
v.Check(ctcrr.Name, "name", validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(ctcrr.Description, "description", validator.SafeText(ContentMaxLength))
v.Check(ctcrr.WebsiteURL, "website_url", validator.Required(), validator.SafeText(2048))
@@ -71,7 +71,7 @@ func (ctcrr *CreateReferenceRequest) Validate() error {
func (utcrr *UpdateReferenceRequest) Validate() error {
v := validator.New()
v.Check(utcrr.ID, "id", validator.Required(), validator.GID(coredata.TrustCenterReferenceEntityType))
v.Check(utcrr.ID, "id", validator.Required(), validator.GID(coredata.CompliancePortalReferenceEntityType))
v.Check(utcrr.Name, "name", validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(utcrr.Description, "description", validator.SafeText(ContentMaxLength))
v.Check(utcrr.WebsiteURL, "website_url", validator.SafeText(2048))
@@ -83,14 +83,14 @@ func (s *Service) ListReferences(
ctx context.Context,
scope coredata.Scoper,
compliancePageID gid.GID,
cursor *page.Cursor[coredata.TrustCenterReferenceOrderField],
) (*page.Page[*coredata.TrustCenterReference, coredata.TrustCenterReferenceOrderField], error) {
var references coredata.TrustCenterReferences
cursor *page.Cursor[coredata.CompliancePortalReferenceOrderField],
) (*page.Page[*coredata.CompliancePortalReference, coredata.CompliancePortalReferenceOrderField], error) {
var references coredata.CompliancePortalReferences
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := references.LoadByTrustCenterID(ctx, conn, scope, compliancePageID, cursor)
err := references.LoadByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor)
if err != nil {
return fmt.Errorf("cannot load compliance page references: %w", err)
}
@@ -115,9 +115,9 @@ func (s *Service) CountReferences(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) (err error) {
references := coredata.TrustCenterReferences{}
references := coredata.CompliancePortalReferences{}
count, err = references.CountByTrustCenterID(ctx, conn, scope, compliancePageID)
count, err = references.CountByCompliancePortalID(ctx, conn, scope, compliancePageID)
if err != nil {
return fmt.Errorf("cannot count compliance page references: %w", err)
}
@@ -136,8 +136,8 @@ func (s *Service) GetReference(
ctx context.Context,
scope coredata.Scoper,
referenceID gid.GID,
) (*coredata.TrustCenterReference, error) {
var reference coredata.TrustCenterReference
) (*coredata.CompliancePortalReference, error) {
var reference coredata.CompliancePortalReference
err := s.pg.WithConn(
ctx,
@@ -161,44 +161,44 @@ func (s *Service) CreateReference(
ctx context.Context,
scope coredata.Scoper,
req *CreateReferenceRequest,
) (*coredata.TrustCenterReference, error) {
) (*coredata.CompliancePortalReference, error) {
if err := req.Validate(); err != nil {
return nil, err
}
now := time.Now()
referenceID := gid.New(scope.GetTenantID(), coredata.TrustCenterReferenceEntityType)
referenceID := gid.New(scope.GetTenantID(), coredata.CompliancePortalReferenceEntityType)
var reference *coredata.TrustCenterReference
var reference *coredata.CompliancePortalReference
var logoKey string
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.TrustCenterID); err != nil {
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
fileID, s3Key, err := s.uploadReferenceLogoFile(ctx, scope, tx, req.LogoFile, referenceID, req.TrustCenterID, now)
fileID, s3Key, err := s.uploadReferenceLogoFile(ctx, scope, tx, req.LogoFile, referenceID, req.CompliancePortalID, now)
if err != nil {
return fmt.Errorf("cannot upload logo file: %w", err)
}
logoKey = s3Key
reference = &coredata.TrustCenterReference{
ID: referenceID,
OrganizationID: compliancePage.OrganizationID,
TrustCenterID: req.TrustCenterID,
Name: req.Name,
Description: req.Description,
WebsiteURL: req.WebsiteURL,
LogoFileID: fileID,
CreatedAt: now,
UpdatedAt: now,
reference = &coredata.CompliancePortalReference{
ID: referenceID,
OrganizationID: compliancePage.OrganizationID,
CompliancePortalID: req.CompliancePortalID,
Name: req.Name,
Description: req.Description,
WebsiteURL: req.WebsiteURL,
LogoFileID: fileID,
CreatedAt: now,
UpdatedAt: now,
}
if err := reference.Insert(ctx, tx, scope); err != nil {
@@ -220,7 +220,7 @@ func (s *Service) UpdateReference(
ctx context.Context,
scope coredata.Scoper,
req *UpdateReferenceRequest,
) (*coredata.TrustCenterReference, error) {
) (*coredata.CompliancePortalReference, error) {
if err := req.Validate(); err != nil {
return nil, err
}
@@ -228,7 +228,7 @@ func (s *Service) UpdateReference(
now := time.Now()
var (
reference *coredata.TrustCenterReference
reference *coredata.CompliancePortalReference
newFileID *gid.GID
logoKey string
)
@@ -236,14 +236,14 @@ func (s *Service) UpdateReference(
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
reference = &coredata.TrustCenterReference{}
reference = &coredata.CompliancePortalReference{}
if err := reference.LoadByID(ctx, tx, scope, req.ID); err != nil {
return fmt.Errorf("cannot load compliance page reference: %w", err)
}
if req.LogoFile != nil {
fileID, s3Key, err := s.uploadReferenceLogoFile(ctx, scope, tx, *req.LogoFile, req.ID, reference.TrustCenterID, now)
fileID, s3Key, err := s.uploadReferenceLogoFile(ctx, scope, tx, *req.LogoFile, req.ID, reference.CompliancePortalID, now)
if err != nil {
return fmt.Errorf("cannot upload logo file: %w", err)
}
@@ -295,14 +295,14 @@ func (s *Service) UpdateReference(
func (s *Service) DeleteReference(
ctx context.Context,
scope coredata.Scoper,
trustCenterReferenceID gid.GID,
compliancePortalReferenceID gid.GID,
) error {
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
reference := &coredata.TrustCenterReference{}
reference := &coredata.CompliancePortalReference{}
if err := reference.LoadByID(ctx, tx, scope, trustCenterReferenceID); err != nil {
if err := reference.LoadByID(ctx, tx, scope, compliancePortalReferenceID); err != nil {
return fmt.Errorf("cannot load compliance page reference: %w", err)
}
@@ -322,7 +322,7 @@ func (s *Service) GenerateReferenceLogoURL(
scope coredata.Scoper,
referenceID gid.GID,
) (string, error) {
reference := &coredata.TrustCenterReference{}
reference := &coredata.CompliancePortalReference{}
err := s.pg.WithTx(
ctx,
@@ -358,7 +358,7 @@ func (s *Service) uploadReferenceLogoFile(
return gid.GID{}, "", fmt.Errorf("cannot generate object key: %w", err)
}
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, compliancePageID); err != nil {
return gid.GID{}, "", fmt.Errorf("cannot load compliance page: %w", err)
}

View File

@@ -89,7 +89,7 @@ func (s *Service) ListAuditsForOrganizationID(
var audits coredata.Audits
if filter == nil {
filter = coredata.NewAuditTrustCenterFilter()
filter = coredata.NewAuditCompliancePortalFilter()
}
err := s.pg.WithConn(

View File

@@ -65,7 +65,7 @@ func PortalBaseURLFromCIMDClientID(clientIDURL string) (string, error) {
}
func BuildClientMetadataDocument(
portal *coredata.TrustCenter,
portal *coredata.CompliancePortal,
portalBaseURL string,
) (oauth2.ClientMetadataDocument, error) {
clientID, err := CIMDClientIDURL(portalBaseURL)

View File

@@ -65,7 +65,7 @@ func TestBuildClientMetadataDocument(t *testing.T) {
t.Parallel()
websiteURL := "https://www.acme.com"
portal := &coredata.TrustCenter{
portal := &coredata.CompliancePortal{
Title: "Acme Compliance Page",
WebsiteURL: &websiteURL,
}
@@ -87,7 +87,7 @@ func TestBuildClientMetadataDocument_LogoURIUsesBrandLogoEndpoint(t *testing.T)
t.Parallel()
logoFileID := gid.MustParseGID("WR-qMrB5AAEAGQAAAZ9mIO8B8vDFQ-i3")
portal := &coredata.TrustCenter{
portal := &coredata.CompliancePortal{
Title: "Acme Compliance Page",
LogoFileID: &logoFileID,
}

View File

@@ -66,7 +66,7 @@ func (s *Service) ListComplianceFrameworksByPortalID(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := complianceFrameworks.LoadByTrustCenterID(ctx, conn, scope, compliancePageID, cursor)
err := complianceFrameworks.LoadByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor)
if err != nil {
return fmt.Errorf("cannot load compliance frameworks: %w", err)
}

View File

@@ -33,7 +33,7 @@ import (
func (s *Service) ListCommitmentGroupsForPortalID(
ctx context.Context,
scope coredata.Scoper,
trustCenterID gid.GID,
compliancePortalID gid.GID,
cursor *page.Cursor[coredata.CompliancePortalCommitmentGroupOrderField],
) (*page.Page[*coredata.CompliancePortalCommitmentGroup, coredata.CompliancePortalCommitmentGroupOrderField], error) {
var groups coredata.CompliancePortalCommitmentGroups
@@ -41,7 +41,7 @@ func (s *Service) ListCommitmentGroupsForPortalID(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := groups.LoadByTrustCenterID(ctx, conn, scope, trustCenterID, cursor)
err := groups.LoadByCompliancePortalID(ctx, conn, scope, compliancePortalID, cursor)
if err != nil {
return fmt.Errorf("cannot load compliance portal commitment groups: %w", err)
}

View File

@@ -119,7 +119,7 @@ type (
}
)
func (s *Service) RenderCompliancePageMarkdown(
func (s *Service) RenderCompliancePortalMarkdown(
ctx context.Context,
w io.Writer,
compliancePageID gid.GID,
@@ -286,7 +286,7 @@ func (s *Service) fetchDocumentIDs(
}
for _, doc := range result.Data {
if doc.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if doc.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
continue
}
@@ -308,8 +308,8 @@ func (s *Service) fetchDocumentIDs(
page.MaxCursorSize,
cursorKey,
page.Head,
page.OrderBy[coredata.TrustCenterFileOrderField]{
Field: coredata.TrustCenterFileOrderFieldCreatedAt,
page.OrderBy[coredata.CompliancePortalFileOrderField]{
Field: coredata.CompliancePortalFileOrderFieldCreatedAt,
Direction: page.OrderDirectionAsc,
},
)
@@ -319,14 +319,14 @@ func (s *Service) fetchDocumentIDs(
scope,
orgID,
cursor,
coredata.NewTrustCenterFileFilter(),
coredata.NewCompliancePortalFileFilter(),
)
if err != nil {
return nil, fmt.Errorf("cannot list compliance page files: %w", err)
}
for _, file := range result.Data {
if file.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if file.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
continue
}
@@ -338,7 +338,7 @@ func (s *Service) fetchDocumentIDs(
}
last := result.Data[len(result.Data)-1]
ck := last.CursorKey(coredata.TrustCenterFileOrderFieldCreatedAt)
ck := last.CursorKey(coredata.CompliancePortalFileOrderFieldCreatedAt)
cursorKey = &ck
}
@@ -360,7 +360,7 @@ func (s *Service) fetchDocumentIDs(
}
for _, audit := range result.Data {
if audit.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if audit.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
continue
}
@@ -477,7 +477,7 @@ func (s *Service) fetchDocuments(
}
for _, doc := range result.Data {
if doc.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if doc.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
continue
}
@@ -527,7 +527,7 @@ func (s *Service) fetchAudits(
}
for _, audit := range result.Data {
if audit.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if audit.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
continue
}
@@ -631,8 +631,8 @@ func (s *Service) fetchReferences(
page.MaxCursorSize,
cursorKey,
page.Head,
page.OrderBy[coredata.TrustCenterReferenceOrderField]{
Field: coredata.TrustCenterReferenceOrderFieldRank,
page.OrderBy[coredata.CompliancePortalReferenceOrderField]{
Field: coredata.CompliancePortalReferenceOrderFieldRank,
Direction: page.OrderDirectionAsc,
},
)
@@ -659,7 +659,7 @@ func (s *Service) fetchReferences(
}
last := result.Data[len(result.Data)-1]
ck := last.CursorKey(coredata.TrustCenterReferenceOrderFieldRank)
ck := last.CursorKey(coredata.CompliancePortalReferenceOrderFieldRank)
cursorKey = &ck
}

View File

@@ -41,7 +41,7 @@ func (s *Service) ListCustomLinksForPortalID(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := links.LoadByTrustCenterID(ctx, conn, scope, compliancePageID, cursor)
err := links.LoadByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor)
if err != nil {
return fmt.Errorf("cannot load custom links: %w", err)
}

View File

@@ -53,7 +53,7 @@ func (s *Service) ListDocumentsForOrganizationID(
var documents coredata.Documents
if filter == nil {
filter = coredata.NewDocumentTrustCenterFilter()
filter = coredata.NewDocumentCompliancePortalFilter()
}
err := s.pg.WithConn(
@@ -131,7 +131,7 @@ func (s *Service) GetDocument(
return nil, ErrDocumentNotFound
}
if document.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if document.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
return nil, ErrDocumentNotVisible
}
@@ -158,7 +158,7 @@ func (s *Service) exportDocumentPDFData(
return &ErrDocumentArchived{}
}
if document.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if document.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
return fmt.Errorf("document not visible on compliance page")
}

View File

@@ -36,37 +36,37 @@ import (
)
type PortalAccessRequest struct {
TrustCenterID gid.GID
IdentityID gid.GID
DocumentIDs []gid.GID
ReportIDs []gid.GID
TrustCenterFileIDs []gid.GID
CompliancePortalID gid.GID
IdentityID gid.GID
DocumentIDs []gid.GID
ReportIDs []gid.GID
CompliancePortalFileIDs []gid.GID
}
const (
PortalAccessURLFormat = "https://%s/organizations/%s/trust-center/access"
PortalAccessURLFormat = "https://%s/organizations/%s/compliance-page/access"
)
func (s *Service) RequestPortalAccess(
ctx context.Context,
scope coredata.Scoper,
req *PortalAccessRequest,
) (*coredata.TrustCenterAccess, error) {
) (*coredata.CompliancePortalAccess, error) {
var (
now = time.Now()
access *coredata.TrustCenterAccess
access *coredata.CompliancePortalAccess
)
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.TrustCenterID); err != nil {
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, req.CompliancePortalID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
access = &coredata.TrustCenterAccess{}
if err := access.LoadByTrustCenterIDAndIdentityID(ctx, tx, scope, req.TrustCenterID, req.IdentityID); err != nil {
access = &coredata.CompliancePortalAccess{}
if err := access.LoadByCompliancePortalIDAndIdentityID(ctx, tx, scope, req.CompliancePortalID, req.IdentityID); err != nil {
return fmt.Errorf("cannot load compliance page membership: %w", err)
}
@@ -74,7 +74,7 @@ func (s *Service) RequestPortalAccess(
documentIDs := req.DocumentIDs
if req.DocumentIDs == nil {
filter := coredata.NewDocumentTrustCenterFilter()
filter := coredata.NewDocumentCompliancePortalFilter()
allDocuments, err := page.LoadAll(
ctx,
@@ -102,7 +102,7 @@ func (s *Service) RequestPortalAccess(
reportIDs := req.ReportIDs
if req.ReportIDs == nil {
auditFilter := coredata.NewAuditTrustCenterFilter()
auditFilter := coredata.NewAuditCompliancePortalFilter()
allAudits, err := page.LoadAll(
ctx,
@@ -130,20 +130,20 @@ func (s *Service) RequestPortalAccess(
}
}
trustCenterFileIDs := req.TrustCenterFileIDs
if req.TrustCenterFileIDs == nil {
filter := coredata.NewTrustCenterFileFilter(
coredata.WithTrustCenterFileVisibilities(coredata.TrustCenterVisibilityPrivate, coredata.TrustCenterVisibilityNone),
compliancePortalFileIDs := req.CompliancePortalFileIDs
if req.CompliancePortalFileIDs == nil {
filter := coredata.NewCompliancePortalFileFilter(
coredata.WithCompliancePortalFileVisibilities(coredata.CompliancePortalVisibilityPrivate, coredata.CompliancePortalVisibilityNone),
)
allTrustCenterFiles, err := page.LoadAll(
allCompliancePortalFiles, err := page.LoadAll(
ctx,
page.OrderBy[coredata.TrustCenterFileOrderField]{
Field: coredata.TrustCenterFileOrderFieldCreatedAt,
page.OrderBy[coredata.CompliancePortalFileOrderField]{
Field: coredata.CompliancePortalFileOrderFieldCreatedAt,
Direction: page.OrderDirectionDesc,
},
func(ctx context.Context, cursor *page.Cursor[coredata.TrustCenterFileOrderField]) ([]*coredata.TrustCenterFile, error) {
var batch coredata.TrustCenterFiles
func(ctx context.Context, cursor *page.Cursor[coredata.CompliancePortalFileOrderField]) ([]*coredata.CompliancePortalFile, error) {
var batch coredata.CompliancePortalFiles
if err := batch.LoadByOrganizationID(ctx, tx, scope, organizationID, cursor, filter); err != nil {
return nil, fmt.Errorf("cannot list compliance page files: %w", err)
}
@@ -155,20 +155,20 @@ func (s *Service) RequestPortalAccess(
return err
}
for _, file := range allTrustCenterFiles {
trustCenterFileIDs = append(trustCenterFileIDs, file.ID)
for _, file := range allCompliancePortalFiles {
compliancePortalFileIDs = append(compliancePortalFileIDs, file.ID)
}
}
existingAccesses, err := page.LoadAll(
ctx,
page.OrderBy[coredata.TrustCenterDocumentAccessOrderField]{
Field: coredata.TrustCenterDocumentAccessOrderFieldCreatedAt,
page.OrderBy[coredata.CompliancePortalDocumentAccessOrderField]{
Field: coredata.CompliancePortalDocumentAccessOrderFieldCreatedAt,
Direction: page.OrderDirectionAsc,
},
func(ctx context.Context, cursor *page.Cursor[coredata.TrustCenterDocumentAccessOrderField]) ([]*coredata.TrustCenterDocumentAccess, error) {
var batch coredata.TrustCenterDocumentAccesses
if err := batch.LoadByTrustCenterAccessID(ctx, tx, scope, access.ID, cursor); err != nil {
func(ctx context.Context, cursor *page.Cursor[coredata.CompliancePortalDocumentAccessOrderField]) ([]*coredata.CompliancePortalDocumentAccess, error) {
var batch coredata.CompliancePortalDocumentAccesses
if err := batch.LoadByCompliancePortalAccessID(ctx, tx, scope, access.ID, cursor); err != nil {
return nil, fmt.Errorf("cannot load existing access records: %w", err)
}
@@ -179,12 +179,12 @@ func (s *Service) RequestPortalAccess(
return err
}
existingDocumentIDs, existingReportIDs, existingTrustCenterFileIDs := extractExistingIDs(existingAccesses)
existingDocumentIDs, existingReportIDs, existingCompliancePortalFileIDs := extractExistingIDs(existingAccesses)
newDocumentIDs := filterExistingIDs(documentIDs, existingDocumentIDs)
newReportIDs := filterExistingIDs(reportIDs, existingReportIDs)
newTrustCenterFileIDs := filterExistingIDs(trustCenterFileIDs, existingTrustCenterFileIDs)
newCompliancePortalFileIDs := filterExistingIDs(compliancePortalFileIDs, existingCompliancePortalFileIDs)
var accesses coredata.TrustCenterDocumentAccesses
var accesses coredata.CompliancePortalDocumentAccesses
if err := accesses.BulkInsertDocumentAccesses(
ctx,
@@ -193,7 +193,7 @@ func (s *Service) RequestPortalAccess(
access.ID,
access.OrganizationID,
newDocumentIDs,
coredata.TrustCenterDocumentAccessStatusRequested,
coredata.CompliancePortalDocumentAccessStatusRequested,
now,
); err != nil {
return fmt.Errorf("cannot bulk insert compliance page document accesses: %w", err)
@@ -206,20 +206,20 @@ func (s *Service) RequestPortalAccess(
access.ID,
access.OrganizationID,
newReportIDs,
coredata.TrustCenterDocumentAccessStatusRequested,
coredata.CompliancePortalDocumentAccessStatusRequested,
now,
); err != nil {
return fmt.Errorf("cannot bulk insert compliance page report accesses: %w", err)
}
if err := accesses.BulkInsertTrustCenterFileAccesses(
if err := accesses.BulkInsertCompliancePortalFileAccesses(
ctx,
tx,
scope,
access.ID,
access.OrganizationID,
newTrustCenterFileIDs,
coredata.TrustCenterDocumentAccessStatusRequested,
newCompliancePortalFileIDs,
coredata.CompliancePortalDocumentAccessStatusRequested,
now,
); err != nil {
return fmt.Errorf("cannot bulk insert compliance page file accesses: %w", err)
@@ -232,7 +232,7 @@ func (s *Service) RequestPortalAccess(
return nil, err
}
if err := s.slack.QueueSlackNotification(ctx, scope, req.IdentityID, req.TrustCenterID); err != nil {
if err := s.slack.QueueSlackNotification(ctx, scope, req.IdentityID, req.CompliancePortalID); err != nil {
s.logger.ErrorCtx(ctx, "cannot queue slack notification", log.Error(err))
}
@@ -244,13 +244,13 @@ func (s *Service) GetPortalAccess(
scope coredata.Scoper,
compliancePageID gid.GID,
identityID gid.GID,
) (coredata.TrustCenterAccess, error) {
var access coredata.TrustCenterAccess
) (coredata.CompliancePortalAccess, error) {
var access coredata.CompliancePortalAccess
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
return access.LoadByTrustCenterIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
return access.LoadByCompliancePortalIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
},
)
@@ -263,15 +263,15 @@ func (s *Service) GetPortalDocumentAccess(
compliancePageID gid.GID,
identityID gid.GID,
documentID gid.GID,
) (*coredata.TrustCenterDocumentAccess, error) {
var documentAccess *coredata.TrustCenterDocumentAccess
) (*coredata.CompliancePortalDocumentAccess, error) {
var documentAccess *coredata.CompliancePortalDocumentAccess
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
access := &coredata.TrustCenterAccess{}
access := &coredata.CompliancePortalAccess{}
err := access.LoadByTrustCenterIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
err := access.LoadByCompliancePortalIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrMembershipNotFound
@@ -291,9 +291,9 @@ func (s *Service) GetPortalDocumentAccess(
return ErrUserInactive
}
documentAccess = &coredata.TrustCenterDocumentAccess{}
documentAccess = &coredata.CompliancePortalDocumentAccess{}
err = documentAccess.LoadByTrustCenterAccessIDAndDocumentID(ctx, conn, scope, access.ID, documentID)
err = documentAccess.LoadByCompliancePortalAccessIDAndDocumentID(ctx, conn, scope, access.ID, documentID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrDocumentAccessNotFound
@@ -318,15 +318,15 @@ func (s *Service) GetPortalReportFileAccess(
compliancePageID gid.GID,
identityID gid.GID,
reportFileID gid.GID,
) (*coredata.TrustCenterDocumentAccess, error) {
var reportAccess *coredata.TrustCenterDocumentAccess
) (*coredata.CompliancePortalDocumentAccess, error) {
var reportAccess *coredata.CompliancePortalDocumentAccess
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
access := &coredata.TrustCenterAccess{}
access := &coredata.CompliancePortalAccess{}
err := access.LoadByTrustCenterIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
err := access.LoadByCompliancePortalIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrMembershipNotFound
@@ -346,9 +346,9 @@ func (s *Service) GetPortalReportFileAccess(
return ErrUserInactive
}
reportAccess = &coredata.TrustCenterDocumentAccess{}
reportAccess = &coredata.CompliancePortalDocumentAccess{}
err = reportAccess.LoadByTrustCenterAccessIDAndReportFileID(ctx, conn, scope, access.ID, reportFileID)
err = reportAccess.LoadByCompliancePortalAccessIDAndReportFileID(ctx, conn, scope, access.ID, reportFileID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrDocumentAccessNotFound
@@ -372,16 +372,16 @@ func (s *Service) GetPortalFileAccess(
scope coredata.Scoper,
compliancePageID gid.GID,
identityID gid.GID,
trustCenterFileID gid.GID,
) (*coredata.TrustCenterDocumentAccess, error) {
var fileAccess *coredata.TrustCenterDocumentAccess
compliancePortalFileID gid.GID,
) (*coredata.CompliancePortalDocumentAccess, error) {
var fileAccess *coredata.CompliancePortalDocumentAccess
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
access := &coredata.TrustCenterAccess{}
access := &coredata.CompliancePortalAccess{}
err := access.LoadByTrustCenterIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
err := access.LoadByCompliancePortalIDAndIdentityID(ctx, conn, scope, compliancePageID, identityID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrMembershipNotFound
@@ -401,9 +401,9 @@ func (s *Service) GetPortalFileAccess(
return ErrUserInactive
}
fileAccess = &coredata.TrustCenterDocumentAccess{}
fileAccess = &coredata.CompliancePortalDocumentAccess{}
err = fileAccess.LoadByTrustCenterAccessIDAndTrustCenterFileID(ctx, conn, scope, access.ID, trustCenterFileID)
err = fileAccess.LoadByCompliancePortalAccessIDAndCompliancePortalFileID(ctx, conn, scope, access.ID, compliancePortalFileID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrDocumentAccessNotFound
@@ -434,7 +434,7 @@ func (s *Service) GrantPortalAccessByIDs(
return s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByOrganizationID(ctx, tx, scope, organizationID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -444,8 +444,8 @@ func (s *Service) GrantPortalAccessByIDs(
return fmt.Errorf("cannot load identity: %w", err)
}
access := &coredata.TrustCenterAccess{}
if err := access.LoadByTrustCenterIDAndIdentityID(ctx, tx, scope, compliancePage.ID, identity.ID); err != nil {
access := &coredata.CompliancePortalAccess{}
if err := access.LoadByCompliancePortalIDAndIdentityID(ctx, tx, scope, compliancePage.ID, identity.ID); err != nil {
return fmt.Errorf("cannot load compliance page access: %w", err)
}
@@ -476,7 +476,7 @@ func (s *Service) GrantPortalAccessByIDs(
}
if len(fileIDs) > 0 {
if err := coredata.GrantByTrustCenterFileIDs(ctx, tx, scope, access.ID, fileIDs, now); err != nil {
if err := coredata.GrantByCompliancePortalFileIDs(ctx, tx, scope, access.ID, fileIDs, now); err != nil {
return fmt.Errorf("cannot grant compliance page file accesses: %w", err)
}
}
@@ -503,7 +503,7 @@ func (s *Service) sendPortalAccessEmail(
ctx context.Context,
tx pg.Tx,
scope coredata.Scoper,
access *coredata.TrustCenterAccess,
access *coredata.CompliancePortalAccess,
profile *coredata.MembershipProfile,
) error {
organization := &coredata.Organization{}
@@ -518,14 +518,14 @@ func (s *Service) sendPortalAccessEmail(
return fmt.Errorf("cannot update compliance page access with expiration: %w", err)
}
emailPresenterCfg, err := s.GetPortalEmailPresenterConfig(ctx, scope, access.TrustCenterID)
emailPresenterCfg, err := s.GetPortalEmailPresenterConfig(ctx, scope, access.CompliancePortalID)
if err != nil {
return fmt.Errorf("cannot get compliance page email presenter config: %w", err)
}
emailPresenter := emails.NewPresenterFromConfig(emailPresenterCfg, profile.FullName)
subject, textBody, htmlBody, err := emailPresenter.RenderTrustCenterAccess(ctx, organization.Name)
subject, textBody, htmlBody, err := emailPresenter.RenderCompliancePortalAccess(ctx, organization.Name)
if err != nil {
return fmt.Errorf("cannot render compliance page access email: %w", err)
}
@@ -560,7 +560,7 @@ func (s *Service) RejectOrRevokePortalAccessByIDs(
return s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByOrganizationID(ctx, tx, scope, organizationID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -570,8 +570,8 @@ func (s *Service) RejectOrRevokePortalAccessByIDs(
return fmt.Errorf("cannot load identity: %w", err)
}
access := &coredata.TrustCenterAccess{}
if err := access.LoadByTrustCenterIDAndIdentityID(ctx, tx, scope, compliancePage.ID, identity.ID); err != nil {
access := &coredata.CompliancePortalAccess{}
if err := access.LoadByCompliancePortalIDAndIdentityID(ctx, tx, scope, compliancePage.ID, identity.ID); err != nil {
return fmt.Errorf("cannot load compliance page access: %w", err)
}
@@ -602,7 +602,7 @@ func (s *Service) RejectOrRevokePortalAccessByIDs(
if len(fileIDs) > 0 {
shouldSendEmail = true
if err := coredata.RejectOrRevokeByTrustCenterFileIDs(ctx, tx, scope, access.ID, fileIDs, now); err != nil {
if err := coredata.RejectOrRevokeByCompliancePortalFileIDs(ctx, tx, scope, access.ID, fileIDs, now); err != nil {
return fmt.Errorf("cannot reject/revoke compliance page file accesses: %w", err)
}
}
@@ -622,7 +622,7 @@ func (s *Service) sendPortalDocumentAccessRejectedEmail(
ctx context.Context,
tx pg.Tx,
scope coredata.Scoper,
access *coredata.TrustCenterAccess,
access *coredata.CompliancePortalAccess,
profile *coredata.MembershipProfile,
documentIDs []gid.GID,
reportIDs []gid.GID,
@@ -657,7 +657,7 @@ func (s *Service) sendPortalDocumentAccessRejectedEmail(
fileNames = append(fileNames, reportLabels...)
}
var files coredata.TrustCenterFiles
var files coredata.CompliancePortalFiles
if len(fileIDs) > 0 {
if err := files.LoadByIDs(ctx, tx, scope, fileIDs); err != nil && !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load files by IDs: %w", err)
@@ -668,14 +668,14 @@ func (s *Service) sendPortalDocumentAccessRejectedEmail(
}
}
emailPresenterCfg, err := s.GetPortalEmailPresenterConfig(ctx, scope, access.TrustCenterID)
emailPresenterCfg, err := s.GetPortalEmailPresenterConfig(ctx, scope, access.CompliancePortalID)
if err != nil {
return fmt.Errorf("cannot get compliance page email presenter config: %w", err)
}
emailPresenter := emails.NewPresenterFromConfig(emailPresenterCfg, profile.FullName)
subject, textBody, htmlBody, err := emailPresenter.RenderTrustCenterDocumentAccessRejected(
subject, textBody, htmlBody, err := emailPresenter.RenderCompliancePortalDocumentAccessRejected(
ctx,
fileNames,
organization.Name,
@@ -702,11 +702,11 @@ func (s *Service) sendPortalDocumentAccessRejectedEmail(
return nil
}
func extractExistingIDs(accesses coredata.TrustCenterDocumentAccesses) ([]gid.GID, []gid.GID, []gid.GID) {
func extractExistingIDs(accesses coredata.CompliancePortalDocumentAccesses) ([]gid.GID, []gid.GID, []gid.GID) {
var (
documentIDs []gid.GID
reportIDs []gid.GID
trustCenterFileIDs []gid.GID
documentIDs []gid.GID
reportIDs []gid.GID
compliancePortalFileIDs []gid.GID
)
for _, access := range accesses {
@@ -718,12 +718,12 @@ func extractExistingIDs(accesses coredata.TrustCenterDocumentAccesses) ([]gid.GI
reportIDs = append(reportIDs, *access.ReportFileID)
}
if access.TrustCenterFileID != nil {
trustCenterFileIDs = append(trustCenterFileIDs, *access.TrustCenterFileID)
if access.CompliancePortalFileID != nil {
compliancePortalFileIDs = append(compliancePortalFileIDs, *access.CompliancePortalFileID)
}
}
return documentIDs, reportIDs, trustCenterFileIDs
return documentIDs, reportIDs, compliancePortalFileIDs
}
func filterExistingIDs(allIDs []gid.GID, existingIDs []gid.GID) []gid.GID {

View File

@@ -38,14 +38,14 @@ func (s *Service) GetPortalFile(
ctx context.Context,
scope coredata.Scoper,
organizationID gid.GID,
trustCenterFileID gid.GID,
) (*coredata.TrustCenterFile, error) {
trustCenterFile := &coredata.TrustCenterFile{}
compliancePortalFileID gid.GID,
) (*coredata.CompliancePortalFile, error) {
compliancePortalFile := &coredata.CompliancePortalFile{}
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := trustCenterFile.LoadByID(ctx, conn, scope, trustCenterFileID)
err := compliancePortalFile.LoadByID(ctx, conn, scope, compliancePortalFileID)
if err != nil {
return fmt.Errorf("cannot load compliance page file: %w", err)
}
@@ -57,30 +57,30 @@ func (s *Service) GetPortalFile(
return nil, err
}
if trustCenterFile.OrganizationID != organizationID {
if compliancePortalFile.OrganizationID != organizationID {
return nil, ErrPortalFileNotFound
}
if trustCenterFile.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
if compliancePortalFile.CompliancePortalVisibility == coredata.CompliancePortalVisibilityNone {
return nil, ErrPortalFileNotVisible
}
return trustCenterFile, nil
return compliancePortalFile, nil
}
func (s *Service) ListPortalFilesForOrganizationID(
ctx context.Context,
scope coredata.Scoper,
organizationID gid.GID,
cursor *page.Cursor[coredata.TrustCenterFileOrderField],
filter *coredata.TrustCenterFileFilter,
) (*page.Page[*coredata.TrustCenterFile, coredata.TrustCenterFileOrderField], error) {
var trustCenterFiles coredata.TrustCenterFiles
cursor *page.Cursor[coredata.CompliancePortalFileOrderField],
filter *coredata.CompliancePortalFileFilter,
) (*page.Page[*coredata.CompliancePortalFile, coredata.CompliancePortalFileOrderField], error) {
var compliancePortalFiles coredata.CompliancePortalFiles
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := trustCenterFiles.LoadByOrganizationID(ctx, conn, scope, organizationID, cursor, filter)
err := compliancePortalFiles.LoadByOrganizationID(ctx, conn, scope, organizationID, cursor, filter)
if err != nil {
return fmt.Errorf("cannot load compliance page files: %w", err)
}
@@ -92,16 +92,16 @@ func (s *Service) ListPortalFilesForOrganizationID(
return nil, err
}
return page.NewPage(trustCenterFiles, cursor), nil
return page.NewPage(compliancePortalFiles, cursor), nil
}
func (s *Service) ExportPortalFile(
ctx context.Context,
scope coredata.Scoper,
trustCenterFileID gid.GID,
compliancePortalFileID gid.GID,
email mail.Addr,
) ([]byte, string, error) {
fileData, mimeType, err := s.exportPortalFileData(ctx, scope, trustCenterFileID)
fileData, mimeType, err := s.exportPortalFileData(ctx, scope, compliancePortalFileID)
if err != nil {
return nil, "", fmt.Errorf("cannot export compliance page file: %w", err)
}
@@ -121,31 +121,31 @@ func (s *Service) ExportPortalFile(
func (s *Service) ExportPortalFileWithoutWatermark(
ctx context.Context,
scope coredata.Scoper,
trustCenterFileID gid.GID,
compliancePortalFileID gid.GID,
) ([]byte, string, error) {
return s.exportPortalFileData(ctx, scope, trustCenterFileID)
return s.exportPortalFileData(ctx, scope, compliancePortalFileID)
}
func (s *Service) exportPortalFileData(
ctx context.Context,
scope coredata.Scoper,
trustCenterFileID gid.GID,
compliancePortalFileID gid.GID,
) ([]byte, string, error) {
var (
trustCenterFile *coredata.TrustCenterFile
file *coredata.File
compliancePortalFile *coredata.CompliancePortalFile
file *coredata.File
)
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
trustCenterFile = &coredata.TrustCenterFile{}
if err := trustCenterFile.LoadByID(ctx, conn, scope, trustCenterFileID); err != nil {
compliancePortalFile = &coredata.CompliancePortalFile{}
if err := compliancePortalFile.LoadByID(ctx, conn, scope, compliancePortalFileID); err != nil {
return fmt.Errorf("cannot load compliance page file: %w", err)
}
file = &coredata.File{}
if err := file.LoadByID(ctx, conn, scope, trustCenterFile.FileID); err != nil {
if err := file.LoadByID(ctx, conn, scope, compliancePortalFile.FileID); err != nil {
return fmt.Errorf("cannot load file: %w", err)
}

View File

@@ -34,16 +34,16 @@ func (s *Service) ListPortalReferencesForPortalID(
ctx context.Context,
scope coredata.Scoper,
compliancePageID gid.GID,
cursor *page.Cursor[coredata.TrustCenterReferenceOrderField],
) (*page.Page[*coredata.TrustCenterReference, coredata.TrustCenterReferenceOrderField], error) {
var references coredata.TrustCenterReferences
cursor *page.Cursor[coredata.CompliancePortalReferenceOrderField],
) (*page.Page[*coredata.CompliancePortalReference, coredata.CompliancePortalReferenceOrderField], error) {
var references coredata.CompliancePortalReferences
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
err := references.LoadByTrustCenterID(ctx, conn, scope, compliancePageID, cursor)
err := references.LoadByCompliancePortalID(ctx, conn, scope, compliancePageID, cursor)
if err != nil {
return fmt.Errorf("cannot load compliance page references: %w", err)
}
@@ -62,8 +62,8 @@ func (s *Service) GetPortalReference(
ctx context.Context,
scope coredata.Scoper,
referenceID gid.GID,
) (*coredata.TrustCenterReference, error) {
reference := &coredata.TrustCenterReference{}
) (*coredata.CompliancePortalReference, error) {
reference := &coredata.CompliancePortalReference{}
err := s.pg.WithConn(
ctx,

View File

@@ -36,13 +36,13 @@ func (s *Service) GetPortal(
ctx context.Context,
scope coredata.Scoper,
compliancePageID gid.GID,
) (*coredata.TrustCenter, error) {
var compliancePage *coredata.TrustCenter
) (*coredata.CompliancePortal, error) {
var compliancePage *coredata.CompliancePortal
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -67,7 +67,7 @@ func (s *Service) GetPortalNDAFile(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -102,7 +102,7 @@ func (s *Service) GeneratePortalNDAFileURL(
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -137,7 +137,7 @@ func (s *Service) GetPortalEmailPresenterConfig(
compliancePageID gid.GID,
) (emails.PresenterConfig, error) {
var (
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
organization = &coredata.Organization{}
logoFile = &coredata.File{}
compliancePageURL string
@@ -161,7 +161,7 @@ func (s *Service) GetPortalEmailPresenterConfig(
return fmt.Errorf("cannot load organization: %w", err)
}
publicURL, err := s.management.PublicURLForCompliancePage(
publicURL, err := s.management.PublicURLForCompliancePortal(
ctx,
conn,
scope,

View File

@@ -95,8 +95,8 @@ func NewService(
func (s *Service) GetPortalByID(
ctx context.Context,
id gid.GID,
) (*coredata.TrustCenter, error) {
compliancePage := &coredata.TrustCenter{}
) (*coredata.CompliancePortal, error) {
compliancePage := &coredata.CompliancePortal{}
err := s.pg.WithConn(
ctx,
@@ -130,12 +130,12 @@ func (s *Service) GetPortalEffectiveCanonicalHost(ctx context.Context, complianc
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, conn, coredata.NewNoScope(), compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
domain, err := s.management.EffectiveDomainForCompliancePage(ctx, conn, coredata.NewNoScope(), compliancePage)
domain, err := s.management.EffectiveDomainForCompliancePortal(ctx, conn, coredata.NewNoScope(), compliancePage)
if err != nil {
return err
}
@@ -186,8 +186,8 @@ func (s *Service) GetPortalCanonicalBaseURL(
return parsed.String(), nil
}
func (s *Service) GetPortalByDomainName(ctx context.Context, domain string) (*coredata.TrustCenter, error) {
compliancePage := &coredata.TrustCenter{}
func (s *Service) GetPortalByDomainName(ctx context.Context, domain string) (*coredata.CompliancePortal, error) {
compliancePage := &coredata.CompliancePortal{}
err := s.pg.WithConn(
ctx,
@@ -201,7 +201,7 @@ func (s *Service) GetPortalByDomainName(ctx context.Context, domain string) (*co
return fmt.Errorf("cannot load custom domain: %w", err)
}
compliancePage = &coredata.TrustCenter{}
compliancePage = &coredata.CompliancePortal{}
if err := compliancePage.LoadByDomainID(ctx, conn, customDomain.ID); err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return ErrPageNotFound
@@ -224,7 +224,7 @@ func (s *Service) GetPortalByDomainName(ctx context.Context, domain string) (*co
// the compliance page that belongs to the given organization. This is used by the
// esign certificate worker which needs per-org branding at render time.
func (s *Service) GetPortalEmailPresenterConfigByOrganizationID(ctx context.Context, orgID gid.GID) (emails.PresenterConfig, error) {
var compliancePage coredata.TrustCenter
var compliancePage coredata.CompliancePortal
scope := coredata.NewScopeFromObjectID(orgID)
@@ -265,13 +265,13 @@ func (s *Service) GetPortalOrganization(
return org, nil
}
func (s *Service) GetPortalMembership(ctx context.Context, compliancePageID gid.GID, identityID gid.GID) (*coredata.TrustCenterAccess, error) {
membership := &coredata.TrustCenterAccess{}
func (s *Service) GetPortalMembership(ctx context.Context, compliancePageID gid.GID, identityID gid.GID) (*coredata.CompliancePortalAccess, error) {
membership := &coredata.CompliancePortalAccess{}
err := s.pg.WithConn(
ctx,
func(ctx context.Context, conn pg.Querier) error {
return membership.LoadByTrustCenterIDAndIdentityID(
return membership.LoadByCompliancePortalIDAndIdentityID(
ctx,
conn,
coredata.NewScopeFromObjectID(compliancePageID),
@@ -295,9 +295,9 @@ func (s *Service) ProvisionPortalMember(
ctx context.Context,
compliancePageID gid.GID,
identityID gid.GID,
) (*coredata.TrustCenterAccess, error) {
) (*coredata.CompliancePortalAccess, error) {
var (
access *coredata.TrustCenterAccess
access *coredata.CompliancePortalAccess
now = time.Now()
scope = coredata.NewScopeFromObjectID(compliancePageID)
)
@@ -305,7 +305,7 @@ func (s *Service) ProvisionPortalMember(
err := s.pg.WithTx(
ctx,
func(ctx context.Context, tx pg.Tx) error {
compliancePage := &coredata.TrustCenter{}
compliancePage := &coredata.CompliancePortal{}
if err := compliancePage.LoadByID(ctx, tx, scope, compliancePageID); err != nil {
return fmt.Errorf("cannot load compliance page: %w", err)
}
@@ -315,20 +315,20 @@ func (s *Service) ProvisionPortalMember(
return fmt.Errorf("cannot load identity: %w", err)
}
access = &coredata.TrustCenterAccess{}
if err := access.LoadByTrustCenterIDAndIdentityID(ctx, tx, scope, compliancePageID, identityID); err != nil {
access = &coredata.CompliancePortalAccess{}
if err := access.LoadByCompliancePortalIDAndIdentityID(ctx, tx, scope, compliancePageID, identityID); err != nil {
if !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load compliance page access: %w", err)
}
access = &coredata.TrustCenterAccess{
ID: gid.New(scope.GetTenantID(), coredata.TrustCenterAccessEntityType),
OrganizationID: compliancePage.OrganizationID,
TenantID: scope.GetTenantID(),
IdentityID: identityID,
TrustCenterID: compliancePageID,
CreatedAt: now,
UpdatedAt: now,
access = &coredata.CompliancePortalAccess{
ID: gid.New(scope.GetTenantID(), coredata.CompliancePortalAccessEntityType),
OrganizationID: compliancePage.OrganizationID,
TenantID: scope.GetTenantID(),
IdentityID: identityID,
CompliancePortalID: compliancePageID,
CreatedAt: now,
UpdatedAt: now,
}
var sig *coredata.ElectronicSignature

View File

@@ -63,8 +63,8 @@ func (s *Service) ListThirdPartiesForOrganizationID(
filter *coredata.ThirdPartyFilter,
) (*page.Page[*coredata.ThirdParty, coredata.ThirdPartyOrderField], error) {
if filter == nil {
showOnTrustCenter := true
filter = coredata.NewThirdPartyFilter(&showOnTrustCenter, nil, nil, nil, nil)
showOnCompliancePortal := true
filter = coredata.NewThirdPartyFilter(&showOnCompliancePortal, nil, nil, nil, nil)
}
var thirdParties coredata.ThirdParties
@@ -99,7 +99,7 @@ func (s *Service) ListDistinctPortalCategoriesForOrganizationID(
func(ctx context.Context, conn pg.Querier) error {
thirdParties := &coredata.ThirdParties{}
result, err := thirdParties.LoadDistinctTrustCenterCategoriesByOrganizationID(ctx, conn, scope, organizationID)
result, err := thirdParties.LoadDistinctCompliancePortalCategoriesByOrganizationID(ctx, conn, scope, organizationID)
if err != nil {
return fmt.Errorf("cannot load thirdParty categories: %w", err)
}
@@ -128,7 +128,7 @@ func (s *Service) ListDistinctPortalCountriesForOrganizationID(
func(ctx context.Context, conn pg.Querier) error {
thirdParties := &coredata.ThirdParties{}
result, err := thirdParties.LoadDistinctTrustCenterCountriesByOrganizationID(ctx, conn, scope, organizationID)
result, err := thirdParties.LoadDistinctCompliancePortalCountriesByOrganizationID(ctx, conn, scope, organizationID)
if err != nil {
return fmt.Errorf("cannot load thirdParty countries: %w", err)
}
@@ -152,8 +152,8 @@ func (s *Service) CountThirdPartiesForPortalID(
filter *coredata.ThirdPartyFilter,
) (int, error) {
if filter == nil {
showOnTrustCenter := true
filter = coredata.NewThirdPartyFilter(&showOnTrustCenter, nil, nil, nil, nil)
showOnCompliancePortal := true
filter = coredata.NewThirdPartyFilter(&showOnCompliancePortal, nil, nil, nil, nil)
}
var count int