fix missing allow deny list on campaign create

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2026-02-04 21:09:25 +01:00
parent fd0ccea01d
commit 95cd1f8a7c
2 changed files with 3 additions and 1 deletions

View File

@@ -152,6 +152,7 @@ func (r *Campaign) Insert(
if err != nil { if err != nil {
return nil, errs.Wrap(err) return nil, errs.Wrap(err)
} }
if allowDeny, err := campaign.AllowDenyIDs.Get(); err == nil && len(allowDeny) > 0 { if allowDeny, err := campaign.AllowDenyIDs.Get(); err == nil && len(allowDeny) > 0 {
err = r.AddAllowDenyLists(ctx, &id, allowDeny) err = r.AddAllowDenyLists(ctx, &id, allowDeny)
if err != nil { if err != nil {
@@ -211,7 +212,6 @@ func (r *Campaign) AddAllowDenyLists(
campaignID *uuid.UUID, campaignID *uuid.UUID,
allowDenyIDs []*uuid.UUID, allowDenyIDs []*uuid.UUID,
) error { ) error {
batch := []database.CampaignAllowDeny{} batch := []database.CampaignAllowDeny{}
for _, id := range allowDenyIDs { for _, id := range allowDenyIDs {
batch = append(batch, database.CampaignAllowDeny{ batch = append(batch, database.CampaignAllowDeny{

View File

@@ -164,11 +164,13 @@ func (c *Campaign) Create(
c.Logger.Errorw("failed to create campaign", "error", err) c.Logger.Errorw("failed to create campaign", "error", err)
return nil, errs.Wrap(err) return nil, errs.Wrap(err)
} }
createdCampaign, err := c.CampaignRepository.GetByID( createdCampaign, err := c.CampaignRepository.GetByID(
ctx, ctx,
id, id,
&repository.CampaignOption{ &repository.CampaignOption{
WithRecipientGroups: true, WithRecipientGroups: true,
WithAllowDeny: true,
}, },
) )
if err != nil { if err != nil {