Add compliance page mailing list base
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -40,6 +40,14 @@ const (
|
||||
ActionTrustCenterAccessUpdate = "core:trust-center-access:update"
|
||||
ActionTrustCenterAccessDelete = "core:trust-center-access:delete"
|
||||
|
||||
// MailingList actions
|
||||
ActionMailingListUpdate = "core:mailing-list:update"
|
||||
|
||||
// MailingListSubscriber actions
|
||||
ActionMailingListSubscriberList = "core:mailing-list-subscriber:list"
|
||||
ActionMailingListSubscriberCreate = "core:mailing-list-subscriber:create"
|
||||
ActionMailingListSubscriberDelete = "core:mailing-list-subscriber:delete"
|
||||
|
||||
// TrustCenterReference actions
|
||||
ActionTrustCenterReferenceList = "core:trust-center-reference:list"
|
||||
ActionTrustCenterReferenceGetLogoUrl = "core:trust-center-reference:get-logo-url"
|
||||
|
||||
@@ -673,3 +673,36 @@ func (s *TrustCenterService) EmailPresenterConfig(ctx context.Context, complianc
|
||||
|
||||
return emailPresenterCfg, nil
|
||||
}
|
||||
|
||||
func (s *TrustCenterService) GetMailingList(
|
||||
ctx context.Context,
|
||||
trustCenterID gid.GID,
|
||||
) (*coredata.MailingList, error) {
|
||||
var mailingList *coredata.MailingList
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
trustCenter := &coredata.TrustCenter{}
|
||||
if err := trustCenter.LoadByID(ctx, conn, s.svc.scope, trustCenterID); err != nil {
|
||||
return fmt.Errorf("cannot load trust center: %w", err)
|
||||
}
|
||||
|
||||
if trustCenter.MailingListID == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
mailingList = &coredata.MailingList{}
|
||||
if err := mailingList.LoadByID(ctx, conn, s.svc.scope, *trustCenter.MailingListID); err != nil {
|
||||
return fmt.Errorf("cannot load mailing list: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return mailingList, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user