Skip to content

Commit

Permalink
updated the overall structure of the flow application according to th…
Browse files Browse the repository at this point in the history
…e clean architecture
  • Loading branch information
ibilalkayy committed Apr 29, 2024
1 parent b940296 commit 2f55e81
Show file tree
Hide file tree
Showing 52 changed files with 725 additions and 725 deletions.
6 changes: 3 additions & 3 deletions cmd/budget/handler/adjust.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/common/functions"
"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
conversion "github.com/ibilalkayy/flow/common/utils"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand All @@ -17,7 +17,7 @@ var AdjustCmd = &cobra.Command{
oldCategory, _ := cmd.Flags().GetString("oldcategory")
newCategory, _ := cmd.Flags().GetString("newcategory")
amount, _ := cmd.Flags().GetString("amount")
newAmount := functions.StringToInt(amount)
newAmount := conversion.StringToInt(amount)

err := budget_db.UpdateBudget(oldCategory, newCategory, newAmount)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions cmd/budget/handler/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package budget_handler
import (
"log"

"github.com/ibilalkayy/flow/internal/common/functions"
"github.com/ibilalkayy/flow/internal/entities"
"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
conversion "github.com/ibilalkayy/flow/common/utils"
"github.com/ibilalkayy/flow/entities"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand All @@ -16,10 +16,10 @@ var CreateCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
category, _ := cmd.Flags().GetString("category")
amount, _ := cmd.Flags().GetString("amount")
amountInt := functions.StringToInt(amount)
amountInt := conversion.StringToInt(amount)

bv := entities.BudgetVariables{Category: category, Amount: amountInt}
err := budget_db.CreateBudget(&bv, "internal/framework_drivers/db/migrations/")
err := budget_db.CreateBudget(&bv, "framework_drivers/db/migrations/")
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/budget/handler/get.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package budget_handler

import (
"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/budget/handler/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package budget_handler
import (
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/budget/handler/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/budget/sub_handler/msg.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package budget_subhandler

import (
internal_alert "github.com/ibilalkayy/flow/internal/app/alert"
usecases_alert "github.com/ibilalkayy/flow/usecases/app/alert"
"github.com/spf13/cobra"
)

Expand All @@ -11,7 +11,7 @@ var MsgCmd = &cobra.Command{
Short: "The CLI message for the alert notifications",
Run: func(cmd *cobra.Command, args []string) {
category, _ := cmd.Flags().GetString("category")
internal_alert.CheckNotification(category)
usecases_alert.CheckNotification(category)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/budget/sub_handler/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package budget_subhandler
import (
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/alert_db"
"github.com/ibilalkayy/flow/framework_drivers/db/alert_db"
"github.com/spf13/cobra"
)

Expand Down
16 changes: 8 additions & 8 deletions cmd/budget/sub_handler/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package budget_subhandler
import (
"log"

internal_alert "github.com/ibilalkayy/flow/internal/app/alert"
"github.com/ibilalkayy/flow/internal/common/functions"
"github.com/ibilalkayy/flow/internal/entities"
conversion "github.com/ibilalkayy/flow/common/utils"
"github.com/ibilalkayy/flow/entities"
usecases_alert "github.com/ibilalkayy/flow/usecases/app/alert"
"github.com/spf13/cobra"
)

Expand All @@ -23,10 +23,10 @@ var SetupCmd = &cobra.Command{
minute, _ := cmd.Flags().GetString("minute")
second, _ := cmd.Flags().GetString("second")

dayInt := functions.StringToInt(day)
hourInt := functions.StringToInt(hour)
minuteInt := functions.StringToInt(minute)
secondInt := functions.StringToInt(second)
dayInt := conversion.StringToInt(day)
hourInt := conversion.StringToInt(hour)
minuteInt := conversion.StringToInt(minute)
secondInt := conversion.StringToInt(second)

av := entities.AlertVariables{
Category: category,
Expand All @@ -39,7 +39,7 @@ var SetupCmd = &cobra.Command{
Seconds: secondInt,
}

err := internal_alert.AlertSetup(&av)
err := usecases_alert.AlertSetup(&av)
if err != nil {
log.Fatal(err)
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/budget/sub_handler/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package budget_subhandler
import (
"log"

"github.com/ibilalkayy/flow/internal/common/functions"
"github.com/ibilalkayy/flow/internal/entities"
"github.com/ibilalkayy/flow/internal/framework_drivers/db/alert_db"
conversion "github.com/ibilalkayy/flow/common/utils"
"github.com/ibilalkayy/flow/entities"
"github.com/ibilalkayy/flow/framework_drivers/db/alert_db"
"github.com/spf13/cobra"
)

Expand All @@ -23,10 +23,10 @@ var UpdateCmd = &cobra.Command{
minute, _ := cmd.Flags().GetString("minute")
second, _ := cmd.Flags().GetString("second")

dayInt := functions.StringToInt(day)
hourInt := functions.StringToInt(hour)
minuteInt := functions.StringToInt(minute)
secondInt := functions.StringToInt(second)
dayInt := conversion.StringToInt(day)
hourInt := conversion.StringToInt(hour)
minuteInt := conversion.StringToInt(minute)
secondInt := conversion.StringToInt(second)

av := entities.AlertVariables{
Category: category,
Expand Down
2 changes: 1 addition & 1 deletion cmd/budget/sub_handler/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/alert_db"
"github.com/ibilalkayy/flow/framework_drivers/db/alert_db"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"

"github.com/ibilalkayy/flow/cmd"
internal_init "github.com/ibilalkayy/flow/internal/app/init"
"github.com/ibilalkayy/flow/internal/entities"
"github.com/ibilalkayy/flow/internal/framework_drivers/db"
"github.com/ibilalkayy/flow/entities"
"github.com/ibilalkayy/flow/framework_drivers/db"
usecases_init "github.com/ibilalkayy/flow/usecases/app/init"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -69,7 +69,7 @@ func initApp(cmd *cobra.Command, args []string) {
}

func initializeApplication(authParams *entities.AuthVariables, dbParams *entities.DatabaseVariables) error {
err := internal_init.WriteEnvFile(authParams, dbParams)
err := usecases_init.WriteEnvFile(authParams, dbParams)
if err != nil {
return fmt.Errorf("error writing to .env file: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra"
)

const version = "v0.1.93"
const version = "v0.1.94"

// rootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Expand Down
8 changes: 4 additions & 4 deletions cmd/spend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/ibilalkayy/flow/cmd"
spend_handler "github.com/ibilalkayy/flow/cmd/spend/handler"
internal_spending "github.com/ibilalkayy/flow/internal/app/spend"
"github.com/ibilalkayy/flow/internal/common/functions"
conversion "github.com/ibilalkayy/flow/common/utils"
usecases_spending "github.com/ibilalkayy/flow/usecases/app/spend"
"github.com/spf13/cobra"
)

Expand All @@ -19,10 +19,10 @@ var SpendCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
categoryName, _ := cmd.Flags().GetString("category")
spendingAmount, _ := cmd.Flags().GetString("amount")
spendingAmountInt := functions.StringToInt(spendingAmount)
spendingAmountInt := conversion.StringToInt(spendingAmount)

if len(categoryName) != 0 && spendingAmountInt != 0 {
err := internal_spending.SpendMoney(categoryName, spendingAmountInt)
err := usecases_spending.SpendMoney(categoryName, spendingAmountInt)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/spend/sub_handler/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package spend_subhandler
import (
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/spend/sub_handler/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/budget_db"
"github.com/ibilalkayy/flow/framework_drivers/db/budget_db"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/total_amount/handler/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package total_amount_handler
import (
"log"

internal_total_amount "github.com/ibilalkayy/flow/internal/app/total_amount"
"github.com/ibilalkayy/flow/internal/common/functions"
conversion "github.com/ibilalkayy/flow/common/utils"
usecases_total_amount "github.com/ibilalkayy/flow/usecases/app/total_amount"
"github.com/spf13/cobra"
)

Expand All @@ -16,9 +16,9 @@ var AddCmd = &cobra.Command{
amount, _ := cmd.Flags().GetString("amount")
include_category, _ := cmd.Flags().GetString("include")
label, _ := cmd.Flags().GetString("label")
totalAmount := functions.StringToInt(amount)
totalAmount := conversion.StringToInt(amount)

err := internal_total_amount.SetTotalAmount(totalAmount, include_category, label)
err := usecases_total_amount.SetTotalAmount(totalAmount, include_category, label)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/total_amount/handler/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package total_amount_handler
import (
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/total_amount/handler/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package total_amount_handler
import (
"log"

"github.com/ibilalkayy/flow/internal/common/functions"
"github.com/ibilalkayy/flow/internal/entities"
"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
conversion "github.com/ibilalkayy/flow/common/utils"
"github.com/ibilalkayy/flow/entities"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand All @@ -18,7 +18,7 @@ var UpdateCmd = &cobra.Command{
new_category, _ := cmd.Flags().GetString("newcategory")
amount, _ := cmd.Flags().GetString("amount")
label, _ := cmd.Flags().GetString("label")
totalAmount := functions.StringToInt(amount)
totalAmount := conversion.StringToInt(amount)

tv := entities.TotalAmountVariables{
Included: old_category,
Expand Down
4 changes: 2 additions & 2 deletions cmd/total_amount/sub_handler/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/entities"
"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
"github.com/ibilalkayy/flow/entities"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/total_amount/sub_handler/amount.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/total_amount/sub_handler/categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/total_amount/sub_handler/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/total_amount/sub_handler/inactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"log"

"github.com/ibilalkayy/flow/internal/entities"
"github.com/ibilalkayy/flow/internal/framework_drivers/db/total_amount_db"
"github.com/ibilalkayy/flow/entities"
"github.com/ibilalkayy/flow/framework_drivers/db/total_amount_db"
"github.com/spf13/cobra"
)

Expand Down
Loading

0 comments on commit 2f55e81

Please sign in to comment.