This commit is contained in:
Neeraj Gupta
2025-04-25 17:33:36 +05:30
parent 8b02edb19f
commit d5b137ea82
7 changed files with 7 additions and 15 deletions

View File

@@ -217,7 +217,7 @@ func main() {
billingController := controller.NewBillingController(plans,
appStoreController, playStoreController, stripeController,
discordController, emailNotificationCtrl,
billingRepo, userRepo, usageRepo, storagBonusRepo, commonBillController, notificationHistoryRepo)
billingRepo, userRepo, usageRepo, storagBonusRepo, commonBillController)
pushController := controller.NewPushController(pushRepo, taskLockingRepo, hostName)
mailingListsController := controller.NewMailingListsController()

View File

@@ -118,7 +118,6 @@ func (c *AppStoreController) HandleNotification(ctx *gin.Context, notification a
if err != nil {
return stacktrace.Propagate(err, "")
}
} else {
if notification.NotificationType == appstore.NotificationTypeDidChangeRenewalStatus {
err := c.BillingRepo.UpdateSubscriptionCancellationStatus(subscription.UserID, notification.AutoRenewStatus == "false")

View File

@@ -54,7 +54,6 @@ func NewBillingController(
usageRepo *repo.UsageRepository,
storageBonusRepo *storagebonus.Repository,
commonBillCtrl *commonbilling.Controller,
notificationHistoryRepo *repo.NotificationHistoryRepository,
) *BillingController {
return &BillingController{
BillingPlansPerAccount: plans,

View File

@@ -54,7 +54,6 @@ type EmailNotificationController struct {
LockController *lock.LockController
NotificationHistoryRepo *repo.NotificationHistoryRepository
isSendingStorageLimitExceededMails bool
FamilyRepo *repo.FamilyRepository
}
func (c *EmailNotificationController) OnFirstFileUpload(userID int64, userAgent string) {

View File

@@ -171,8 +171,8 @@ func (c *FileController) Create(ctx *gin.Context, userID int64, file ente.File,
}
// all iz well
// var usage int64
file, _, err = c.FileRepo.Create(file, fileSize, thumbnailSize, fileSize+thumbnailSize, userID, app)
var usage int64
file, usage, err = c.FileRepo.Create(file, fileSize, thumbnailSize, fileSize+thumbnailSize, userID, app)
if err != nil {
if err == ente.ErrDuplicateFileObjectFound || err == ente.ErrDuplicateThumbnailObjectFound {
var existing ente.File
@@ -192,10 +192,9 @@ func (c *FileController) Create(ctx *gin.Context, userID int64, file ente.File,
}
return file, stacktrace.Propagate(err, "")
}
// The OnFirstFileUpload Email trigger will not be used and replaced with EmailAfterSignUp
// if usage == fileSize+thumbnailSize {
// go c.EmailNotificationCtrl.OnFirstFileUpload(file.OwnerID, userAgent)
// }
if usage == fileSize+thumbnailSize {
go c.EmailNotificationCtrl.OnFirstFileUpload(file.OwnerID, userAgent)
}
return file, nil
}

View File

@@ -260,10 +260,8 @@ func (c *StripeController) handleCheckoutSessionCompleted(event stripe.Event, co
}()
}
if err != nil {
return ente.StripeEventLog{UserID: userID, StripeSubscription: stripeSubscription, Event: event}, stacktrace.Propagate(err, "Failed to change subscription")
return ente.StripeEventLog{}, stacktrace.Propagate(err, "Failed to change subscription")
}
// Execute DeleteLastNotificationTime entry after successful execution of ReplaceSubscription
return ente.StripeEventLog{UserID: userID, StripeSubscription: stripeSubscription, Event: event}, nil
} else {
priceID, err := c.getPriceIDFromSession(session.ID)
@@ -306,7 +304,6 @@ func (c *StripeController) handleCustomerSubscriptionUpdated(event stripe.Event,
// events to update the state
if currentSubscription.ProductID != newSubscription.ProductID {
c.BillingRepo.ReplaceSubscription(currentSubscription.ID, newSubscription)
}
fullStripeSub, err := c.getStripeSubscriptionWithPaymentMethod(currentSubscription)

View File

@@ -2,7 +2,6 @@ package repo
import (
"database/sql"
"github.com/ente-io/stacktrace"
"github.com/ente-io/museum/pkg/utils/time"