[server] Remove unused endpoint
This commit is contained in:
@@ -483,7 +483,6 @@ func main() {
|
||||
privateAPI.GET("/users/payment-token", userHandler.GetPaymentToken)
|
||||
privateAPI.GET("/users/families-token", userHandler.GetFamiliesToken)
|
||||
privateAPI.GET("/users/accounts-token", userHandler.GetAccountsToken)
|
||||
privateAPI.GET("/users/details", userHandler.GetDetails)
|
||||
privateAPI.GET("/users/details/v2", userHandler.GetDetailsV2)
|
||||
privateAPI.POST("/users/change-email", userHandler.ChangeEmail)
|
||||
privateAPI.GET("/users/sessions", userHandler.GetActiveSessions)
|
||||
|
||||
@@ -54,18 +54,6 @@ func (h *UserHandler) Logout(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{})
|
||||
}
|
||||
|
||||
// GetDetails returns details about the requesting user
|
||||
func (h *UserHandler) GetDetails(c *gin.Context) {
|
||||
details, err := h.UserController.GetDetails(c)
|
||||
if err != nil {
|
||||
handler.Error(c, stacktrace.Propagate(err, ""))
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"details": details,
|
||||
})
|
||||
}
|
||||
|
||||
// GetDetailsV2 returns details about the requesting user
|
||||
func (h *UserHandler) GetDetailsV2(c *gin.Context) {
|
||||
userID := auth.GetUserID(c.Request.Header)
|
||||
@@ -188,7 +176,7 @@ func (h *UserHandler) GetSessionValidityV2(c *gin.Context) {
|
||||
keyAttributes, err := h.UserController.GetAttributes(userID)
|
||||
if err == nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"hasSetKeys": true,
|
||||
"hasSetKeys": true,
|
||||
"keyAttributes": keyAttributes,
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"github.com/ente-io/museum/ente"
|
||||
"github.com/ente-io/museum/ente/details"
|
||||
bonus "github.com/ente-io/museum/ente/storagebonus"
|
||||
"github.com/ente-io/museum/pkg/utils/auth"
|
||||
"github.com/ente-io/museum/pkg/utils/recover"
|
||||
"github.com/ente-io/museum/pkg/utils/time"
|
||||
"github.com/ente-io/stacktrace"
|
||||
@@ -12,40 +11,6 @@ import (
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
func (c *UserController) GetDetails(ctx *gin.Context) (details.UserDetailsResponse, error) {
|
||||
|
||||
enteApp := ctx.MustGet("app").(ente.App)
|
||||
|
||||
userID := auth.GetUserID(ctx.Request.Header)
|
||||
user, err := c.UserRepo.Get(userID)
|
||||
if err != nil {
|
||||
return details.UserDetailsResponse{}, stacktrace.Propagate(err, "")
|
||||
}
|
||||
usage, err := c.FileRepo.GetUsage(userID)
|
||||
if err != nil {
|
||||
return details.UserDetailsResponse{}, stacktrace.Propagate(err, "")
|
||||
}
|
||||
fileCount, err := c.FileRepo.GetFileCountForUser(userID, enteApp)
|
||||
if err != nil {
|
||||
return details.UserDetailsResponse{}, stacktrace.Propagate(err, "")
|
||||
}
|
||||
sharedCollectionsCount, err := c.CollectionRepo.GetSharedCollectionsCount(userID)
|
||||
if err != nil {
|
||||
return details.UserDetailsResponse{}, stacktrace.Propagate(err, "")
|
||||
}
|
||||
subscription, err := c.BillingController.GetSubscription(ctx, userID)
|
||||
if err != nil {
|
||||
return details.UserDetailsResponse{}, stacktrace.Propagate(err, "")
|
||||
}
|
||||
return details.UserDetailsResponse{
|
||||
Email: user.Email,
|
||||
Usage: usage,
|
||||
FileCount: &fileCount,
|
||||
SharedCollectionsCount: &sharedCollectionsCount,
|
||||
Subscription: subscription,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *UserController) getUserFileCountWithCache(userID int64, app ente.App) (int64, error) {
|
||||
// Check if the value is present in the cache
|
||||
if count, ok := c.UserCache.GetFileCount(userID, app); ok {
|
||||
|
||||
Reference in New Issue
Block a user