Skip to content

Commit

Permalink
Update Internal Imports (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley authored Jan 19, 2024
1 parent e5ddb80 commit e8b23d6
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 46 deletions.
2 changes: 1 addition & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module backend
module github.com/GenerateNU/sac/backend

go 1.21.1

Expand Down
4 changes: 2 additions & 2 deletions backend/src/controllers/category.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package controllers

import (
"backend/src/models"
"backend/src/services"
"github.com/GenerateNU/sac/backend/src/models"
"github.com/GenerateNU/sac/backend/src/services"

"github.com/gofiber/fiber/v2"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/controllers/user.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package controllers

import (
"backend/src/services"
"github.com/GenerateNU/sac/backend/src/services"

"github.com/gofiber/fiber/v2"
)
Expand Down
4 changes: 2 additions & 2 deletions backend/src/database/db.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package database

import (
"backend/src/config"
"backend/src/models"
"github.com/GenerateNU/sac/backend/src/config"
"github.com/GenerateNU/sac/backend/src/models"

"gorm.io/driver/postgres"
"gorm.io/gorm"
Expand Down
7 changes: 4 additions & 3 deletions backend/src/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package main

import (
"backend/src/config"
"backend/src/database"
"backend/src/server"
"flag"
"fmt"

"github.com/GenerateNU/sac/backend/src/config"
"github.com/GenerateNU/sac/backend/src/database"
"github.com/GenerateNU/sac/backend/src/server"
)

// @title SAC API
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/category.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package models

import "backend/src/types"
import "github.com/GenerateNU/sac/backend/src/types"

type Category struct {
types.Model
Expand Down
3 changes: 2 additions & 1 deletion backend/src/models/club.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package models

import (
"backend/src/types"
"time"

"github.com/GenerateNU/sac/backend/src/types"
)

type RecruitmentCycle string
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/comment.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
"backend/src/types"
"github.com/GenerateNU/sac/backend/src/types"
)

type Comment struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/contact.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
"backend/src/types"
"github.com/GenerateNU/sac/backend/src/types"
)

type Media string
Expand Down
3 changes: 2 additions & 1 deletion backend/src/models/event.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package models

import (
"backend/src/types"
"time"

"github.com/GenerateNU/sac/backend/src/types"
)

type EventType string
Expand Down
3 changes: 2 additions & 1 deletion backend/src/models/notification.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package models

import (
"backend/src/types"
"time"

"github.com/GenerateNU/sac/backend/src/types"
)

type NotificationType string
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/point_of_contact.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
"backend/src/types"
"github.com/GenerateNU/sac/backend/src/types"
)

type PointOfContact struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/tag.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
"backend/src/types"
"github.com/GenerateNU/sac/backend/src/types"
)

