send admin alert when new network created
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
package constants
|
||||
|
||||
const FlowyAdminEmail = "team@flowylabs.ai"
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user