Skip to content

Commit

Permalink
team 関連のAPIの実装 (#20)
Browse files Browse the repository at this point in the history
* openapi code gen

* domain.Team の定義

* repository層の実装

* usecase層の実装

* handlerの実装

* team auth middlewareのテスト

* lint

* 小さなリファクタリング

* idをuuidで扱う

* chore: fix field name of usecase test struct

* AnyTimesを使わないテスト

* repository test

* context.Todo -> context.Background

* requireとassertの使い分け & use require.NoError

* 1つのコンテナでデータベースを複数にする

* 英数字のみのdbnameに修正

* usecase error 名の変更

* handler層のテスト
usecaseのmockを使用

* main.go更新

* handler テストの追加

* repositoryテストの追加

* lint
  • Loading branch information
pirosiki197 authored Jan 16, 2025
1 parent 3c4a091 commit 53cc9fb
Show file tree
Hide file tree
Showing 30 changed files with 2,095 additions and 80 deletions.
4 changes: 3 additions & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/traPtitech/piscon-portal-v2/server/handler"
dbrepo "github.com/traPtitech/piscon-portal-v2/server/repository/db"
"github.com/traPtitech/piscon-portal-v2/server/services/oauth2"
"github.com/traPtitech/piscon-portal-v2/server/usecase"
)

func main() {
Expand Down Expand Up @@ -42,7 +43,8 @@ func main() {
},
}
repo := dbrepo.NewRepository(db)
handler, err := handler.New(repo, config)
useCase := usecase.New(repo)
handler, err := handler.New(useCase, repo, config)
if err != nil {
panic(err)
}
Expand Down
62 changes: 56 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,84 @@ require (
github.com/labstack/echo-contrib v0.17.2
github.com/labstack/echo/v4 v4.13.3
github.com/ogen-go/ogen v1.8.1
github.com/samber/lo v1.47.0
github.com/stephenafamo/bob v0.29.0
github.com/stretchr/testify v1.10.0
github.com/testcontainers/testcontainers-go/modules/mysql v0.35.0
go.uber.org/mock v0.5.0
golang.org/x/oauth2 v0.25.0
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.1
)

require (
dario.cat/mergo v1.0.1 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/aarondl/json v0.0.0-20221020222930-8b0db17ef1bf // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
github.com/docker/docker v27.4.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.3.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/qdm12/reprint v0.0.0-20200326205758-722754a53494 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stephenafamo/scan v0.6.1 // indirect
github.com/testcontainers/testcontainers-go v0.35.0 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/net v0.33.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
go.opentelemetry.io/otel v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.33.0 // indirect
go.opentelemetry.io/otel/trace v1.33.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.8.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 53cc9fb

Please sign in to comment.