type Tag struct {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/user.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package models

import "backend/src/types"
import "github.com/GenerateNU/sac/backend/src/types"

type UserRole string

Expand Down
4 changes: 2 additions & 2 deletions backend/src/server/server.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package server

import (
"backend/src/controllers"
"backend/src/services"
"github.com/GenerateNU/sac/backend/src/controllers"
"github.com/GenerateNU/sac/backend/src/services"

"github.com/goccy/go-json"

Expand Down
6 changes: 3 additions & 3 deletions backend/src/services/category.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package services

import (
"backend/src/models"
"backend/src/transactions"
"backend/src/utilities"
"github.com/GenerateNU/sac/backend/src/models"
"github.com/GenerateNU/sac/backend/src/transactions"
"github.com/GenerateNU/sac/backend/src/utilities"

"github.com/gofiber/fiber/v2"
"golang.org/x/text/cases"
Expand Down
4 changes: 2 additions & 2 deletions backend/src/services/user.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package services

import (
"backend/src/models"
"backend/src/transactions"
"github.com/GenerateNU/sac/backend/src/models"
"github.com/GenerateNU/sac/backend/src/transactions"

"gorm.io/gorm"
)
Expand Down
3 changes: 2 additions & 1 deletion backend/src/transactions/category.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package transactions

import (
"backend/src/models"
"errors"

"github.com/GenerateNU/sac/backend/src/models"

"github.com/gofiber/fiber/v2"
"gorm.io/gorm"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/transactions/user.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package transactions

import (
"backend/src/models"
"github.com/GenerateNU/sac/backend/src/models"

"github.com/gofiber/fiber/v2"
"gorm.io/gorm"
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/api/category_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package tests

import (
"backend/src/models"
"backend/src/transactions"
"io"
"testing"

"github.com/GenerateNU/sac/backend/src/models"
"github.com/GenerateNU/sac/backend/src/transactions"

"github.com/goccy/go-json"
)

Expand Down
7 changes: 4 additions & 3 deletions backend/tests/api/helpers.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package tests

import (
"backend/src/config"
"backend/src/database"
"backend/src/server"
"bytes"
crand "crypto/rand"
"fmt"
Expand All @@ -14,6 +11,10 @@ import (
"strings"
"testing"

"github.com/GenerateNU/sac/backend/src/config"
"github.com/GenerateNU/sac/backend/src/database"
"github.com/GenerateNU/sac/backend/src/server"

"github.com/goccy/go-json"

"github.com/gofiber/fiber/v2"
Expand Down
3 changes: 2 additions & 1 deletion backend/tests/api/helpers_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package tests

import (
"backend/src/utilities"
"testing"

"github.com/GenerateNU/sac/backend/src/utilities"

"github.com/huandu/go-assert"
)

Expand Down
5 changes: 3 additions & 2 deletions backend/tests/api/user_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package tests

import (
"backend/src/models"
"backend/src/transactions"
"testing"

"github.com/GenerateNU/sac/backend/src/models"
"github.com/GenerateNU/sac/backend/src/transactions"

"github.com/goccy/go-json"
)

Expand Down
3 changes: 2 additions & 1 deletion backend/tests/utilities_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package tests

import (
"backend/src/utilities"
"testing"

"github.com/GenerateNU/sac/backend/src/utilities"

"github.com/huandu/go-assert"
)

Expand Down
17 changes: 10 additions & 7 deletions cli/commands/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func Format(c *cli.Context) error {
}

frontendDir := filepath.Join(currentDir, "frontend/")
backendDir := filepath.Join(currentDir, "backend/")
backendDir := filepath.Join(currentDir, "github.com/GenerateNU/sac/backend/")
list, err := os.ReadDir(frontendDir)
if err != nil {
return cli.Exit("Error reading frontend directory", 1)
}

if !c.IsSet("frontend") && !c.IsSet("backend") {
if !c.IsSet("frontend") && !c.IsSet("backend") {
formatBackend(backendDir)
for _, f := range list {
if f.IsDir() {
Expand All @@ -63,15 +63,19 @@ func Format(c *cli.Context) error {
formatBackend(backendDir)
}

if c.IsSet("frontend") { formatFrontend(frontendDir, c.String("frontend")) }
if c.IsSet("backend") { formatBackend(backendDir) }
if c.IsSet("frontend") {
formatFrontend(frontendDir, c.String("frontend"))
}
if c.IsSet("backend") {
formatBackend(backendDir)
}

return nil
}

func formatFrontend(frontendDir string, folder string) {
cmd := exec.Command("yarn", "format")
cmd.Dir = filepath.Join(frontendDir, folder)
cmd.Dir = filepath.Join(frontendDir, folder)

err := cmd.Run()
if err != nil {
Expand All @@ -85,11 +89,10 @@ func formatBackend(backendDir string) {
cmd := exec.Command("go", "fmt", "./...")
cmd.Dir = filepath.Join(backendDir)


err := cmd.Run()
if err != nil {
fmt.Println("Error formatting backend, run go fmt ./... in backend folder")
}

fmt.Println("backend", cmd.Dir) // remove
}
}
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module cli
module github.com/GenerateNU/sac/cli

go 1.21.1

Expand Down
3 changes: 1 addition & 2 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"os"
"path/filepath"

"cli/commands"
"github.com/GenerateNU/sac/cli/commands"

"github.com/urfave/cli/v2"
)


func main() {
ROOT_DIR, err := os.Getwd()
if err != nil {
Expand Down

0 comments on commit e8b23d6

Please sign in to comment.