Refactor api naming
This commit is contained in:
parent
7e8788f7f8
commit
f103aafda8
@ -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"]
|
||||
@ -2,7 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"portfolio/api/handler"
|
||||
"portfolio_api/api/handler"
|
||||
)
|
||||
|
||||
func ApiRoutes(mux **http.ServeMux) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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"
|
||||
)
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package webHandler
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"portfolio/types"
|
||||
"portfolio_api/types"
|
||||
)
|
||||
|
||||
func InitProjectpage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@ -2,7 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"portfolio/api/webHandler"
|
||||
"portfolio_api/api/webHandler"
|
||||
)
|
||||
|
||||
func WebRoutes(mux **http.ServeMux) {
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
"portfolio/database/ent"
|
||||
"portfolio_api/database/ent"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
@ -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"
|
||||
)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -4,7 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"portfolio/database/ent/team"
|
||||
"portfolio_api/database/ent/team"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -4,7 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"portfolio/database/ent/user"
|
||||
"portfolio_api/database/ent/user"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module portfolio
|
||||
module portfolio_api
|
||||
|
||||
go 1.22
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package validate
|
||||
|
||||
import (
|
||||
"portfolio/database/ent"
|
||||
"portfolio_api/database/ent"
|
||||
)
|
||||
|
||||
func UserIsValid(u *ent.User) bool {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user