Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server] Remove unused endpoint

Neeraj Gupta65497862eadd
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go
index 0536871755..3391b43ecc 100644
--- a/server/cmd/museum/main.go
+++ b/server/cmd/museum/main.go
@@ -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)
diff --git a/server/pkg/api/user.go b/server/pkg/api/user.go
index 51a3516975..c02fce36c7 100644
--- a/server/pkg/api/user.go
+++ b/server/pkg/api/user.go
@@ -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 {
diff --git a/server/pkg/controller/user/user_details.go b/server/pkg/controller/user/user_details.go
index 08d3ad016c..cce7ef1392 100644
--- a/server/pkg/controller/user/user_details.go
+++ b/server/pkg/controller/user/user_details.go
@@ -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 {