diff --git a/user/manager.go b/user/manager.go index 0aeb93fd..4c733cdb 100644 --- a/user/manager.go +++ b/user/manager.go @@ -217,8 +217,8 @@ const ( ` insertTierQuery = ` - INSERT INTO tier (code, name, messages_limit, messages_expiry_duration, emails_limit, reservations_limit, attachment_file_size_limit, attachment_total_size_limit, attachment_expiry_duration) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + INSERT INTO tier (code, name, messages_limit, messages_expiry_duration, emails_limit, reservations_limit, attachment_file_size_limit, attachment_total_size_limit, attachment_expiry_duration, stripe_price_id) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ` selectTierIDQuery = `SELECT id FROM tier WHERE code = ?` selectTiersQuery = ` @@ -872,7 +872,7 @@ func (a *Manager) DefaultAccess() Permission { // CreateTier creates a new tier in the database func (a *Manager) CreateTier(tier *Tier) error { - if _, err := a.db.Exec(insertTierQuery, tier.Code, tier.Name, tier.MessagesLimit, int64(tier.MessagesExpiryDuration.Seconds()), tier.EmailsLimit, tier.ReservationsLimit, tier.AttachmentFileSizeLimit, tier.AttachmentTotalSizeLimit, int64(tier.AttachmentExpiryDuration.Seconds())); err != nil { + if _, err := a.db.Exec(insertTierQuery, tier.Code, tier.Name, tier.MessagesLimit, int64(tier.MessagesExpiryDuration.Seconds()), tier.EmailsLimit, tier.ReservationsLimit, tier.AttachmentFileSizeLimit, tier.AttachmentTotalSizeLimit, int64(tier.AttachmentExpiryDuration.Seconds()), tier.StripePriceID); err != nil { return err } return nil diff --git a/user/manager_test.go b/user/manager_test.go index 3c7b2704..021ac470 100644 --- a/user/manager_test.go +++ b/user/manager_test.go @@ -261,7 +261,7 @@ func TestManager_ChangeRoleFromTierUserToAdmin(t *testing.T) { require.Nil(t, a.CreateTier(&Tier{ Code: "pro", Name: "ntfy Pro", - Paid: true, + StripePriceID: "price123", MessagesLimit: 5_000, MessagesExpiryDuration: 3 * 24 * time.Hour, EmailsLimit: 50,