Refactor api naming

This commit is contained in:
darius 2024-05-15 15:49:39 +02:00
parent 7e8788f7f8
commit f103aafda8
35 changed files with 80 additions and 80 deletions

View File

@ -4,7 +4,7 @@ FROM golang:latest
# Set the working directory to /app
WORKDIR .
# Copy the current directory contents into the container at /app
COPY .. .
COPY . .
# Download and install any required dependencies
RUN go mod download
@ -19,4 +19,4 @@ RUN go generate ./database/ent
EXPOSE 4002
# Define the command to run the app when the container starts
CMD ["./portfolio"]
CMD ["./portfolio_api"]

View File

@ -2,7 +2,7 @@ package api
import (
"net/http"
"portfolio/api/handler"
"portfolio_api/api/handler"
)
func ApiRoutes(mux **http.ServeMux) {

View File

@ -5,10 +5,10 @@ import (
"encoding/json"
"fmt"
"net/http"
"portfolio/database/ent"
"portfolio/database/ent/user"
"portfolio/database/query"
"portfolio/service/bcrypt"
"portfolio_api/database/ent"
"portfolio_api/database/ent/user"
"portfolio_api/database/query"
"portfolio_api/service/bcrypt"
)
func Login(w http.ResponseWriter, r *http.Request) {

View File

@ -4,10 +4,10 @@ import (
"context"
"encoding/json"
"net/http"
"portfolio/database/ent"
"portfolio/database/ent/user"
"portfolio/database/query"
"portfolio/service/validate"
"portfolio_api/database/ent"
"portfolio_api/database/ent/user"
"portfolio_api/database/query"
"portfolio_api/service/validate"
"strconv"
)

View File

@ -3,7 +3,7 @@ package webHandler
import (
"html/template"
"net/http"
"portfolio/types"
"portfolio_api/types"
)
func InitProjectpage(w http.ResponseWriter, r *http.Request) {

View File

@ -2,7 +2,7 @@ package api
import (
"net/http"
"portfolio/api/webHandler"
"portfolio_api/api/webHandler"
)
func WebRoutes(mux **http.ServeMux) {

View File

@ -4,7 +4,7 @@ import (
"context"
"log"
"os"
"portfolio/database/ent"
"portfolio_api/database/ent"
_ "github.com/go-sql-driver/mysql"
)

View File

@ -9,11 +9,11 @@ import (
"log"
"reflect"
"portfolio/database/ent/migrate"
"portfolio_api/database/ent/migrate"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent"
"entgo.io/ent/dialect"

View File

@ -6,9 +6,9 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"reflect"
"sync"

View File

@ -4,11 +4,11 @@ package enttest
import (
"context"
"portfolio/database/ent"
"portfolio_api/database/ent"
// required by schema hooks.
_ "portfolio/database/ent/runtime"
_ "portfolio_api/database/ent/runtime"
"portfolio/database/ent/migrate"
"portfolio_api/database/ent/migrate"
"entgo.io/ent/dialect/sql/schema"
)

View File

@ -5,7 +5,7 @@ package hook
import (
"context"
"fmt"
"portfolio/database/ent"
"portfolio_api/database/ent"
)
// The ProjectFunc type is an adapter to allow the use of ordinary

View File

@ -6,10 +6,10 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/predicate"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"sync"
"entgo.io/ent"

View File

@ -4,8 +4,8 @@ package ent
import (
"fmt"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"strings"
"entgo.io/ent"

View File

@ -3,7 +3,7 @@
package project
import (
"portfolio/database/ent/predicate"
"portfolio_api/database/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,8 +6,8 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"

View File

@ -4,8 +4,8 @@ package ent
import (
"context"
"portfolio/database/ent/predicate"
"portfolio/database/ent/project"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/project"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,9 +6,9 @@ import (
"context"
"fmt"
"math"
"portfolio/database/ent/predicate"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,9 +6,9 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/predicate"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -4,7 +4,7 @@ package ent
import (
"fmt"
"portfolio/database/ent/team"
"portfolio_api/database/ent/team"
"strings"
"entgo.io/ent"

View File

@ -3,7 +3,7 @@
package team
import (
"portfolio/database/ent/predicate"
"portfolio_api/database/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,9 +6,9 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"

View File

@ -4,8 +4,8 @@ package ent
import (
"context"
"portfolio/database/ent/predicate"
"portfolio/database/ent/team"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/team"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -7,10 +7,10 @@ import (
"database/sql/driver"
"fmt"
"math"
"portfolio/database/ent/predicate"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,10 +6,10 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/predicate"
"portfolio/database/ent/project"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/project"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -4,7 +4,7 @@ package ent
import (
"fmt"
"portfolio/database/ent/user"
"portfolio_api/database/ent/user"
"strings"
"entgo.io/ent"

View File

@ -3,7 +3,7 @@
package user
import (
"portfolio/database/ent/predicate"
"portfolio_api/database/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,8 +6,8 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"

View File

@ -4,8 +4,8 @@ package ent
import (
"context"
"portfolio/database/ent/predicate"
"portfolio/database/ent/user"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -7,9 +7,9 @@ import (
"database/sql/driver"
"fmt"
"math"
"portfolio/database/ent/predicate"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -6,9 +6,9 @@ import (
"context"
"errors"
"fmt"
"portfolio/database/ent/predicate"
"portfolio/database/ent/team"
"portfolio/database/ent/user"
"portfolio_api/database/ent/predicate"
"portfolio_api/database/ent/team"
"portfolio_api/database/ent/user"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"

View File

@ -4,9 +4,9 @@ import (
"context"
"fmt"
"log"
"portfolio/database"
"portfolio/database/ent"
"portfolio/database/ent/user"
"portfolio_api/database"
"portfolio_api/database/ent"
"portfolio_api/database/ent/user"
)
func GetLogin(ctx context.Context, name string) (*ent.User, error) {

View File

@ -4,9 +4,9 @@ import (
"context"
"fmt"
"log"
"portfolio/database"
"portfolio/database/ent"
"portfolio/database/ent/user"
"portfolio_api/database"
"portfolio_api/database/ent"
"portfolio_api/database/ent/user"
)
func GetUser(ctx context.Context, id int) (*ent.User, error) {

View File

@ -1,4 +1,4 @@
module portfolio
module portfolio_api
go 1.22

View File

@ -4,8 +4,8 @@ import (
"github.com/joho/godotenv"
"log"
"net/http"
api2 "portfolio/api"
"portfolio/database"
api2 "portfolio_api/api"
"portfolio_api/database"
)
func main() {
@ -15,7 +15,7 @@ func main() {
log.Fatalf(".env not found: %v", err)
return
}
print("test")
// Create a new request multiplexer
// Take incoming requests and dispatch them to the matching webHandler
mux := http.NewServeMux()

View File

@ -1,7 +1,7 @@
package validate
import (
"portfolio/database/ent"
"portfolio_api/database/ent"
)
func UserIsValid(u *ent.User) bool {