app/repository/UndoStackRepository.java
public CompletionStage<Integer> undoItemOnTopOfStack(Integer userId) {
        return supplyAsync(() -> {
            List<UndoStack> undoStackList = getUsersStack(userId);
            if (undoStackList.isEmpty()) {
                return 0;
            }
            UndoStack topOfStack = undoStackList.get(0);
            for (UndoStack item : undoStackList) {
                if (item.getEntryId() > topOfStack.getEntryId()) {
                    topOfStack = item;
                }
            }

            switch (topOfStack.getItem_type()) {
                case "profile":
                    profileRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "trip":
                    tripRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "destination":
                    destinationRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "treasure_hunt":
                    treasureHuntRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "artist":
                    artistRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "event":
                    eventRepository.setSoftDeleteId(topOfStack.getObjectId(), 0);
                    break;
                default:
                    break;
            }

            ebeanServer.find(UndoStack.class)
                    .where()
                    .eq("profile_id", topOfStack.getProfileId())
                    .eq("object_id", topOfStack.getObjectId())
                    .delete();

            return 1;
        }, executionContext);
    }
/**
     * Undoes a soft delete for the item on top of the stack,
     * this deletes the item from the stack and,
     * sets the softDelete value to 0 for the appropriate object in the database (profile, trip...)
     * @return boolean, true if worked successfully, else false
     */
Undoes a soft delete for the item on top of the stack,
this deletes the item from the stack and,
sets the softDelete value to 0 for the appropriate object in the database (profile, trip...)
@return boolean, true if worked successfully, else false
Undoes a soft delete for the item on top of the stack this deletes the item from the stack and sets the softDelete value to 0 for the appropriate object in the database ( profile trip ... ) @return boolean true if worked successfully else false
public CompletionStage<Integer> undoItemOnTopOfStack(Integer userId) {
        return supplyAsync(() -> {
            List<UndoStack> undoStackList = getUsersStack(userId);
            if (undoStackList.isEmpty()) {
                return 0;
            }
            UndoStack topOfStack = undoStackList.get(0);
            for (UndoStack item : undoStackList) {
                if (item.getEntryId() > topOfStack.getEntryId()) {
                    topOfStack = item;
                }
            }
            switch (topOfStack.getItem_type()) {
                case "profile":
                    profileRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "trip":
                    tripRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "destination":
                    destinationRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "treasure_hunt":
                    treasureHuntRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "artist":
                    artistRepository.setSoftDelete(topOfStack.getObjectId(), 0);
                    break;
                case "event":
                    eventRepository.setSoftDeleteId(topOfStack.getObjectId(), 0);
                    break;
                default:
                    break;
            }
            ebeanServer.find(UndoStack.class)
                    .where()
                    .eq("profile_id", topOfStack.getProfileId())
                    .eq("object_id", topOfStack.getObjectId())
                    .delete();
            return 1;
        }, executionContext);
    }
public CompletionStage < Integer > undoItemOnTopOfStack ( Integer userId ) { return supplyAsync ( ( ) -> { List < UndoStack > undoStackList = getUsersStack ( userId ) ; if ( undoStackList . isEmpty ( ) ) { return 0 ; } UndoStack topOfStack = undoStackList . get ( 0 ) ; for ( UndoStack item : undoStackList ) { if ( item . getEntryId ( ) > topOfStack . getEntryId ( ) ) { topOfStack = item ; } } switch ( topOfStack . getItem_type ( ) ) { case "profile" : profileRepository . setSoftDelete ( topOfStack . getObjectId ( ) , 0 ) ; break ; case "trip" : tripRepository . setSoftDelete ( topOfStack . getObjectId ( ) , 0 ) ; break ; case "destination" : destinationRepository . setSoftDelete ( topOfStack . getObjectId ( ) , 0 ) ; break ; case "treasure_hunt" : treasureHuntRepository . setSoftDelete ( topOfStack . getObjectId ( ) , 0 ) ; break ; case "artist" : artistRepository . setSoftDelete ( topOfStack . getObjectId ( ) , 0 ) ; break ; case "event" : eventRepository . setSoftDeleteId ( topOfStack . getObjectId ( ) , 0 ) ; break ; default : break ; } ebeanServer . find ( UndoStack . class ) . where ( ) . eq ( "profile_id" , topOfStack . getProfileId ( ) ) . eq ( "object_id" , topOfStack . getObjectId ( ) ) . delete ( ) ; return 1 ; } , executionContext ) ; }
Undoes a soft delete for the item on top of the stack,
 this deletes the item from the stack and,
 sets the softDelete value to 0 for the appropriate object in the database (profile, trip...)
 @return boolean, true if worked successfully, else false
Undoes a soft delete for the item on top of the stack this deletes the item from the stack and sets the softDelete value to 0 for the appropriate object in the database ( profile trip ... ) @return boolean true if worked successfully else false