Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add site creation endpoint #215

Merged
merged 11 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
jobs:
frontend:
if: "contains(github.event.pull_request.labels.*.name, 'status: ready for review')"
if: "!contains(github.event.pull_request.labels.*.name, 'status: in progress')"
name: Run frontend tests
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
workdir: frontend

backend:
if: "contains(github.event.pull_request.labels.*.name, 'status: ready for review')"
if: "!contains(github.event.pull_request.labels.*.name, 'status: in progress')"
name: Run backend tests
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 4 additions & 7 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions backend/cmd/rest-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func main() {
}

validationService := validation.New(validation.NewParams{
Postgres: postgres,
EnvService: envService,
Postgres: postgres,
})

emailService, err := email.New(email.NewParams{
Expand All @@ -96,7 +97,8 @@ func main() {
})

siteService := site.New(site.NewParams{
Postgres: postgres,
Postgres: postgres,
ValidationService: validationService,
})

responder := restapiresponder.New(restapiresponder.NewParams{
Expand Down Expand Up @@ -134,6 +136,7 @@ func main() {
sensitiveRateLimit := alice.New(middleware.SensitiveRateLimit(responder, limiterStore))
permissionBasicAuthenticated := alice.New(middleware.PermissionBasicAuthenticated(responder))
permissionUserAccessTokenAuthenticated := alice.New(middleware.PermissionUserAccessTokenAuthenticated(responder))
permissionWrite := alice.New(middleware.PermissionOrganizationOwner(responder))

// handlers: authentication
mux.Handle("POST /authentication/user-access-tokens", sensitiveRateLimit.Extend(permissionBasicAuthenticated).ThenFunc(authenticationHandler.CreateUserAccessToken))
Expand All @@ -153,6 +156,7 @@ func main() {
mux.HandleFunc("/{$}", rootHandler.Index())

// handlers: sites
mux.Handle("POST /sites", permissionWrite.ThenFunc(sitesHandler.Create))
mux.Handle("GET /sites", permissionUserAccessTokenAuthenticated.ThenFunc(sitesHandler.List))

httpServer := http.Server{
Expand Down
21 changes: 20 additions & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,38 @@ require (
github.com/swaggo/swag v1.16.4
github.com/ulule/limiter/v3 v3.11.2
golang.org/x/crypto v0.29.0
golang.org/x/oauth2 v0.24.0
google.golang.org/api v0.206.0
gorm.io/driver/clickhouse v0.6.1
gorm.io/driver/postgres v1.5.9
gorm.io/gorm v1.25.12
)

require (
cloud.google.com/go/auth v0.10.2 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.23.2 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.7.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/spec v0.20.6 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.14.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
Expand All @@ -67,14 +79,21 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/swaggo/files/v2 v2.0.0 // indirect
github.com/th0th/disposableemail v0.0.2-0.20241107110532-1e027547679f // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading