Refactor codebase and removed leftover development code

This commit is contained in:
2024-04-27 16:07:07 +07:00
parent a539e0a2bf
commit 5cf1aacf23
26 changed files with 63 additions and 120 deletions

View File

@ -2,6 +2,8 @@ package downloadHandler
import (
"errors"
"net/http"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/middleware"
@ -10,7 +12,6 @@ import (
"github.com/fossyy/filekeeper/types/models"
"github.com/fossyy/filekeeper/utils"
downloadView "github.com/fossyy/filekeeper/view/download"
"net/http"
)
var log *logger.AggregatedLogger

View File

@ -1,12 +1,13 @@
package downloadFileHandler
import (
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/types/models"
"net/http"
"os"
"path/filepath"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/types/models"
)
var log *logger.AggregatedLogger

View File

@ -1,9 +1,10 @@
package errorHandler
import (
"net/http"
"github.com/fossyy/filekeeper/logger"
errorView "github.com/fossyy/filekeeper/view/error"
"net/http"
)
var log *logger.AggregatedLogger

View File

@ -5,6 +5,11 @@ import (
"context"
"errors"
"fmt"
"net/http"
"strconv"
"sync"
"time"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/email"
"github.com/fossyy/filekeeper/logger"
@ -14,10 +19,6 @@ import (
emailView "github.com/fossyy/filekeeper/view/email"
forgotPasswordView "github.com/fossyy/filekeeper/view/forgotPassword"
"gorm.io/gorm"
"net/http"
"strconv"
"sync"
"time"
)
type ForgotPassword struct {

View File

@ -1,9 +1,10 @@
package indexHandler
import (
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/view/index"
"net/http"
"github.com/fossyy/filekeeper/logger"
indexView "github.com/fossyy/filekeeper/view/index"
)
var log *logger.AggregatedLogger

View File

@ -2,11 +2,12 @@ package logoutHandler
import (
"errors"
"net/http"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/session"
"github.com/fossyy/filekeeper/types"
"github.com/fossyy/filekeeper/utils"
"net/http"
)
var log *logger.AggregatedLogger

View File

@ -9,17 +9,5 @@ func Robot(w http.ResponseWriter, r *http.Request) {
}
func Favicon(w http.ResponseWriter, r *http.Request) {
//currentDir, _ := os.Getwd()
//fmt.Println(currentDir)
//logo := "../../../favicon.ico"
//basePath := filepath.Join(currentDir, "public")
//logoPath := filepath.Join(basePath, logo)
//fmt.Println(filepath.Dir(logoPath))
//if filepath.Dir(logoPath) != basePath {
// log.Print("invalid logo path", logoPath)
// w.WriteHeader(500)
// return
//}
//http.ServeContent()
http.Redirect(w, r, "/public/favicon.ico", http.StatusSeeOther)
}

View File

@ -2,14 +2,15 @@ package signinHandler
import (
"errors"
"net/http"
"strings"
"github.com/fossyy/filekeeper/db/model/user"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/session"
"github.com/fossyy/filekeeper/types"
"github.com/fossyy/filekeeper/utils"
signinView "github.com/fossyy/filekeeper/view/signin"
"net/http"
"strings"
)
var log *logger.AggregatedLogger

View File

@ -5,6 +5,11 @@ import (
"context"
"errors"
"fmt"
"net/http"
"strconv"
"sync"
"time"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/email"
"github.com/fossyy/filekeeper/logger"
@ -15,10 +20,6 @@ import (
signupView "github.com/fossyy/filekeeper/view/signup"
"github.com/google/uuid"
"gorm.io/gorm"
"net/http"
"strconv"
"sync"
"time"
)
type UnverifiedUser struct {

View File

@ -1,12 +1,13 @@
package signupVerifyHandler
import (
"net/http"
"github.com/fossyy/filekeeper/db"
signupHandler "github.com/fossyy/filekeeper/handler/signup"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/types"
signupView "github.com/fossyy/filekeeper/view/signup"
"net/http"
)
var log *logger.AggregatedLogger

View File

@ -3,6 +3,11 @@ package initialisation
import (
"encoding/json"
"errors"
"io"
"net/http"
"os"
"path/filepath"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/middleware"
@ -11,10 +16,6 @@ import (
"github.com/fossyy/filekeeper/types/models"
"github.com/google/uuid"
"gorm.io/gorm"
"io"
"net/http"
"os"
"path/filepath"
)
var log *logger.AggregatedLogger

View File

@ -2,18 +2,19 @@ package uploadHandler
import (
"errors"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/handler/upload/initialisation"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/middleware"
"github.com/fossyy/filekeeper/session"
filesView "github.com/fossyy/filekeeper/view/upload"
"io"
"net/http"
"os"
"path/filepath"
"strconv"
"sync"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/handler/upload/initialisation"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/middleware"
"github.com/fossyy/filekeeper/session"
filesView "github.com/fossyy/filekeeper/view/upload"
)
var log *logger.AggregatedLogger

View File

@ -2,11 +2,12 @@ package userHandler
import (
"errors"
"net/http"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/middleware"
"github.com/fossyy/filekeeper/session"
userView "github.com/fossyy/filekeeper/view/user"
"net/http"
)
var log *logger.AggregatedLogger