From 7df02c270b9a89cc41760207c46d65c26d7c66ce Mon Sep 17 00:00:00 2001 From: Bagas Aulia Rezki Date: Sun, 18 Aug 2024 12:59:19 +0700 Subject: [PATCH] refactor: move client page view file to client folder and reorganize file structure --- handler/auth/google/setup/setup.go | 4 ++-- handler/auth/totp/totp.go | 2 +- handler/download/download.go | 2 +- handler/error/error.go | 2 +- handler/forgotPassword/forgotPassword.go | 4 ++-- handler/forgotPassword/verify/verify.go | 5 ++--- handler/index/index.go | 2 +- handler/signin/signin.go | 2 +- handler/signup/signup.go | 4 ++-- handler/signup/verify/verify.go | 2 +- handler/upload/upload.go | 2 +- handler/user/session/terminate/terminate.go | 2 +- handler/user/totp/setup.go | 2 +- handler/user/user.go | 2 +- view/{ => client}/auth/auth.templ | 2 +- view/{ => client}/download/download.templ | 2 +- view/{ => client}/email/email.templ | 0 view/{ => client}/error/error.templ | 2 +- view/{ => client}/forgotPassword/forgotPassword.templ | 2 +- view/{ => client}/index/index.templ | 2 +- view/{ => client}/layout/base.templ | 0 view/{ => client}/signin/signin.templ | 2 +- view/{ => client}/signup/signup.templ | 2 +- view/{ => client}/totp/totp.templ | 2 +- view/{ => client}/upload/upload.templ | 2 +- view/{ => client}/user/totp/setup.templ | 2 +- view/{ => client}/user/user.templ | 2 +- 27 files changed, 29 insertions(+), 30 deletions(-) rename view/{ => client}/auth/auth.templ (99%) rename view/{ => client}/download/download.templ (98%) rename view/{ => client}/email/email.templ (100%) rename view/{ => client}/error/error.templ (97%) rename view/{ => client}/forgotPassword/forgotPassword.templ (99%) rename view/{ => client}/index/index.templ (99%) rename view/{ => client}/layout/base.templ (100%) rename view/{ => client}/signin/signin.templ (99%) rename view/{ => client}/signup/signup.templ (99%) rename view/{ => client}/totp/totp.templ (98%) rename view/{ => client}/upload/upload.templ (98%) rename view/{ => client}/user/totp/setup.templ (99%) rename view/{ => client}/user/user.templ (99%) diff --git a/handler/auth/google/setup/setup.go b/handler/auth/google/setup/setup.go index 8243f6b..e36220f 100644 --- a/handler/auth/google/setup/setup.go +++ b/handler/auth/google/setup/setup.go @@ -9,8 +9,8 @@ import ( "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/types/models" "github.com/fossyy/filekeeper/utils" - authView "github.com/fossyy/filekeeper/view/auth" - signupView "github.com/fossyy/filekeeper/view/signup" + "github.com/fossyy/filekeeper/view/client/auth" + signupView "github.com/fossyy/filekeeper/view/client/signup" "github.com/google/uuid" "net/http" "sync" diff --git a/handler/auth/totp/totp.go b/handler/auth/totp/totp.go index cce1782..7f3ad23 100644 --- a/handler/auth/totp/totp.go +++ b/handler/auth/totp/totp.go @@ -5,7 +5,7 @@ import ( "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/utils" - totpView "github.com/fossyy/filekeeper/view/totp" + "github.com/fossyy/filekeeper/view/client/totp" "github.com/xlzd/gotp" "net/http" "strings" diff --git a/handler/download/download.go b/handler/download/download.go index ba353a1..e8c1802 100644 --- a/handler/download/download.go +++ b/handler/download/download.go @@ -1,13 +1,13 @@ package downloadHandler import ( + "github.com/fossyy/filekeeper/view/client/download" "net/http" "github.com/fossyy/filekeeper/db" "github.com/fossyy/filekeeper/logger" "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/utils" - downloadView "github.com/fossyy/filekeeper/view/download" ) var log *logger.AggregatedLogger diff --git a/handler/error/error.go b/handler/error/error.go index 8c8785f..a9dcca7 100644 --- a/handler/error/error.go +++ b/handler/error/error.go @@ -2,10 +2,10 @@ package errorHandler import ( "fmt" + "github.com/fossyy/filekeeper/view/client/error" "net/http" "github.com/fossyy/filekeeper/logger" - errorView "github.com/fossyy/filekeeper/view/error" ) var log *logger.AggregatedLogger diff --git a/handler/forgotPassword/forgotPassword.go b/handler/forgotPassword/forgotPassword.go index d5c9df9..fefe38f 100644 --- a/handler/forgotPassword/forgotPassword.go +++ b/handler/forgotPassword/forgotPassword.go @@ -6,6 +6,8 @@ import ( "errors" "fmt" "github.com/fossyy/filekeeper/cache" + "github.com/fossyy/filekeeper/view/client/email" + "github.com/fossyy/filekeeper/view/client/forgotPassword" "github.com/google/uuid" "net/http" "strconv" @@ -17,8 +19,6 @@ import ( "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/types/models" "github.com/fossyy/filekeeper/utils" - emailView "github.com/fossyy/filekeeper/view/email" - forgotPasswordView "github.com/fossyy/filekeeper/view/forgotPassword" "gorm.io/gorm" ) diff --git a/handler/forgotPassword/verify/verify.go b/handler/forgotPassword/verify/verify.go index b1c7dbc..387767f 100644 --- a/handler/forgotPassword/verify/verify.go +++ b/handler/forgotPassword/verify/verify.go @@ -8,9 +8,8 @@ import ( "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/utils" - forgotPasswordView "github.com/fossyy/filekeeper/view/forgotPassword" - signupView "github.com/fossyy/filekeeper/view/signup" - + "github.com/fossyy/filekeeper/view/client/forgotPassword" + signupView "github.com/fossyy/filekeeper/view/client/signup" "net/http" ) diff --git a/handler/index/index.go b/handler/index/index.go index 59e07a3..fb0f693 100644 --- a/handler/index/index.go +++ b/handler/index/index.go @@ -2,10 +2,10 @@ package indexHandler import ( "github.com/fossyy/filekeeper/session" + "github.com/fossyy/filekeeper/view/client/index" "net/http" "github.com/fossyy/filekeeper/logger" - indexView "github.com/fossyy/filekeeper/view/index" ) var log *logger.AggregatedLogger diff --git a/handler/signin/signin.go b/handler/signin/signin.go index edcde52..863cfe9 100644 --- a/handler/signin/signin.go +++ b/handler/signin/signin.go @@ -8,7 +8,7 @@ import ( "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/utils" - signinView "github.com/fossyy/filekeeper/view/signin" + "github.com/fossyy/filekeeper/view/client/signin" "net/http" "strings" ) diff --git a/handler/signup/signup.go b/handler/signup/signup.go index 976bed6..ce3928c 100644 --- a/handler/signup/signup.go +++ b/handler/signup/signup.go @@ -4,6 +4,8 @@ import ( "bytes" "context" "fmt" + "github.com/fossyy/filekeeper/view/client/email" + signupView "github.com/fossyy/filekeeper/view/client/signup" "net/http" "strconv" "sync" @@ -15,8 +17,6 @@ import ( "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/types/models" "github.com/fossyy/filekeeper/utils" - emailView "github.com/fossyy/filekeeper/view/email" - signupView "github.com/fossyy/filekeeper/view/signup" "github.com/google/uuid" ) diff --git a/handler/signup/verify/verify.go b/handler/signup/verify/verify.go index 13f759c..ff9e4b4 100644 --- a/handler/signup/verify/verify.go +++ b/handler/signup/verify/verify.go @@ -1,13 +1,13 @@ package signupVerifyHandler import ( + signupView "github.com/fossyy/filekeeper/view/client/signup" "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" ) var log *logger.AggregatedLogger diff --git a/handler/upload/upload.go b/handler/upload/upload.go index a27f3fb..8012887 100644 --- a/handler/upload/upload.go +++ b/handler/upload/upload.go @@ -4,7 +4,7 @@ import ( "github.com/fossyy/filekeeper/cache" "github.com/fossyy/filekeeper/logger" "github.com/fossyy/filekeeper/types" - filesView "github.com/fossyy/filekeeper/view/upload" + filesView "github.com/fossyy/filekeeper/view/client/upload" "io" "net/http" "os" diff --git a/handler/user/session/terminate/terminate.go b/handler/user/session/terminate/terminate.go index c816ac4..f1dd852 100644 --- a/handler/user/session/terminate/terminate.go +++ b/handler/user/session/terminate/terminate.go @@ -2,7 +2,7 @@ package userSessionTerminateHandler import ( "github.com/fossyy/filekeeper/session" - userView "github.com/fossyy/filekeeper/view/user" + "github.com/fossyy/filekeeper/view/client/user" "net/http" ) diff --git a/handler/user/totp/setup.go b/handler/user/totp/setup.go index 6c60740..90fb057 100644 --- a/handler/user/totp/setup.go +++ b/handler/user/totp/setup.go @@ -5,7 +5,7 @@ import ( "encoding/base64" "fmt" "github.com/fossyy/filekeeper/cache" - userTotpSetupView "github.com/fossyy/filekeeper/view/user/totp" + "github.com/fossyy/filekeeper/view/client/user/totp" "image/png" "net/http" "time" diff --git a/handler/user/user.go b/handler/user/user.go index 0a212cc..d40cf64 100644 --- a/handler/user/user.go +++ b/handler/user/user.go @@ -3,11 +3,11 @@ package userHandler import ( "github.com/a-h/templ" "github.com/fossyy/filekeeper/types" + "github.com/fossyy/filekeeper/view/client/user" "net/http" "github.com/fossyy/filekeeper/logger" "github.com/fossyy/filekeeper/session" - userView "github.com/fossyy/filekeeper/view/user" ) var log *logger.AggregatedLogger diff --git a/view/auth/auth.templ b/view/client/auth/auth.templ similarity index 99% rename from view/auth/auth.templ rename to view/client/auth/auth.templ index c74f3dd..2424674 100644 --- a/view/auth/auth.templ +++ b/view/client/auth/auth.templ @@ -2,7 +2,7 @@ package authView import ( "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" ) templ form(err types.Message, title string) { diff --git a/view/download/download.templ b/view/client/download/download.templ similarity index 98% rename from view/download/download.templ rename to view/client/download/download.templ index 6d74992..0357b02 100644 --- a/view/download/download.templ +++ b/view/client/download/download.templ @@ -1,7 +1,7 @@ package downloadView import ( - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" "github.com/fossyy/filekeeper/types" ) diff --git a/view/email/email.templ b/view/client/email/email.templ similarity index 100% rename from view/email/email.templ rename to view/client/email/email.templ diff --git a/view/error/error.templ b/view/client/error/error.templ similarity index 97% rename from view/error/error.templ rename to view/client/error/error.templ index df48245..81bfd7b 100644 --- a/view/error/error.templ +++ b/view/client/error/error.templ @@ -1,6 +1,6 @@ package errorView -import "github.com/fossyy/filekeeper/view/layout" +import "github.com/fossyy/filekeeper/view/client/layout" templ NotFound(title string){ @layout.Base(title){ diff --git a/view/forgotPassword/forgotPassword.templ b/view/client/forgotPassword/forgotPassword.templ similarity index 99% rename from view/forgotPassword/forgotPassword.templ rename to view/client/forgotPassword/forgotPassword.templ index bf0634b..f5ec80c 100644 --- a/view/forgotPassword/forgotPassword.templ +++ b/view/client/forgotPassword/forgotPassword.templ @@ -2,7 +2,7 @@ package forgotPasswordView import ( "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" ) templ content(title string, err types.Message) { diff --git a/view/index/index.templ b/view/client/index/index.templ similarity index 99% rename from view/index/index.templ rename to view/client/index/index.templ index ba6b13f..76dc8e9 100644 --- a/view/index/index.templ +++ b/view/client/index/index.templ @@ -2,7 +2,7 @@ package indexView import ( "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" ) templ content(title string, user types.User) { diff --git a/view/layout/base.templ b/view/client/layout/base.templ similarity index 100% rename from view/layout/base.templ rename to view/client/layout/base.templ diff --git a/view/signin/signin.templ b/view/client/signin/signin.templ similarity index 99% rename from view/signin/signin.templ rename to view/client/signin/signin.templ index 53d0253..daf12ed 100644 --- a/view/signin/signin.templ +++ b/view/client/signin/signin.templ @@ -2,7 +2,7 @@ package signinView import ( "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" ) templ content(err types.Message, title string) { diff --git a/view/signup/signup.templ b/view/client/signup/signup.templ similarity index 99% rename from view/signup/signup.templ rename to view/client/signup/signup.templ index 5eb8b9b..1ea20e7 100644 --- a/view/signup/signup.templ +++ b/view/client/signup/signup.templ @@ -2,7 +2,7 @@ package signup import ( "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" ) templ form(err types.Message, title string) { diff --git a/view/totp/totp.templ b/view/client/totp/totp.templ similarity index 98% rename from view/totp/totp.templ rename to view/client/totp/totp.templ index a645c11..8de63f2 100644 --- a/view/totp/totp.templ +++ b/view/client/totp/totp.templ @@ -1,7 +1,7 @@ package totpView import ( - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" "github.com/fossyy/filekeeper/types" ) diff --git a/view/upload/upload.templ b/view/client/upload/upload.templ similarity index 98% rename from view/upload/upload.templ rename to view/client/upload/upload.templ index 995a3e1..79ec381 100644 --- a/view/upload/upload.templ +++ b/view/client/upload/upload.templ @@ -1,6 +1,6 @@ package uploadView -import "github.com/fossyy/filekeeper/view/layout" +import "github.com/fossyy/filekeeper/view/client/layout" templ content(title string) { @layout.Base(title){ diff --git a/view/user/totp/setup.templ b/view/client/user/totp/setup.templ similarity index 99% rename from view/user/totp/setup.templ rename to view/client/user/totp/setup.templ index ddf4e20..dfcf542 100644 --- a/view/user/totp/setup.templ +++ b/view/client/user/totp/setup.templ @@ -1,7 +1,7 @@ package userTotpSetupView import ( - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" "github.com/fossyy/filekeeper/types" ) diff --git a/view/user/user.templ b/view/client/user/user.templ similarity index 99% rename from view/user/user.templ rename to view/client/user/user.templ index 011aba1..12daab6 100644 --- a/view/user/user.templ +++ b/view/client/user/user.templ @@ -2,7 +2,7 @@ package userView import ( "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/layout" + "github.com/fossyy/filekeeper/view/client/layout" "github.com/fossyy/filekeeper/session" )