send admin alert when new network created

This commit is contained in:
talksik
2026-04-22 08:50:03 -07:00
parent 64a21198b3
commit 2e9ff742a0
2 changed files with 18 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
package constants
const FlowyAdminEmail = "team@flowylabs.ai"
+15 -1
View File
@@ -6,15 +6,16 @@ import (
"fmt"
"html"
"log/slog"
"slices"
"strings"
"cloud.google.com/go/firestore"
pbaero "github.com/flowy-live/llink/genproto/aero"
"github.com/flowy-live/llink/internal/billing"
"github.com/flowy-live/llink/internal/constants"
"github.com/flowy-live/llink/internal/utils"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
"slices"
)
var ErrNotFound = errors.New("network not found")
@@ -87,6 +88,19 @@ func (s *serviceImpl) Create(ctx context.Context, name, adminHumanId string) (*N
return nil, err
}
_, err = s.aeroSvc.ShootEmail(ctx, &pbaero.ShootEmailRequest{
ToEmails: []string{constants.FlowyAdminEmail},
Subject: fmt.Sprintf("New network created: %s", network.Name),
TemplateData: &pbaero.ShootEmailRequest_GenericFlowyAdminAlertData{
GenericFlowyAdminAlertData: &pbaero.GenericFlowyAdminAlertData{
Message: "This is a simple notification that a new network was created. Please attend to them.",
},
},
})
if err != nil {
slog.Warn("unable to send admin update email", "error", err)
}
return network, nil
}