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
|
# Set the working directory to /app
|
||||||
WORKDIR .
|
WORKDIR .
|
||||||
# Copy the current directory contents into the container at /app
|
# Copy the current directory contents into the container at /app
|
||||||
COPY .. .
|
COPY . .
|
||||||
|
|
||||||
# Download and install any required dependencies
|
# Download and install any required dependencies
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
@ -19,4 +19,4 @@ RUN go generate ./database/ent
|
|||||||
EXPOSE 4002
|
EXPOSE 4002
|
||||||
|
|
||||||
# Define the command to run the app when the container starts
|
# Define the command to run the app when the container starts
|
||||||
CMD ["./portfolio"]
|
CMD ["./portfolio_api"]
|
||||||
@ -2,7 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"portfolio/api/handler"
|
"portfolio_api/api/handler"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ApiRoutes(mux **http.ServeMux) {
|
func ApiRoutes(mux **http.ServeMux) {
|
||||||
|
|||||||
@ -5,10 +5,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
"portfolio/database/query"
|
"portfolio_api/database/query"
|
||||||
"portfolio/service/bcrypt"
|
"portfolio_api/service/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Login(w http.ResponseWriter, r *http.Request) {
|
func Login(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
"portfolio/database/query"
|
"portfolio_api/database/query"
|
||||||
"portfolio/service/validate"
|
"portfolio_api/service/validate"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package webHandler
|
|||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"portfolio/types"
|
"portfolio_api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitProjectpage(w http.ResponseWriter, r *http.Request) {
|
func InitProjectpage(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"portfolio/api/webHandler"
|
"portfolio_api/api/webHandler"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WebRoutes(mux **http.ServeMux) {
|
func WebRoutes(mux **http.ServeMux) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -9,11 +9,11 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"portfolio/database/ent/migrate"
|
"portfolio_api/database/ent/migrate"
|
||||||
|
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,11 @@ package enttest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
// required by schema hooks.
|
// 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"
|
"entgo.io/ent/dialect/sql/schema"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -5,7 +5,7 @@ package hook
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The ProjectFunc type is an adapter to allow the use of ordinary
|
// The ProjectFunc type is an adapter to allow the use of ordinary
|
||||||
|
|||||||
@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
package project
|
package project
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
|
|||||||
@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
package team
|
package team
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
|
|||||||
@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import (
|
|||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/project"
|
"portfolio_api/database/ent/project"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
|
|||||||
@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -7,9 +7,9 @@ import (
|
|||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio/database/ent/predicate"
|
"portfolio_api/database/ent/predicate"
|
||||||
"portfolio/database/ent/team"
|
"portfolio_api/database/ent/team"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@ -4,9 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"portfolio/database"
|
"portfolio_api/database"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetLogin(ctx context.Context, name string) (*ent.User, error) {
|
func GetLogin(ctx context.Context, name string) (*ent.User, error) {
|
||||||
|
|||||||
@ -4,9 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"portfolio/database"
|
"portfolio_api/database"
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
"portfolio/database/ent/user"
|
"portfolio_api/database/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetUser(ctx context.Context, id int) (*ent.User, error) {
|
func GetUser(ctx context.Context, id int) (*ent.User, error) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
module portfolio
|
module portfolio_api
|
||||||
|
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import (
|
|||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
api2 "portfolio/api"
|
api2 "portfolio_api/api"
|
||||||
"portfolio/database"
|
"portfolio_api/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -15,7 +15,7 @@ func main() {
|
|||||||
log.Fatalf(".env not found: %v", err)
|
log.Fatalf(".env not found: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
print("test")
|
|
||||||
// Create a new request multiplexer
|
// Create a new request multiplexer
|
||||||
// Take incoming requests and dispatch them to the matching webHandler
|
// Take incoming requests and dispatch them to the matching webHandler
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package validate
|
package validate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio/database/ent"
|
"portfolio_api/database/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UserIsValid(u *ent.User) bool {
|
func UserIsValid(u *ent.User) bool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user