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

Dlr Service Implemented #50

Merged
merged 1 commit into from
Apr 29, 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
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ require (
github.com/golobby/container/v3 v3.3.2
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/husamettinarabaci/gqltool v0.0.0-20230529191048-3a5b07a3e82e
github.com/husamettinarabaci/gqltool v1.0.2
github.com/octoposprime/op-be-shared v0.0.4
github.com/redis/go-redis/v9 v9.4.0
github.com/vektah/gqlparser/v2 v2.5.11
google.golang.org/grpc v1.61.0
Expand Down
70 changes: 70 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
github.com/99designs/gqlgen v0.17.43 h1:I4SYg6ahjowErAQcHFVKy5EcWuwJ3+Xw9z2fLpuFCPo=
github.com/99designs/gqlgen v0.17.43/go.mod h1:lO0Zjy8MkZgBdv4T1U91x09r0e0WFOdhVUutlQs1Rsc=
github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM=
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golobby/container/v3 v3.3.2 h1:7u+RgNnsdVlhGoS8gY4EXAG601vpMMzLZlYqSp77Quw=
github.com/golobby/container/v3 v3.3.2/go.mod h1:RDdKpnKpV1Of11PFBe7Dxc2C1k2KaLE4FD47FflAmj0=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/hashicorp/golang-lru/v2 v2.0.3 h1:kmRrRLlInXvng0SmLxmQpQkpbYAvcXm7NPDrgxJa9mE=
github.com/hashicorp/golang-lru/v2 v2.0.3/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/husamettinarabaci/gqltool v1.0.2 h1:osR496kHYaRNa6le8L5ZqMNUgk0gRBtfF/QNBbNf+g0=
github.com/husamettinarabaci/gqltool v1.0.2/go.mod h1:AqHO4gLh6d2hnjuXaUX+KtnI/T5KxjxqsxgFZlhc+tU=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/octoposprime/op-be-shared v0.0.4 h1:7qdRwaOGur/FNOrVR6yi0rmu3EkcejidK7bpC1tSKic=
github.com/octoposprime/op-be-shared v0.0.4/go.mod h1:QoGz43tiNTv4Bc2HR7XlfvVg9H0kDpWlrRMdCLn5up4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/redis/go-redis/v9 v9.4.0 h1:Yzoz33UZw9I/mFhx4MNrB6Fk+XHO1VukNcCa1+lwyKk=
github.com/redis/go-redis/v9 v9.4.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sosodev/duration v1.1.0 h1:kQcaiGbJaIsRqgQy7VGlZrVw1giWO+lDoX3MCPnpVO4=
github.com/sosodev/duration v1.1.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/vektah/gqlparser/v2 v2.5.11 h1:JJxLtXIoN7+3x6MBdtIP59TP1RANnY7pXOaDnADQSf8=
github.com/vektah/gqlparser/v2 v2.5.11/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 h1:FSL3lRCkhaPFxqi0s9o+V4UI2WTzAVOvkgbd4kVV4Wg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014/go.mod h1:SaPjaZGWb0lPqs6Ittu0spdfrOArqji4ZdeP5IC/9N4=
google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
29 changes: 29 additions & 0 deletions internal/application/infrastructure/port/service/dlr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package application

import (
"context"

pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr"
)

// DlrServicePort is a port for Hexagonal Architecture Pattern.
// It is used to communicate with the other servies.
type DlrServicePort interface {
// GetDlrsByFilter returns the dlrs that match the given filter.
GetDlrsByFilter(ctx context.Context, dlrFilter *pb.DlrFilter) (*pb.Dlrs, error)

// CreateDlr sends the given dlr to the service of the infrastructure layer for creatimng dlr.
CreateDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// UpdateDlrBase sends the given dlr to the service of the infrastructure layer for updating dlr base values.
UpdateDlrBase(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// UpdateDlrCore sends the given dlr to the service of the infrastructure layer for updating dlr core values.
UpdateDlrCore(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// UpdateDlrStatus sends the given dlr to the service of the infrastructure layer for updating dlr status.
UpdateDlrStatus(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// DeleteDlr sends the given dlr to the service of the infrastructure layer for deleting dlr.
DeleteDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package application
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ type ServicePort interface {
LoggingServicePort
UserServicePort
AuthenticationServicePort
DlrServicePort
}
32 changes: 32 additions & 0 deletions internal/application/presentation/adapter/command/dlr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package application

import (
"context"

pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr"
)

// CreateDlr sends the given dlr to the application layer for creating a new dlr.
func (a CommandAdapter) CreateDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.Service.CreateDlr(ctx, dlr)
}

// UpdateDlrBase sends the given dlr to the application layer for updating dlr values.
func (a CommandAdapter) UpdateDlrBase(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.Service.UpdateDlrBase(ctx, dlr)
}

// UpdateDlrCore sends the given dlr to the application layer for updating dlr values.
func (a CommandAdapter) UpdateDlrCore(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.Service.UpdateDlrCore(ctx, dlr)
}

// UpdateDlrStatus sends the given dlr to the application layer for updating dlr status.
func (a CommandAdapter) UpdateDlrStatus(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.Service.UpdateDlrStatus(ctx, dlr)
}

// DeleteDlr sends the given dlr to the application layer for deleting data.
func (a CommandAdapter) DeleteDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.Service.DeleteDlr(ctx, dlr)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package application
12 changes: 12 additions & 0 deletions internal/application/presentation/adapter/query/dlr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package application

import (
"context"

pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr"
)

// GetDlrsByFilter returns the dlrs that match the given filter.
func (a QueryAdapter) GetDlrsByFilter(ctx context.Context, dlrFilter *pb.DlrFilter) (*pb.Dlrs, error) {
return a.Service.GetDlrsByFilter(ctx, dlrFilter)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package application
1 change: 1 addition & 0 deletions internal/application/presentation/port/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ type CommandPort interface {
LoggingCommandPort
UserCommandPort
AuthenticationCommandPort
DlrCommandPort
}
26 changes: 26 additions & 0 deletions internal/application/presentation/port/command/dlr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package application

import (
"context"

pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr"
)

// DlrCommandPort is a port for Hexagonal Architecture Pattern.
// It is used to communicate with the application layer.
type DlrCommandPort interface {
// CreateDlr sends the given dlr to the application layer for creating a new dlr.
CreateDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// UpdateDlrBase sends the given dlr to the application layer for updating dlr base values.
UpdateDlrBase(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// UpdateDlrCore sends the given dlr to the application layer for updating dlr core values.
UpdateDlrCore(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// UpdateDlrStatus sends the given dlr to the application layer for updating dlr status.
UpdateDlrStatus(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)

// DeleteDlr sends the given dlr to the application layer for deleting data.
DeleteDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error)
}
1 change: 1 addition & 0 deletions internal/application/presentation/port/command/dlr_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package application
14 changes: 14 additions & 0 deletions internal/application/presentation/port/query/dlr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package application

import (
"context"

pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr"
)

// QueryPort is a port for Hexagonal Architecture Pattern.
// It is used to communicate with the application layer.
type DlrQueryPort interface {
// GetDlrsByFilter returns the dlrs that match the given filter.
GetDlrsByFilter(ctx context.Context, dlrFilter *pb.DlrFilter) (*pb.Dlrs, error)
}
1 change: 1 addition & 0 deletions internal/application/presentation/port/query/dlr_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package application
1 change: 1 addition & 0 deletions internal/application/presentation/port/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ package application
type QueryPort interface {
ErrorQueryPort
UserQueryPort
DlrQueryPort
}
38 changes: 38 additions & 0 deletions internal/application/service/dlr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package application

import (
"context"

pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr"
)

// GetDlrsByFilter returns the dlrs that match the given filter.
func (a *Service) GetDlrsByFilter(ctx context.Context, dlrFilter *pb.DlrFilter) (*pb.Dlrs, error) {
return a.ServicePort.GetDlrsByFilter(ctx, dlrFilter)
}

// CreateDlr sends the given dlr to the service of the infrastructure layer for creating a new dlr.
func (a *Service) CreateDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.ServicePort.CreateDlr(ctx, dlr)
}

// UpdateDlrBase sends the given dlr to the service of the infrastructure layer for updating dlr base values.
func (a *Service) UpdateDlrBase(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.ServicePort.UpdateDlrBase(ctx, dlr)
}

// UpdateDlrCore sends the given dlr to the service of the infrastructure layer for updating dlr core values.
func (a *Service) UpdateDlrCore(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.ServicePort.UpdateDlrCore(ctx, dlr)
}


// UpdateDlrStatus sends the given dlr to the service of the infrastructure layer for updating dlr status.
func (a *Service) UpdateDlrStatus(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.ServicePort.UpdateDlrStatus(ctx, dlr)
}

// DeleteDlr sends the given dlr to the service of the infrastructure layer for deleting data.
func (a *Service) DeleteDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) {
return a.ServicePort.DeleteDlr(ctx, dlr)
}
1 change: 1 addition & 0 deletions internal/application/service/dlr_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package application
Loading