reformat van backend naar fullstack
This commit is contained in:
parent
4c432e8841
commit
4aa6d1fedd
@ -1,4 +1,4 @@
|
|||||||
name: build and run backend
|
name: build and deploy portfolio
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -21,9 +21,9 @@ jobs:
|
|||||||
- name: Docker login
|
- name: Docker login
|
||||||
run: docker login docker.kleinwizard.nl -u Darius -p ${{ secrets.DOCKER_PASSWORD }}
|
run: docker login docker.kleinwizard.nl -u Darius -p ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Build the Docker image
|
- name: Build the Docker image
|
||||||
run: docker build . --file Dockerfile --tag docker.kleinwizard.nl/portfolio-backend:latest
|
run: docker build . --file Dockerfile --tag docker.kleinwizard.nl/portfolio:latest
|
||||||
- name: Docker push
|
- name: Docker push
|
||||||
run: docker push docker.kleinwizard.nl/portfolio-backend:latest
|
run: docker push docker.kleinwizard.nl/portfolio:latest
|
||||||
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
@ -38,6 +38,6 @@ jobs:
|
|||||||
- name: Docker login
|
- name: Docker login
|
||||||
run: docker login docker.kleinwizard.nl -u Darius -p ${{ secrets.DOCKER_PASSWORD }}
|
run: docker login docker.kleinwizard.nl -u Darius -p ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Docker pull
|
- name: Docker pull
|
||||||
run: docker pull docker.kleinwizard.nl/portfolio-backend
|
run: docker pull docker.kleinwizard.nl/portfolio
|
||||||
- name: Docker run
|
- name: Docker run
|
||||||
run: docker run --rm -d -p 4002:4002 --name portfolioApi docker.kleinwizard.nl/portfolio-backend
|
run: docker run --rm -d -p 4002:4002 --name portfolioApi docker.kleinwizard.nl/portfolio
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package handler
|
|
||||||
|
|
||||||
import "net/http"
|
|
||||||
|
|
||||||
func CatchAllHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.WriteHeader(http.StatusGone)
|
|
||||||
_, err := w.Write([]byte("Bad endpoint"))
|
|
||||||
if err != nil {
|
|
||||||
InternalServerErrorHandler(w, r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
_, err := w.Write([]byte("test"))
|
|
||||||
if err != nil {
|
|
||||||
InternalServerErrorHandler(w, r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test2Handler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
_, err := w.Write([]byte("test2"))
|
|
||||||
if err != nil {
|
|
||||||
InternalServerErrorHandler(w, r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
backend/api/handler/mainHandler.go
Normal file
11
backend/api/handler/mainHandler.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
func CatchAllHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(http.StatusGone)
|
||||||
|
_, err := w.Write([]byte("Bad endpoint"))
|
||||||
|
if err != nil {
|
||||||
|
InternalServerErrorHandler(w, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"portfolio-backend/database/ent"
|
"portfolio/backend/database/ent"
|
||||||
"portfolio-backend/database/query"
|
"portfolio/backend/database/query"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -5,7 +5,7 @@ import (
|
|||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"portfolio-backend/database/ent"
|
"portfolio/backend/database/ent"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
)
|
)
|
||||||
@ -9,11 +9,11 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"portfolio-backend/database/ent/migrate"
|
"portfolio/backend/database/ent/migrate"
|
||||||
|
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/database/ent/user"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -4,11 +4,11 @@ package enttest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"portfolio-backend/database/ent"
|
"portfolio/backend/database/ent"
|
||||||
// required by schema hooks.
|
// required by schema hooks.
|
||||||
_ "portfolio-backend/database/ent/runtime"
|
_ "portfolio/backend/database/ent/runtime"
|
||||||
|
|
||||||
"portfolio-backend/database/ent/migrate"
|
"portfolio/backend/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-backend/database/ent"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/database/ent/user"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
@ -3,7 +3,7 @@
|
|||||||
package project
|
package project
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio-backend/database/ent/predicate"
|
"portfolio/backend/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-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/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"
|
||||||
@ -3,8 +3,8 @@
|
|||||||
package ent
|
package ent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio-backend/database/ent/schema"
|
"portfolio/backend/database/ent/schema"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/database/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The init function reads all schema descriptors with runtime code
|
// The init function reads all schema descriptors with runtime code
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
// The schema-stitching logic is generated in portfolio-backend/database/ent/runtime.go
|
// The schema-stitching logic is generated in portfolio/backend/database/ent/runtime.go
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "v0.13.0" // Version of ent codegen.
|
Version = "v0.13.0" // Version of ent codegen.
|
||||||
@ -4,7 +4,7 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
@ -3,7 +3,7 @@
|
|||||||
package team
|
package team
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio-backend/database/ent/predicate"
|
"portfolio/backend/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-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/project"
|
"portfolio/backend/database/ent/project"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/user"
|
"portfolio/backend/database/ent/user"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
@ -3,7 +3,7 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"portfolio-backend/database/ent/predicate"
|
"portfolio/backend/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-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database/ent/predicate"
|
"portfolio/backend/database/ent/predicate"
|
||||||
"portfolio-backend/database/ent/team"
|
"portfolio/backend/database/ent/team"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/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-backend/database"
|
"portfolio/backend/database"
|
||||||
"portfolio-backend/database/ent"
|
"portfolio/backend/database/ent"
|
||||||
"portfolio-backend/database/ent/user"
|
"portfolio/backend/database/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetUser(ctx context.Context, id int) (*ent.User, error) {
|
func GetUser(ctx context.Context, id int) (*ent.User, error) {
|
||||||
Loading…
x
Reference in New Issue
Block a user