Parcourir la source

[server] Remove deprecated API

Neeraj Gupta il y a 1 an
Parent
commit
28335700e3
3 fichiers modifiés avec 0 ajouts et 45 suppressions
  1. 0 1
      server/cmd/museum/main.go
  2. 0 12
      server/pkg/api/collection.go
  3. 0 32
      server/pkg/controller/collection.go

+ 0 - 1
server/cmd/museum/main.go

@@ -504,7 +504,6 @@ func main() {
 	privateAPI.GET("/collections/v2/diff", collectionHandler.GetDiffV2)
 	privateAPI.GET("/collections/file", collectionHandler.GetFile)
 	privateAPI.GET("/collections/sharees", collectionHandler.GetSharees)
-	privateAPI.DELETE("/collections/v2/:collectionID", collectionHandler.Trash)
 	privateAPI.DELETE("/collections/v3/:collectionID", collectionHandler.TrashV3)
 	privateAPI.POST("/collections/rename", collectionHandler.Rename)
 	privateAPI.PUT("/collections/magic-metadata", collectionHandler.PrivateMagicMetadataUpdate)

+ 0 - 12
server/pkg/api/collection.go

@@ -360,18 +360,6 @@ func (h *CollectionHandler) GetSharees(c *gin.Context) {
 	})
 }
 
-// Trash deletes a given collection and move file exclusive to the collection to trash
-func (h *CollectionHandler) Trash(c *gin.Context) {
-	cID, _ := strconv.ParseInt(c.Param("collectionID"), 10, 64)
-	userID := auth.GetUserID(c.Request.Header)
-	err := h.Controller.Trash(c, userID, cID)
-	if err != nil {
-		handler.Error(c, stacktrace.Propagate(err, ""))
-		return
-	}
-	c.Status(http.StatusOK)
-}
-
 func (h *CollectionHandler) TrashV3(c *gin.Context) {
 	var req ente.TrashCollectionV3Request
 	if err := c.ShouldBindQuery(&req); err != nil {

+ 0 - 32
server/pkg/controller/collection.go

@@ -619,38 +619,6 @@ func (c *CollectionController) GetSharees(ctx *gin.Context, cID int64, userID in
 	return sharees, nil
 }
 
-// Trash deletes a given collection and files exclusive to the collection
-func (c *CollectionController) Trash(ctx *gin.Context, userID int64, cID int64) error {
-	resp, err := c.AccessCtrl.GetCollection(ctx, &access.GetCollectionParams{
-		CollectionID:   cID,
-		ActorUserID:    userID,
-		IncludeDeleted: true,
-		VerifyOwner:    true,
-	})
-	if err != nil {
-		return stacktrace.Propagate(err, "")
-	}
-	if !resp.Collection.AllowDelete() {
-		return stacktrace.Propagate(ente.ErrBadRequest, fmt.Sprintf("deleting albums of type %s is not allowed", resp.Collection.Type))
-	}
-	if resp.Collection.IsDeleted {
-		log.WithFields(log.Fields{
-			"c_id":    cID,
-			"user_id": userID,
-		}).Warning("Collection is already deleted")
-		return nil
-	}
-	err = c.PublicCollectionCtrl.Disable(ctx, cID)
-	if err != nil {
-		return stacktrace.Propagate(err, "failed to disabled public share url")
-	}
-	err = c.CollectionRepo.ScheduleDelete(cID, true)
-	if err != nil {
-		return stacktrace.Propagate(err, "")
-	}
-	return nil
-}
-
 // TrashV3 deletes a given collection and based on user input (TrashCollectionV3Request.KeepFiles as FALSE) , it will move all files present in the underlying collection
 // to trash.
 func (c *CollectionController) TrashV3(ctx *gin.Context, req ente.TrashCollectionV3Request) error {