diff --git a/go.mod b/go.mod index acc34fd..c5fa70a 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index e69de29..062bc6e 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/application/infrastructure/port/service/dlr.go b/internal/application/infrastructure/port/service/dlr.go new file mode 100644 index 0000000..6d56c7f --- /dev/null +++ b/internal/application/infrastructure/port/service/dlr.go @@ -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) +} diff --git a/internal/application/infrastructure/port/service/dlr_test.go b/internal/application/infrastructure/port/service/dlr_test.go new file mode 100644 index 0000000..b584a8a --- /dev/null +++ b/internal/application/infrastructure/port/service/dlr_test.go @@ -0,0 +1 @@ +package application diff --git a/internal/application/infrastructure/port/service/service.go b/internal/application/infrastructure/port/service/service.go index da17823..92f8e9e 100644 --- a/internal/application/infrastructure/port/service/service.go +++ b/internal/application/infrastructure/port/service/service.go @@ -7,4 +7,5 @@ type ServicePort interface { LoggingServicePort UserServicePort AuthenticationServicePort + DlrServicePort } diff --git a/internal/application/presentation/adapter/command/dlr.go b/internal/application/presentation/adapter/command/dlr.go new file mode 100644 index 0000000..76cfae8 --- /dev/null +++ b/internal/application/presentation/adapter/command/dlr.go @@ -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) +} diff --git a/internal/application/presentation/adapter/command/dlr_test.go b/internal/application/presentation/adapter/command/dlr_test.go new file mode 100644 index 0000000..b584a8a --- /dev/null +++ b/internal/application/presentation/adapter/command/dlr_test.go @@ -0,0 +1 @@ +package application diff --git a/internal/application/presentation/adapter/query/dlr.go b/internal/application/presentation/adapter/query/dlr.go new file mode 100644 index 0000000..1345454 --- /dev/null +++ b/internal/application/presentation/adapter/query/dlr.go @@ -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) +} diff --git a/internal/application/presentation/adapter/query/dlr_test.go b/internal/application/presentation/adapter/query/dlr_test.go new file mode 100644 index 0000000..b584a8a --- /dev/null +++ b/internal/application/presentation/adapter/query/dlr_test.go @@ -0,0 +1 @@ +package application diff --git a/internal/application/presentation/port/command/command.go b/internal/application/presentation/port/command/command.go index a520950..e3c9ce1 100644 --- a/internal/application/presentation/port/command/command.go +++ b/internal/application/presentation/port/command/command.go @@ -6,4 +6,5 @@ type CommandPort interface { LoggingCommandPort UserCommandPort AuthenticationCommandPort + DlrCommandPort } diff --git a/internal/application/presentation/port/command/dlr.go b/internal/application/presentation/port/command/dlr.go new file mode 100644 index 0000000..9eeb086 --- /dev/null +++ b/internal/application/presentation/port/command/dlr.go @@ -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) +} diff --git a/internal/application/presentation/port/command/dlr_test.go b/internal/application/presentation/port/command/dlr_test.go new file mode 100644 index 0000000..b584a8a --- /dev/null +++ b/internal/application/presentation/port/command/dlr_test.go @@ -0,0 +1 @@ +package application diff --git a/internal/application/presentation/port/query/dlr.go b/internal/application/presentation/port/query/dlr.go new file mode 100644 index 0000000..2ec543f --- /dev/null +++ b/internal/application/presentation/port/query/dlr.go @@ -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) +} diff --git a/internal/application/presentation/port/query/dlr_test.go b/internal/application/presentation/port/query/dlr_test.go new file mode 100644 index 0000000..b584a8a --- /dev/null +++ b/internal/application/presentation/port/query/dlr_test.go @@ -0,0 +1 @@ +package application diff --git a/internal/application/presentation/port/query/query.go b/internal/application/presentation/port/query/query.go index 8fb8ed2..f801aa1 100644 --- a/internal/application/presentation/port/query/query.go +++ b/internal/application/presentation/port/query/query.go @@ -5,4 +5,5 @@ package application type QueryPort interface { ErrorQueryPort UserQueryPort + DlrQueryPort } diff --git a/internal/application/service/dlr.go b/internal/application/service/dlr.go new file mode 100644 index 0000000..7d8f7d2 --- /dev/null +++ b/internal/application/service/dlr.go @@ -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) +} \ No newline at end of file diff --git a/internal/application/service/dlr_test.go b/internal/application/service/dlr_test.go new file mode 100644 index 0000000..b584a8a --- /dev/null +++ b/internal/application/service/dlr_test.go @@ -0,0 +1 @@ +package application diff --git a/pkg/infrastructure/adapter/service/dlr.go b/pkg/infrastructure/adapter/service/dlr.go new file mode 100644 index 0000000..4c4d20b --- /dev/null +++ b/pkg/infrastructure/adapter/service/dlr.go @@ -0,0 +1,134 @@ +package infrastructure + +import ( + "context" + + me "github.com/octoposprime/op-be-graphql/internal/domain/model/entity" + smodel "github.com/octoposprime/op-be-shared/pkg/model" + pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr" + pb_logging "github.com/octoposprime/op-be-shared/pkg/proto/pb/logging" + tconfig "github.com/octoposprime/op-be-shared/tool/config" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" +) + +// GetDlrsByFilter returns the dlrs that match the given filter. +func (a ServiceAdapter) GetDlrsByFilter(ctx context.Context, dlrFilter *pb.DlrFilter) (*pb.Dlrs, error) { + conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.DlrHost+":"+tconfig.GetInternalConfigInstance().Grpc.DlrPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "GetDlrsByFilter", userId, err.Error())) + return &pb.Dlrs{}, err + } + + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + ctx = metadata.AppendToOutgoingContext(ctx, string(smodel.QueryKeyUid), userId) + pbResults, err := pb.NewDlrSvcClient(conn).GetDlrsByFilter(ctx, dlrFilter) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "GetDlrsByFilter", userId, err.Error())) + return &pb.Dlrs{}, err + } + return pbResults, nil +} + +// CreateDlr insert a new dlr in the databse. +func (a ServiceAdapter) CreateDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) { + conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.DlrHost+":"+tconfig.GetInternalConfigInstance().Grpc.DlrPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "CreateDlr", userId, err.Error())) + return &pb.Dlr{}, err + } + + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + ctx = metadata.AppendToOutgoingContext(ctx, string(smodel.QueryKeyUid), userId) + pbResult, err := pb.NewDlrSvcClient(conn).CreateDlr(ctx, dlr) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "CreateDlr", userId, err.Error())) + return &pb.Dlr{}, err + } + return pbResult, nil +} + +// UpdateDlrBase sends the given dlr to the application layer for updating dlr base values. +func (a ServiceAdapter) UpdateDlrBase(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) { + conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.DlrHost+":"+tconfig.GetInternalConfigInstance().Grpc.DlrPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "UpdateDlrStatus", userId, err.Error())) + return &pb.Dlr{}, err + } + + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + ctx = metadata.AppendToOutgoingContext(ctx, string(smodel.QueryKeyUid), userId) + pbResult, err := pb.NewDlrSvcClient(conn).UpdateDlrBase(ctx, dlr) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "UpdateDlrStatus", userId, err.Error())) + return &pb.Dlr{}, err + } + return pbResult, nil +} + +// UpdateDlrCore sends the given dlr to the application layer for updating dlr core values. +func (a ServiceAdapter) UpdateDlrCore(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) { + conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.DlrHost+":"+tconfig.GetInternalConfigInstance().Grpc.DlrPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "UpdateDlrStatus", userId, err.Error())) + return &pb.Dlr{}, err + } + + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + ctx = metadata.AppendToOutgoingContext(ctx, string(smodel.QueryKeyUid), userId) + pbResult, err := pb.NewDlrSvcClient(conn).UpdateDlrCore(ctx, dlr) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "UpdateDlrStatus", userId, err.Error())) + return &pb.Dlr{}, err + } + return pbResult, nil +} + +// UpdateDlrStatus sends the given dlr to the application layer for updating dlr status. +func (a ServiceAdapter) UpdateDlrStatus(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) { + conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.DlrHost+":"+tconfig.GetInternalConfigInstance().Grpc.DlrPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "UpdateDlrStatus", userId, err.Error())) + return &pb.Dlr{}, err + } + + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + ctx = metadata.AppendToOutgoingContext(ctx, string(smodel.QueryKeyUid), userId) + pbResult, err := pb.NewDlrSvcClient(conn).UpdateDlrStatus(ctx, dlr) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "UpdateDlrStatus", userId, err.Error())) + return &pb.Dlr{}, err + } + return pbResult, nil +} + +// DeleteDlr soft-deletes the given dlr in the database. +func (a ServiceAdapter) DeleteDlr(ctx context.Context, dlr *pb.Dlr) (*pb.Dlr, error) { + conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.DlrHost+":"+tconfig.GetInternalConfigInstance().Grpc.DlrPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "DeleteDlr", userId, err.Error())) + return &pb.Dlr{}, err + } + + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + ctx = metadata.AppendToOutgoingContext(ctx, string(smodel.QueryKeyUid), userId) + pbResult, err := pb.NewDlrSvcClient(conn).DeleteDlr(ctx, dlr) + if err != nil { + userId, _ := ctx.Value(smodel.QueryKeyUid).(string) + go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "DeleteDlr", userId, err.Error())) + return &pb.Dlr{}, err + } + return pbResult, nil +} diff --git a/pkg/infrastructure/adapter/service/dlr_test.go b/pkg/infrastructure/adapter/service/dlr_test.go new file mode 100644 index 0000000..ebb143f --- /dev/null +++ b/pkg/infrastructure/adapter/service/dlr_test.go @@ -0,0 +1 @@ +package infrastructure diff --git a/pkg/presentation/controller/graphql/resolver/authentication.resolvers.go b/pkg/presentation/controller/graphql/resolver/authentication.resolvers.go index 25c577c..b98bacc 100644 --- a/pkg/presentation/controller/graphql/resolver/authentication.resolvers.go +++ b/pkg/presentation/controller/graphql/resolver/authentication.resolvers.go @@ -2,7 +2,7 @@ package presentation // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.43 +// Code generated by github.com/99designs/gqlgen version v0.17.44 import ( "context" diff --git a/pkg/presentation/controller/graphql/resolver/authorization.resolvers.go b/pkg/presentation/controller/graphql/resolver/authorization.resolvers.go index 4ec4474..506eaec 100644 --- a/pkg/presentation/controller/graphql/resolver/authorization.resolvers.go +++ b/pkg/presentation/controller/graphql/resolver/authorization.resolvers.go @@ -2,7 +2,7 @@ package presentation // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.43 +// Code generated by github.com/99designs/gqlgen version v0.17.44 import ( "context" diff --git a/pkg/presentation/controller/graphql/resolver/dlr.resolvers.go b/pkg/presentation/controller/graphql/resolver/dlr.resolvers.go new file mode 100644 index 0000000..13e125a --- /dev/null +++ b/pkg/presentation/controller/graphql/resolver/dlr.resolvers.go @@ -0,0 +1,149 @@ +package presentation + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.44 + +import ( + "context" + + mo "github.com/octoposprime/op-be-graphql/internal/domain/model/object" + presentation "github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model" + smodel "github.com/octoposprime/op-be-shared/pkg/model" + pb_dlr "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr" + pb_user "github.com/octoposprime/op-be-shared/pkg/proto/pb/user" + +) + +// CreateDlr is the resolver for the createDlr field. +func (r *mutationResolver) CreateDlr(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + user.ID = &userId + } + dtoData := presentation.NewDlrDto(&dlr) + resultData, err := r.CommandHandler.CreateDlr(ctx, dtoData.ToPb()) + if err != nil { + return nil, err + } + dtoData.PbData = resultData + return dtoData.ToModel(), nil +} + +// UpdateDlrBase is the resolver for the updateDlrBase field. +func (r *mutationResolver) UpdateDlrBase(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + user.ID = &userId + } + dtoData := presentation.NewDlrDto(&dlr) + resultData, err := r.CommandHandler.UpdateDlrBase(ctx, dtoData.ToPb()) + if err != nil { + return nil, err + } + dtoData.PbData = resultData + return dtoData.ToModel(), nil +} + +// UpdateDlrCore is the resolver for the updateDlrCore field. +func (r *mutationResolver) UpdateDlrCore(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + user.ID = &userId + } + dtoData := presentation.NewDlrDto(&dlr) + resultData, err := r.CommandHandler.UpdateDlrCore(ctx, dtoData.ToPb()) + if err != nil { + return nil, err + } + dtoData.PbData = resultData + return dtoData.ToModel(), nil +} + +// UpdateDlrStatus is the resolver for the updateDlrStatus field. +func (r *mutationResolver) UpdateDlrStatus(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + user.ID = &userId + } + dtoData := presentation.NewDlrDto(&dlr) + resultData, err := r.CommandHandler.UpdateDlrStatus(ctx, dtoData.ToPb()) + if err != nil { + return nil, err + } + dtoData.PbData = resultData + return dtoData.ToModel(), nil +} + +// DeleteDlr is the resolver for the deleteDlr field. +func (r *mutationResolver) DeleteDlr(ctx context.Context, id string) (*presentation.Dlr, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + id = userId + } + inData := new(presentation.DlrInput) + inData.ID = &id + dtoData := presentation.NewDlrDto(inData) + resultData, err := r.CommandHandler.DeleteDlr(ctx, dtoData.ToPb()) + if err != nil { + return nil, err + } + dtoData.PbData = resultData + return dtoData.ToModel(), nil +} + +// Dlr is the resolver for the dlr field. +func (r *queryResolver) Dlr(ctx context.Context, id string) (*presentation.Dlr, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + id = userId + } + var filter presentation.DlrFilterInput + filter.ID = &id + dtoFilter := presentation.NewDlrFilterDto(&filter) + dtoData := presentation.NewDlrDto(new(presentation.DlrInput)) + resultDatas, err := r.QueryHandler.GetDlrsByFilter(ctx, dtoFilter.ToPb()) + if err != nil { + return nil, err + } + if len(resultDatas.Dlrs) > 0 { + dtoData.PbData = resultDatas.Dlrs[0] + return dtoData.ToModel(), nil + } else { + return nil, mo.ErrorDlrNotFound + } +} + +// Dlrs is the resolver for the dlrs field. +func (r *queryResolver) Dlrs(ctx context.Context, filter *presentation.DlrFilterInput) (*presentation.Dlrs, error) { + userId := ctx.Value(smodel.QueryKeyUid).(string) + userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType) + if userType != pb_user.UserType_UserTypeADMIN { + filter.ID = &userId + } + var results presentation.Dlrs + if filter == nil { + filter = &presentation.DlrFilterInput{} + } + dtoFilter := presentation.NewDlrFilterDto(filter) + + resultDatas, err := r.QueryHandler.GetDlrsByFilter(ctx, dtoFilter.ToPb()) + if err != nil { + return nil, err + } + + for _, resultData := range resultDatas.Dlrs { + dtoData := presentation.NewDlrDto(new(presentation.DlrInput)) + dtoData.PbData = resultData + results.Dlrs = append(results.Dlrs, dtoData.ToModel()) + } + results.Total = int32(resultDatas.TotalRows) + + return &results, nil +} diff --git a/pkg/presentation/controller/graphql/resolver/error.resolvers.go b/pkg/presentation/controller/graphql/resolver/error.resolvers.go index 175c637..25d72be 100644 --- a/pkg/presentation/controller/graphql/resolver/error.resolvers.go +++ b/pkg/presentation/controller/graphql/resolver/error.resolvers.go @@ -2,7 +2,7 @@ package presentation // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.43 +// Code generated by github.com/99designs/gqlgen version v0.17.44 import ( "context" diff --git a/pkg/presentation/controller/graphql/resolver/schema.resolvers.go b/pkg/presentation/controller/graphql/resolver/schema.resolvers.go index 0062970..3ff5b82 100644 --- a/pkg/presentation/controller/graphql/resolver/schema.resolvers.go +++ b/pkg/presentation/controller/graphql/resolver/schema.resolvers.go @@ -2,7 +2,7 @@ package presentation // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.43 +// Code generated by github.com/99designs/gqlgen version v0.17.44 import ( "context" diff --git a/pkg/presentation/controller/graphql/resolver/user.resolvers.go b/pkg/presentation/controller/graphql/resolver/user.resolvers.go index e21248e..3fda595 100644 --- a/pkg/presentation/controller/graphql/resolver/user.resolvers.go +++ b/pkg/presentation/controller/graphql/resolver/user.resolvers.go @@ -2,7 +2,7 @@ package presentation // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.43 +// Code generated by github.com/99designs/gqlgen version v0.17.44 import ( "context" diff --git a/pkg/presentation/dto/generated.go b/pkg/presentation/dto/generated.go index 17f920e..f517fa5 100644 --- a/pkg/presentation/dto/generated.go +++ b/pkg/presentation/dto/generated.go @@ -17,6 +17,7 @@ import ( "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" "github.com/husamettinarabaci/gqltool/timestamp" + "github.com/husamettinarabaci/gqltool/uuid" presentation "github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" @@ -57,6 +58,29 @@ type ComplexityRoot struct { Auth func(childComplexity int) int } + Dlr struct { + CreatedAt func(childComplexity int) int + DlrBase func(childComplexity int) int + DlrCore func(childComplexity int) int + DlrStatus func(childComplexity int) int + DlrType func(childComplexity int) int + ID func(childComplexity int) int + UpdatedAt func(childComplexity int) int + } + + DlrBase struct { + Tags func(childComplexity int) int + } + + DlrCore struct { + DlrData func(childComplexity int) int + } + + Dlrs struct { + Dlrs func(childComplexity int) int + Total func(childComplexity int) int + } + Error struct { Error func(childComplexity int) int } @@ -70,11 +94,16 @@ type ComplexityRoot struct { Mutation struct { Auth func(childComplexity int) int ChangeUserPassword func(childComplexity int, userPassword presentation.UserPasswordInput) int + CreateDlr func(childComplexity int, dlr presentation.DlrInput) int CreateUser func(childComplexity int, user presentation.UserInput) int + DeleteDlr func(childComplexity int, id string) int DeleteUser func(childComplexity int, id string) int Login func(childComplexity int, loginRequest presentation.LoginRequestInput) int Logout func(childComplexity int, token presentation.TokenInput) int Refresh func(childComplexity int, token presentation.TokenInput) int + UpdateDlrBase func(childComplexity int, dlr presentation.DlrInput) int + UpdateDlrCore func(childComplexity int, dlr presentation.DlrInput) int + UpdateDlrStatus func(childComplexity int, dlr presentation.DlrInput) int UpdateUserBase func(childComplexity int, user presentation.UserInput) int UpdateUserRole func(childComplexity int, user presentation.UserInput) int UpdateUserStatus func(childComplexity int, user presentation.UserInput) int @@ -91,6 +120,8 @@ type ComplexityRoot struct { Query struct { Auth func(childComplexity int) int + Dlr func(childComplexity int, id string) int + Dlrs func(childComplexity int, filter *presentation.DlrFilterInput) int Errors func(childComplexity int) int Roles func(childComplexity int, filter *presentation.RoleFilterInput) int User func(childComplexity int, id string) int @@ -150,6 +181,11 @@ type MutationResolver interface { Login(ctx context.Context, loginRequest presentation.LoginRequestInput) (*presentation.Token, error) Refresh(ctx context.Context, token presentation.TokenInput) (*presentation.Token, error) Logout(ctx context.Context, token presentation.TokenInput) (*bool, error) + CreateDlr(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) + UpdateDlrBase(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) + UpdateDlrCore(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) + UpdateDlrStatus(ctx context.Context, dlr presentation.DlrInput) (*presentation.Dlr, error) + DeleteDlr(ctx context.Context, id string) (*presentation.Dlr, error) CreateUser(ctx context.Context, user presentation.UserInput) (*presentation.User, error) UpdateUserRole(ctx context.Context, user presentation.UserInput) (*presentation.User, error) UpdateUserBase(ctx context.Context, user presentation.UserInput) (*presentation.User, error) @@ -160,6 +196,8 @@ type MutationResolver interface { type QueryResolver interface { Auth(ctx context.Context) (*presentation.AuthOps, error) Roles(ctx context.Context, filter *presentation.RoleFilterInput) ([]*presentation.Role, error) + Dlr(ctx context.Context, id string) (*presentation.Dlr, error) + Dlrs(ctx context.Context, filter *presentation.DlrFilterInput) (*presentation.Dlrs, error) Errors(ctx context.Context) ([]*presentation.Error, error) User(ctx context.Context, id string) (*presentation.User, error) Users(ctx context.Context, filter *presentation.UserFilterInput) (*presentation.Users, error) @@ -194,6 +232,83 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AuthOps.Auth(childComplexity), true + case "Dlr.CreatedAt": + if e.complexity.Dlr.CreatedAt == nil { + break + } + + return e.complexity.Dlr.CreatedAt(childComplexity), true + + case "Dlr.DlrBase": + if e.complexity.Dlr.DlrBase == nil { + break + } + + return e.complexity.Dlr.DlrBase(childComplexity), true + + case "Dlr.DlrCore": + if e.complexity.Dlr.DlrCore == nil { + break + } + + return e.complexity.Dlr.DlrCore(childComplexity), true + + case "Dlr.DlrStatus": + if e.complexity.Dlr.DlrStatus == nil { + break + } + + return e.complexity.Dlr.DlrStatus(childComplexity), true + + case "Dlr.DlrType": + if e.complexity.Dlr.DlrType == nil { + break + } + + return e.complexity.Dlr.DlrType(childComplexity), true + + case "Dlr.Id": + if e.complexity.Dlr.ID == nil { + break + } + + return e.complexity.Dlr.ID(childComplexity), true + + case "Dlr.UpdatedAt": + if e.complexity.Dlr.UpdatedAt == nil { + break + } + + return e.complexity.Dlr.UpdatedAt(childComplexity), true + + case "DlrBase.Tags": + if e.complexity.DlrBase.Tags == nil { + break + } + + return e.complexity.DlrBase.Tags(childComplexity), true + + case "DlrCore.DlrData": + if e.complexity.DlrCore.DlrData == nil { + break + } + + return e.complexity.DlrCore.DlrData(childComplexity), true + + case "Dlrs.Dlrs": + if e.complexity.Dlrs.Dlrs == nil { + break + } + + return e.complexity.Dlrs.Dlrs(childComplexity), true + + case "Dlrs.Total": + if e.complexity.Dlrs.Total == nil { + break + } + + return e.complexity.Dlrs.Total(childComplexity), true + case "Error.Error": if e.complexity.Error.Error == nil { break @@ -241,6 +356,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.ChangeUserPassword(childComplexity, args["userPassword"].(presentation.UserPasswordInput)), true + case "Mutation.createDlr": + if e.complexity.Mutation.CreateDlr == nil { + break + } + + args, err := ec.field_Mutation_createDlr_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateDlr(childComplexity, args["dlr"].(presentation.DlrInput)), true + case "Mutation.createUser": if e.complexity.Mutation.CreateUser == nil { break @@ -253,6 +380,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.CreateUser(childComplexity, args["user"].(presentation.UserInput)), true + case "Mutation.deleteDlr": + if e.complexity.Mutation.DeleteDlr == nil { + break + } + + args, err := ec.field_Mutation_deleteDlr_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteDlr(childComplexity, args["Id"].(string)), true + case "Mutation.deleteUser": if e.complexity.Mutation.DeleteUser == nil { break @@ -301,6 +440,42 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.Refresh(childComplexity, args["token"].(presentation.TokenInput)), true + case "Mutation.updateDlrBase": + if e.complexity.Mutation.UpdateDlrBase == nil { + break + } + + args, err := ec.field_Mutation_updateDlrBase_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateDlrBase(childComplexity, args["dlr"].(presentation.DlrInput)), true + + case "Mutation.updateDlrCore": + if e.complexity.Mutation.UpdateDlrCore == nil { + break + } + + args, err := ec.field_Mutation_updateDlrCore_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateDlrCore(childComplexity, args["dlr"].(presentation.DlrInput)), true + + case "Mutation.updateDlrStatus": + if e.complexity.Mutation.UpdateDlrStatus == nil { + break + } + + args, err := ec.field_Mutation_updateDlrStatus_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateDlrStatus(childComplexity, args["dlr"].(presentation.DlrInput)), true + case "Mutation.updateUserBase": if e.complexity.Mutation.UpdateUserBase == nil { break @@ -365,6 +540,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Auth(childComplexity), true + case "Query.dlr": + if e.complexity.Query.Dlr == nil { + break + } + + args, err := ec.field_Query_dlr_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Dlr(childComplexity, args["Id"].(string)), true + + case "Query.dlrs": + if e.complexity.Query.Dlrs == nil { + break + } + + args, err := ec.field_Query_dlrs_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Dlrs(childComplexity, args["filter"].(*presentation.DlrFilterInput)), true + case "Query.errors": if e.complexity.Query.Errors == nil { break @@ -577,6 +776,10 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputDlrBaseInput, + ec.unmarshalInputDlrCoreInput, + ec.unmarshalInputDlrFilterInput, + ec.unmarshalInputDlrInput, ec.unmarshalInputLoginRequestInput, ec.unmarshalInputPageInput, ec.unmarshalInputRoleFilterInput, @@ -698,7 +901,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil } -//go:embed "schema/authentication.graphql" "schema/authorization.graphql" "schema/error.graphql" "schema/pagination.graphql" "schema/schema.graphql" "schema/user.graphql" +//go:embed "schema/authentication.graphql" "schema/authorization.graphql" "schema/dlr.graphql" "schema/error.graphql" "schema/pagination.graphql" "schema/schema.graphql" "schema/user.graphql" var sourcesFS embed.FS func sourceData(filename string) string { @@ -712,6 +915,7 @@ func sourceData(filename string) string { var sources = []*ast.Source{ {Name: "schema/authentication.graphql", Input: sourceData("schema/authentication.graphql"), BuiltIn: false}, {Name: "schema/authorization.graphql", Input: sourceData("schema/authorization.graphql"), BuiltIn: false}, + {Name: "schema/dlr.graphql", Input: sourceData("schema/dlr.graphql"), BuiltIn: false}, {Name: "schema/error.graphql", Input: sourceData("schema/error.graphql"), BuiltIn: false}, {Name: "schema/pagination.graphql", Input: sourceData("schema/pagination.graphql"), BuiltIn: false}, {Name: "schema/schema.graphql", Input: sourceData("schema/schema.graphql"), BuiltIn: false}, @@ -753,6 +957,21 @@ func (ec *executionContext) field_Mutation_changeUserPassword_args(ctx context.C return args, nil } +func (ec *executionContext) field_Mutation_createDlr_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 presentation.DlrInput + if tmp, ok := rawArgs["dlr"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dlr")) + arg0, err = ec.unmarshalNDlrInput2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["dlr"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_createUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -768,6 +987,21 @@ func (ec *executionContext) field_Mutation_createUser_args(ctx context.Context, return args, nil } +func (ec *executionContext) field_Mutation_deleteDlr_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["Id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["Id"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_deleteUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -828,6 +1062,51 @@ func (ec *executionContext) field_Mutation_refresh_args(ctx context.Context, raw return args, nil } +func (ec *executionContext) field_Mutation_updateDlrBase_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 presentation.DlrInput + if tmp, ok := rawArgs["dlr"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dlr")) + arg0, err = ec.unmarshalNDlrInput2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["dlr"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateDlrCore_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 presentation.DlrInput + if tmp, ok := rawArgs["dlr"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dlr")) + arg0, err = ec.unmarshalNDlrInput2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["dlr"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateDlrStatus_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 presentation.DlrInput + if tmp, ok := rawArgs["dlr"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dlr")) + arg0, err = ec.unmarshalNDlrInput2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["dlr"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_updateUserBase_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -888,6 +1167,36 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_dlr_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["Id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["Id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_dlrs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *presentation.DlrFilterInput + if tmp, ok := rawArgs["filter"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + arg0, err = ec.unmarshalODlrFilterInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrFilterInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["filter"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query_roles_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -1015,8 +1324,8 @@ func (ec *executionContext) fieldContext_AuthOps_Auth(ctx context.Context, field return fc, nil } -func (ec *executionContext) _Error_Error(ctx context.Context, field graphql.CollectedField, obj *presentation.Error) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Error_Error(ctx, field) +func (ec *executionContext) _Dlr_Id(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_Id(ctx, field) if err != nil { return graphql.Null } @@ -1029,7 +1338,7 @@ func (ec *executionContext) _Error_Error(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Error, nil + return obj.ID, nil }) if err != nil { ec.Error(ctx, err) @@ -1043,24 +1352,24 @@ func (ec *executionContext) _Error_Error(ctx context.Context, field graphql.Coll } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Error_Error(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Dlr_Id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Error", + Object: "Dlr", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoginRequest_UserName(ctx context.Context, field graphql.CollectedField, obj *presentation.LoginRequest) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoginRequest_UserName(ctx, field) +func (ec *executionContext) _Dlr_DlrType(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_DlrType(ctx, field) if err != nil { return graphql.Null } @@ -1073,7 +1382,7 @@ func (ec *executionContext) _LoginRequest_UserName(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.UserName, nil + return obj.DlrType, nil }) if err != nil { ec.Error(ctx, err) @@ -1085,26 +1394,26 @@ func (ec *executionContext) _LoginRequest_UserName(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(string) + res := resTmp.(presentation.DlrType) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNDlrType2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoginRequest_UserName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Dlr_DlrType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LoginRequest", + Object: "Dlr", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type DlrType does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoginRequest_Email(ctx context.Context, field graphql.CollectedField, obj *presentation.LoginRequest) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoginRequest_Email(ctx, field) +func (ec *executionContext) _Dlr_DlrStatus(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_DlrStatus(ctx, field) if err != nil { return graphql.Null } @@ -1117,7 +1426,7 @@ func (ec *executionContext) _LoginRequest_Email(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Email, nil + return obj.DlrStatus, nil }) if err != nil { ec.Error(ctx, err) @@ -1129,26 +1438,26 @@ func (ec *executionContext) _LoginRequest_Email(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(string) + res := resTmp.(presentation.DlrStatus) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNDlrStatus2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoginRequest_Email(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Dlr_DlrStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LoginRequest", + Object: "Dlr", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type DlrStatus does not have child fields") }, } return fc, nil } -func (ec *executionContext) _LoginRequest_Password(ctx context.Context, field graphql.CollectedField, obj *presentation.LoginRequest) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_LoginRequest_Password(ctx, field) +func (ec *executionContext) _Dlr_DlrBase(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_DlrBase(ctx, field) if err != nil { return graphql.Null } @@ -1161,7 +1470,7 @@ func (ec *executionContext) _LoginRequest_Password(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Password, nil + return obj.DlrBase, nil }) if err != nil { ec.Error(ctx, err) @@ -1173,26 +1482,30 @@ func (ec *executionContext) _LoginRequest_Password(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*presentation.DlrBase) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNDlrBase2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrBase(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_LoginRequest_Password(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Dlr_DlrBase(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "LoginRequest", + Object: "Dlr", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "Tags": + return ec.fieldContext_DlrBase_Tags(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DlrBase", field.Name) }, } return fc, nil } -func (ec *executionContext) _Mutation_auth(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_auth(ctx, field) +func (ec *executionContext) _Dlr_DlrCore(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_DlrCore(ctx, field) if err != nil { return graphql.Null } @@ -1205,7 +1518,7 @@ func (ec *executionContext) _Mutation_auth(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Auth(rctx) + return obj.DlrCore, nil }) if err != nil { ec.Error(ctx, err) @@ -1217,30 +1530,30 @@ func (ec *executionContext) _Mutation_auth(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(*presentation.AuthOps) + res := resTmp.(*presentation.DlrCore) fc.Result = res - return ec.marshalNAuthOps2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐAuthOps(ctx, field.Selections, res) + return ec.marshalNDlrCore2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrCore(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_auth(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Dlr_DlrCore(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "Dlr", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "Auth": - return ec.fieldContext_AuthOps_Auth(ctx, field) + case "DlrData": + return ec.fieldContext_DlrCore_DlrData(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type AuthOps", field.Name) + return nil, fmt.Errorf("no field named %q was found under type DlrCore", field.Name) }, } return fc, nil } -func (ec *executionContext) _Mutation_login(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_login(ctx, field) +func (ec *executionContext) _Dlr_CreatedAt(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_CreatedAt(ctx, field) if err != nil { return graphql.Null } @@ -1253,7 +1566,7 @@ func (ec *executionContext) _Mutation_login(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Login(rctx, fc.Args["loginRequest"].(presentation.LoginRequestInput)) + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -1265,24 +1578,589 @@ func (ec *executionContext) _Mutation_login(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(*presentation.Token) + res := resTmp.(time.Time) fc.Result = res - return ec.marshalNToken2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐToken(ctx, field.Selections, res) + return ec.marshalNTimestamp2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_login(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Dlr_CreatedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "Dlr", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "AuthenticationToken": - return ec.fieldContext_Token_AuthenticationToken(ctx, field) - case "RefreshToken": - return ec.fieldContext_Token_RefreshToken(ctx, field) - } + return nil, errors.New("field of type Timestamp does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Dlr_UpdatedAt(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlr) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlr_UpdatedAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNTimestamp2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Dlr_UpdatedAt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Dlr", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Timestamp does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DlrBase_Tags(ctx context.Context, field graphql.CollectedField, obj *presentation.DlrBase) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DlrBase_Tags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Tags, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DlrBase_Tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DlrBase", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DlrCore_DlrData(ctx context.Context, field graphql.CollectedField, obj *presentation.DlrCore) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DlrCore_DlrData(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DlrData, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DlrCore_DlrData(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DlrCore", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Dlrs_Total(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlrs) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlrs_Total(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Total, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int32) + fc.Result = res + return ec.marshalNInt2int32(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Dlrs_Total(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Dlrs", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Dlrs_Dlrs(ctx context.Context, field graphql.CollectedField, obj *presentation.Dlrs) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Dlrs_Dlrs(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Dlrs, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*presentation.Dlr) + fc.Result = res + return ec.marshalNDlr2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Dlrs_Dlrs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Dlrs", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Error_Error(ctx context.Context, field graphql.CollectedField, obj *presentation.Error) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Error_Error(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Error, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Error_Error(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Error", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _LoginRequest_UserName(ctx context.Context, field graphql.CollectedField, obj *presentation.LoginRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoginRequest_UserName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoginRequest_UserName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoginRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _LoginRequest_Email(ctx context.Context, field graphql.CollectedField, obj *presentation.LoginRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoginRequest_Email(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Email, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoginRequest_Email(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoginRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _LoginRequest_Password(ctx context.Context, field graphql.CollectedField, obj *presentation.LoginRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_LoginRequest_Password(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Password, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_LoginRequest_Password(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "LoginRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_auth(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_auth(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().Auth(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.AuthOps) + fc.Result = res + return ec.marshalNAuthOps2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐAuthOps(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_auth(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Auth": + return ec.fieldContext_AuthOps_Auth(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AuthOps", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_login(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_login(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().Login(rctx, fc.Args["loginRequest"].(presentation.LoginRequestInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.Token) + fc.Result = res + return ec.marshalNToken2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐToken(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_login(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "AuthenticationToken": + return ec.fieldContext_Token_AuthenticationToken(ctx, field) + case "RefreshToken": + return ec.fieldContext_Token_RefreshToken(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Token", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_login_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_refresh(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_refresh(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().Refresh(rctx, fc.Args["token"].(presentation.TokenInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.Token) + fc.Result = res + return ec.marshalNToken2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐToken(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_refresh(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "AuthenticationToken": + return ec.fieldContext_Token_AuthenticationToken(ctx, field) + case "RefreshToken": + return ec.fieldContext_Token_RefreshToken(ctx, field) + } return nil, fmt.Errorf("no field named %q was found under type Token", field.Name) }, } @@ -1293,15 +2171,352 @@ func (ec *executionContext) fieldContext_Mutation_login(ctx context.Context, fie } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_login_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_refresh_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_logout(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_logout(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().Logout(rctx, fc.Args["token"].(presentation.TokenInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_logout(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_logout_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createDlr(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDlr(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateDlr(rctx, fc.Args["dlr"].(presentation.DlrInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "dlr.create") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*presentation.Dlr); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlr`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.Dlr) + fc.Result = res + return ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createDlr(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createDlr_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateDlrBase(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDlrBase(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDlrBase(rctx, fc.Args["dlr"].(presentation.DlrInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "dlr.update.base") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*presentation.Dlr); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlr`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.Dlr) + fc.Result = res + return ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateDlrBase(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateDlrBase_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateDlrCore(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDlrCore(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDlrCore(rctx, fc.Args["dlr"].(presentation.DlrInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "dlr.update.core") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*presentation.Dlr); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlr`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.Dlr) + fc.Result = res + return ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateDlrCore(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateDlrCore_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_refresh(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_refresh(ctx, field) +func (ec *executionContext) _Mutation_updateDlrStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDlrStatus(ctx, field) if err != nil { return graphql.Null } @@ -1313,8 +2528,32 @@ func (ec *executionContext) _Mutation_refresh(ctx context.Context, field graphql } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Refresh(rctx, fc.Args["token"].(presentation.TokenInput)) + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDlrStatus(rctx, fc.Args["dlr"].(presentation.DlrInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "dlr.update.status") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*presentation.Dlr); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlr`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -1326,12 +2565,12 @@ func (ec *executionContext) _Mutation_refresh(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(*presentation.Token) + res := resTmp.(*presentation.Dlr) fc.Result = res - return ec.marshalNToken2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐToken(ctx, field.Selections, res) + return ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_refresh(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_updateDlrStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -1339,12 +2578,22 @@ func (ec *executionContext) fieldContext_Mutation_refresh(ctx context.Context, f IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "AuthenticationToken": - return ec.fieldContext_Token_AuthenticationToken(ctx, field) - case "RefreshToken": - return ec.fieldContext_Token_RefreshToken(ctx, field) + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Token", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) }, } defer func() { @@ -1354,15 +2603,15 @@ func (ec *executionContext) fieldContext_Mutation_refresh(ctx context.Context, f } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_refresh_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_updateDlrStatus_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_logout(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_logout(ctx, field) +func (ec *executionContext) _Mutation_deleteDlr(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDlr(ctx, field) if err != nil { return graphql.Null } @@ -1374,29 +2623,72 @@ func (ec *executionContext) _Mutation_logout(ctx context.Context, field graphql. } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().Logout(rctx, fc.Args["token"].(presentation.TokenInput)) + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteDlr(rctx, fc.Args["Id"].(string)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "dlr.delete") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*presentation.Dlr); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlr`, tmp) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(*presentation.Dlr) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_logout(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_deleteDlr(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) }, } defer func() { @@ -1406,7 +2698,7 @@ func (ec *executionContext) fieldContext_Mutation_logout(ctx context.Context, fi } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_logout_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_deleteDlr_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } @@ -2083,10 +3375,130 @@ func (ec *executionContext) _PermissionGroup_Permissions(ctx context.Context, fi ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Permissions, nil + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Permissions, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*presentation.Permission) + fc.Result = res + return ec.marshalNPermission2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐPermissionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PermissionGroup_Permissions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PermissionGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Policy": + return ec.fieldContext_Permission_Policy(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Permission", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_auth(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_auth(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Auth(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*presentation.AuthOps) + fc.Result = res + return ec.marshalNAuthOps2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐAuthOps(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_auth(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "Auth": + return ec.fieldContext_AuthOps_Auth(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AuthOps", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_roles(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_roles(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Roles(rctx, fc.Args["filter"].(*presentation.RoleFilterInput)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "none") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.([]*presentation.Role); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Role`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -2098,30 +3510,43 @@ func (ec *executionContext) _PermissionGroup_Permissions(ctx context.Context, fi } return graphql.Null } - res := resTmp.([]*presentation.Permission) + res := resTmp.([]*presentation.Role) fc.Result = res - return ec.marshalNPermission2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐPermissionᚄ(ctx, field.Selections, res) + return ec.marshalNRole2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐRoleᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PermissionGroup_Permissions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_roles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PermissionGroup", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "Policy": - return ec.fieldContext_Permission_Policy(ctx, field) + case "RoleName": + return ec.fieldContext_Role_RoleName(ctx, field) + case "PermissionGroups": + return ec.fieldContext_Role_PermissionGroups(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Permission", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Role", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_roles_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Query_auth(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_auth(ctx, field) +func (ec *executionContext) _Query_dlr(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_dlr(ctx, field) if err != nil { return graphql.Null } @@ -2133,8 +3558,32 @@ func (ec *executionContext) _Query_auth(ctx context.Context, field graphql.Colle } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Auth(rctx) + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Dlr(rctx, fc.Args["Id"].(string)) + } + directive1 := func(ctx context.Context) (interface{}, error) { + policy, err := ec.unmarshalNString2string(ctx, "dlr.read") + if err != nil { + return nil, err + } + if ec.directives.Auth == nil { + return nil, errors.New("directive auth is not implemented") + } + return ec.directives.Auth(ctx, nil, directive0, policy) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*presentation.Dlr); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlr`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -2146,12 +3595,12 @@ func (ec *executionContext) _Query_auth(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(*presentation.AuthOps) + res := resTmp.(*presentation.Dlr) fc.Result = res - return ec.marshalNAuthOps2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐAuthOps(ctx, field.Selections, res) + return ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_auth(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_dlr(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -2159,17 +3608,40 @@ func (ec *executionContext) fieldContext_Query_auth(ctx context.Context, field g IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "Auth": - return ec.fieldContext_AuthOps_Auth(ctx, field) + case "Id": + return ec.fieldContext_Dlr_Id(ctx, field) + case "DlrType": + return ec.fieldContext_Dlr_DlrType(ctx, field) + case "DlrStatus": + return ec.fieldContext_Dlr_DlrStatus(ctx, field) + case "DlrBase": + return ec.fieldContext_Dlr_DlrBase(ctx, field) + case "DlrCore": + return ec.fieldContext_Dlr_DlrCore(ctx, field) + case "CreatedAt": + return ec.fieldContext_Dlr_CreatedAt(ctx, field) + case "UpdatedAt": + return ec.fieldContext_Dlr_UpdatedAt(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type AuthOps", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Dlr", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_dlr_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _Query_roles(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_roles(ctx, field) +func (ec *executionContext) _Query_dlrs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_dlrs(ctx, field) if err != nil { return graphql.Null } @@ -2183,10 +3655,10 @@ func (ec *executionContext) _Query_roles(ctx context.Context, field graphql.Coll resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Roles(rctx, fc.Args["filter"].(*presentation.RoleFilterInput)) + return ec.resolvers.Query().Dlrs(rctx, fc.Args["filter"].(*presentation.DlrFilterInput)) } directive1 := func(ctx context.Context) (interface{}, error) { - policy, err := ec.unmarshalNString2string(ctx, "none") + policy, err := ec.unmarshalNString2string(ctx, "dlr.list") if err != nil { return nil, err } @@ -2203,10 +3675,10 @@ func (ec *executionContext) _Query_roles(ctx context.Context, field graphql.Coll if tmp == nil { return nil, nil } - if data, ok := tmp.([]*presentation.Role); ok { + if data, ok := tmp.(*presentation.Dlrs); ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Role`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/octoposprime/op-be-graphql/pkg/presentation/dto/model.Dlrs`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -2218,12 +3690,12 @@ func (ec *executionContext) _Query_roles(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.([]*presentation.Role) + res := resTmp.(*presentation.Dlrs) fc.Result = res - return ec.marshalNRole2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐRoleᚄ(ctx, field.Selections, res) + return ec.marshalNDlrs2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrs(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_roles(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_dlrs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -2231,12 +3703,12 @@ func (ec *executionContext) fieldContext_Query_roles(ctx context.Context, field IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "RoleName": - return ec.fieldContext_Role_RoleName(ctx, field) - case "PermissionGroups": - return ec.fieldContext_Role_PermissionGroups(ctx, field) + case "Total": + return ec.fieldContext_Dlrs_Total(ctx, field) + case "Dlrs": + return ec.fieldContext_Dlrs_Dlrs(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Role", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Dlrs", field.Name) }, } defer func() { @@ -2246,7 +3718,7 @@ func (ec *executionContext) fieldContext_Query_roles(ctx context.Context, field } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_roles_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Query_dlrs_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } @@ -5420,57 +6892,270 @@ func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, fiel case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputDlrBaseInput(ctx context.Context, obj interface{}) (presentation.DlrBaseInput, error) { + var it presentation.DlrBaseInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Tags"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Tags": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Tags")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.Tags = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputDlrCoreInput(ctx context.Context, obj interface{}) (presentation.DlrCoreInput, error) { + var it presentation.DlrCoreInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"DlrData"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "DlrData": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrData")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.DlrData = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputDlrFilterInput(ctx context.Context, obj interface{}) (presentation.DlrFilterInput, error) { + var it presentation.DlrFilterInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Id", "DlrType", "DlrStatus", "Tags", "CreatedAtFrom", "CreatedAtTo", "UpdatedAtFrom", "UpdatedAtTo", "SearchText", "SortType", "SortField", "Pagination"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Id")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "DlrType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrType")) + data, err := ec.unmarshalODlrType2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx, v) + if err != nil { + return it, err + } + it.DlrType = data + case "DlrStatus": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrStatus")) + data, err := ec.unmarshalODlrStatus2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx, v) + if err != nil { + return it, err + } + it.DlrStatus = data + case "Tags": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Tags")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.Tags = data + case "CreatedAtFrom": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CreatedAtFrom")) + data, err := ec.unmarshalOTimestamp2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtFrom = data + case "CreatedAtTo": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CreatedAtTo")) + data, err := ec.unmarshalOTimestamp2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.CreatedAtTo = data + case "UpdatedAtFrom": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("UpdatedAtFrom")) + data, err := ec.unmarshalOTimestamp2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtFrom = data + case "UpdatedAtTo": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("UpdatedAtTo")) + data, err := ec.unmarshalOTimestamp2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.UpdatedAtTo = data + case "SearchText": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("SearchText")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SearchText = data + case "SortType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("SortType")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SortType = data + case "SortField": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("SortField")) + data, err := ec.unmarshalODlrSortField2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrSortField(ctx, v) + if err != nil { + return it, err + } + it.SortField = data + case "Pagination": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Pagination")) + data, err := ec.unmarshalOPageInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐPageInput(ctx, v) + if err != nil { + return it, err + } + it.Pagination = data + } } - return fc, nil + + return it, nil } -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputDlrInput(ctx context.Context, obj interface{}) (presentation.DlrInput, error) { + var it presentation.DlrInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"Id", "DlrType", "DlrStatus", "DlrBase", "DlrCore"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Id")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "DlrType": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrType")) + data, err := ec.unmarshalODlrType2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx, v) + if err != nil { + return it, err + } + it.DlrType = data + case "DlrStatus": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrStatus")) + data, err := ec.unmarshalODlrStatus2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx, v) + if err != nil { + return it, err + } + it.DlrStatus = data + case "DlrBase": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrBase")) + data, err := ec.unmarshalODlrBaseInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrBaseInput(ctx, v) + if err != nil { + return it, err + } + it.DlrBase = data + case "DlrCore": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("DlrCore")) + data, err := ec.unmarshalODlrCoreInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrCoreInput(ctx, v) + if err != nil { + return it, err + } + it.DlrCore = data } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} -func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil + return it, nil } -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - func (ec *executionContext) unmarshalInputLoginRequestInput(ctx context.Context, obj interface{}) (presentation.LoginRequestInput, error) { var it presentation.LoginRequestInput asMap := map[string]interface{}{} @@ -5925,26 +7610,217 @@ func (ec *executionContext) _AuthOps(ctx context.Context, sel ast.SelectionSet, return res } - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var dlrImplementors = []string{"Dlr"} + +func (ec *executionContext) _Dlr(ctx context.Context, sel ast.SelectionSet, obj *presentation.Dlr) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, dlrImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Dlr") + case "Id": + out.Values[i] = ec._Dlr_Id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "DlrType": + out.Values[i] = ec._Dlr_DlrType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "DlrStatus": + out.Values[i] = ec._Dlr_DlrStatus(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "DlrBase": + out.Values[i] = ec._Dlr_DlrBase(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "DlrCore": + out.Values[i] = ec._Dlr_DlrCore(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "CreatedAt": + out.Values[i] = ec._Dlr_CreatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "UpdatedAt": + out.Values[i] = ec._Dlr_UpdatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var dlrBaseImplementors = []string{"DlrBase"} + +func (ec *executionContext) _DlrBase(ctx context.Context, sel ast.SelectionSet, obj *presentation.DlrBase) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, dlrBaseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DlrBase") + case "Tags": + out.Values[i] = ec._DlrBase_Tags(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var dlrCoreImplementors = []string{"DlrCore"} + +func (ec *executionContext) _DlrCore(ctx context.Context, sel ast.SelectionSet, obj *presentation.DlrCore) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, dlrCoreImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DlrCore") + case "DlrData": + out.Values[i] = ec._DlrCore_DlrData(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } +var dlrsImplementors = []string{"Dlrs"} - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) +func (ec *executionContext) _Dlrs(ctx context.Context, sel ast.SelectionSet, obj *presentation.Dlrs) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, dlrsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Dlrs") + case "Total": + out.Values[i] = ec._Dlrs_Total(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "Dlrs": + out.Values[i] = ec._Dlrs_Dlrs(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -6100,6 +7976,41 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_logout(ctx, field) }) + case "createDlr": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createDlr(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateDlrBase": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDlrBase(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateDlrCore": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDlrCore(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateDlrStatus": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDlrStatus(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteDlr": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteDlr(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "createUser": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_createUser(ctx, field) @@ -6307,6 +8218,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "dlr": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_dlr(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "dlrs": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_dlrs(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "errors": field := field @@ -7094,6 +9049,123 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se return res } +func (ec *executionContext) marshalNDlr2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx context.Context, sel ast.SelectionSet, v presentation.Dlr) graphql.Marshaler { + return ec._Dlr(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDlr2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrᚄ(ctx context.Context, sel ast.SelectionSet, v []*presentation.Dlr) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNDlr2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlr(ctx context.Context, sel ast.SelectionSet, v *presentation.Dlr) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Dlr(ctx, sel, v) +} + +func (ec *executionContext) marshalNDlrBase2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrBase(ctx context.Context, sel ast.SelectionSet, v *presentation.DlrBase) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DlrBase(ctx, sel, v) +} + +func (ec *executionContext) marshalNDlrCore2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrCore(ctx context.Context, sel ast.SelectionSet, v *presentation.DlrCore) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DlrCore(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNDlrInput2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrInput(ctx context.Context, v interface{}) (presentation.DlrInput, error) { + res, err := ec.unmarshalInputDlrInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNDlrStatus2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx context.Context, v interface{}) (presentation.DlrStatus, error) { + var res presentation.DlrStatus + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDlrStatus2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx context.Context, sel ast.SelectionSet, v presentation.DlrStatus) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNDlrType2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx context.Context, v interface{}) (presentation.DlrType, error) { + var res presentation.DlrType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDlrType2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx context.Context, sel ast.SelectionSet, v presentation.DlrType) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNDlrs2githubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrs(ctx context.Context, sel ast.SelectionSet, v presentation.Dlrs) graphql.Marshaler { + return ec._Dlrs(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDlrs2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrs(ctx context.Context, sel ast.SelectionSet, v *presentation.Dlrs) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Dlrs(ctx, sel, v) +} + func (ec *executionContext) marshalNError2ᚕᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐErrorᚄ(ctx context.Context, sel ast.SelectionSet, v []*presentation.Error) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -7149,12 +9221,12 @@ func (ec *executionContext) marshalNError2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑ } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalID(v) + res, err := uuid.UnmarshalUuid(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalID(v) + res := uuid.MarshalUuid(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7827,11 +9899,83 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast return res } +func (ec *executionContext) unmarshalODlrBaseInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrBaseInput(ctx context.Context, v interface{}) (*presentation.DlrBaseInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputDlrBaseInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalODlrCoreInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrCoreInput(ctx context.Context, v interface{}) (*presentation.DlrCoreInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputDlrCoreInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalODlrFilterInput2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrFilterInput(ctx context.Context, v interface{}) (*presentation.DlrFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputDlrFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalODlrSortField2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrSortField(ctx context.Context, v interface{}) (*presentation.DlrSortField, error) { + if v == nil { + return nil, nil + } + var res = new(presentation.DlrSortField) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalODlrSortField2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrSortField(ctx context.Context, sel ast.SelectionSet, v *presentation.DlrSortField) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalODlrStatus2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx context.Context, v interface{}) (*presentation.DlrStatus, error) { + if v == nil { + return nil, nil + } + var res = new(presentation.DlrStatus) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalODlrStatus2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrStatus(ctx context.Context, sel ast.SelectionSet, v *presentation.DlrStatus) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalODlrType2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx context.Context, v interface{}) (*presentation.DlrType, error) { + if v == nil { + return nil, nil + } + var res = new(presentation.DlrType) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalODlrType2ᚖgithubᚗcomᚋoctoposprimeᚋopᚑbeᚑgraphqlᚋpkgᚋpresentationᚋdtoᚋmodelᚐDlrType(ctx context.Context, sel ast.SelectionSet, v *presentation.DlrType) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v interface{}) (*string, error) { if v == nil { return nil, nil } - res, err := graphql.UnmarshalID(v) + res, err := uuid.UnmarshalUuid(v) return &res, graphql.ErrorOnPath(ctx, err) } @@ -7839,7 +9983,7 @@ func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.Se if v == nil { return graphql.Null } - res := graphql.MarshalID(*v) + res := uuid.MarshalUuid(*v) return res } diff --git a/pkg/presentation/dto/model/dlr.go b/pkg/presentation/dto/model/dlr.go new file mode 100644 index 0000000..ed06523 --- /dev/null +++ b/pkg/presentation/dto/model/dlr.go @@ -0,0 +1,62 @@ +package presentation + +import ( + pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr" +) + +// DlrDto is a struct that represents the dto of a dlr basic values. +type DlrDto struct { + ModelData *Dlr + ModelInputData *DlrInput + PbData *pb.Dlr +} + +// NewDlrDto creates a new *DlrDto. +func NewDlrDto(modelInputData *DlrInput) *DlrDto { + pbData := new(pb.Dlr) + return &DlrDto{ + ModelData: new(Dlr), + ModelInputData: modelInputData, + PbData: pbData, + } +} + +// ToPb converts *ModelInputData to *PbData and returns it. +func (u *DlrDto) ToPb() *pb.Dlr { + if u.ModelInputData.ID != nil { + u.PbData.Id = *u.ModelInputData.ID + } + if u.ModelInputData.DlrCore != nil { + if u.ModelInputData.DlrCore.DlrData != nil { + u.PbData.DlrData = *u.ModelInputData.DlrCore.DlrData + } + } + if u.ModelInputData.DlrType != nil { + u.PbData.DlrType = pb.DlrType(DlrType_value[*u.ModelInputData.DlrType]) + } + if u.ModelInputData.DlrStatus != nil { + u.PbData.DlrStatus = pb.DlrStatus(DlrStatus_value[*u.ModelInputData.DlrStatus]) + } + if u.ModelInputData.DlrBase != nil { + if u.ModelInputData.DlrBase.Tags != nil { + u.PbData.Tags = u.ModelInputData.DlrBase.Tags + } + } + return u.PbData +} + +// ToModel converts *PbData to *ModelData and returns it. +func (u *DlrDto) ToModel() *Dlr { + u.ModelData.DlrBase = new(DlrBase) + u.ModelData.DlrCore = new(DlrCore) + u.ModelData.ID = u.PbData.Id + u.ModelData.DlrCore.DlrData = u.PbData.DlrData + u.ModelData.DlrType = DlrType(DlrType_name[int32(u.PbData.DlrType)]) + u.ModelData.DlrStatus = DlrStatus(DlrStatus_name[int32(u.PbData.DlrStatus)]) + u.ModelData.DlrBase.Tags = u.PbData.Tags + + // Only for view + u.ModelData.CreatedAt = u.PbData.CreatedAt.AsTime() + u.ModelData.UpdatedAt = u.PbData.UpdatedAt.AsTime() + return u.ModelData +} diff --git a/pkg/presentation/dto/model/dlr_test.go b/pkg/presentation/dto/model/dlr_test.go new file mode 100644 index 0000000..632e273 --- /dev/null +++ b/pkg/presentation/dto/model/dlr_test.go @@ -0,0 +1 @@ +package presentation diff --git a/pkg/presentation/dto/model/dlrfilter.go b/pkg/presentation/dto/model/dlrfilter.go new file mode 100644 index 0000000..1968afb --- /dev/null +++ b/pkg/presentation/dto/model/dlrfilter.go @@ -0,0 +1,52 @@ +package presentation + +import ( + pb "github.com/octoposprime/op-be-shared/pkg/proto/pb/dlr" + "google.golang.org/protobuf/types/known/timestamppb" +) + +// DlrFilterDto is a struct that provides filtering requested dlr data. +type DlrFilterDto struct { + ModelInputData *DlrFilterInput + PbData *pb.DlrFilter +} + +// NewDlrFilterDto creates a new *DlrFilterDto. +func NewDlrFilterDto(modelInputData *DlrFilterInput) *DlrFilterDto { + return &DlrFilterDto{ + ModelInputData: modelInputData, + PbData: new(pb.DlrFilter), + } +} + +// ToPb converts *ModelInputData to *PbData and returns it. +func (u *DlrFilterDto) ToPb() *pb.DlrFilter { + u.PbData.Id = u.ModelInputData.ID + if u.ModelInputData.DlrType != nil { + enumVal := pb.DlrType(DlrType_value[*u.ModelInputData.DlrType]) + u.PbData.DlrType = &enumVal + } + if u.ModelInputData.DlrStatus != nil { + enumVal := pb.DlrStatus(DlrStatus_value[*u.ModelInputData.DlrStatus]) + u.PbData.DlrStatus = &enumVal + } + u.PbData.Tags = u.ModelInputData.Tags + if u.ModelInputData.CreatedAtFrom != nil && u.ModelInputData.CreatedAtTo != nil { + u.PbData.CreatedAtFrom = timestamppb.New(*u.ModelInputData.CreatedAtFrom) + u.PbData.CreatedAtTo = timestamppb.New(*u.ModelInputData.CreatedAtTo) + } + if u.ModelInputData.UpdatedAtFrom != nil && u.ModelInputData.UpdatedAtTo != nil { + u.PbData.UpdatedAtFrom = timestamppb.New(*u.ModelInputData.UpdatedAtFrom) + u.PbData.UpdatedAtTo = timestamppb.New(*u.ModelInputData.UpdatedAtTo) + } + u.PbData.SearchText = u.ModelInputData.SearchText + u.PbData.SortType = u.ModelInputData.SortType + if u.ModelInputData.SortField != nil { + enumVal := pb.DlrSortField(DlrSortField_value[*u.ModelInputData.SortField]) + u.PbData.SortField = &enumVal + } + u.ModelInputData.Pagination = u.ModelInputData.Pagination.Validate() + u.PbData.Limit = u.ModelInputData.Pagination.Limit + u.PbData.Offset = u.ModelInputData.Pagination.Offset + return u.PbData +} diff --git a/pkg/presentation/dto/model/dlrfilter_test.go b/pkg/presentation/dto/model/dlrfilter_test.go new file mode 100644 index 0000000..632e273 --- /dev/null +++ b/pkg/presentation/dto/model/dlrfilter_test.go @@ -0,0 +1 @@ +package presentation diff --git a/pkg/presentation/dto/model/dlrsortfield.go b/pkg/presentation/dto/model/dlrsortfield.go new file mode 100644 index 0000000..58ded72 --- /dev/null +++ b/pkg/presentation/dto/model/dlrsortfield.go @@ -0,0 +1,14 @@ +package presentation + +var DlrSortField_name = map[int32]DlrSortField{ + 0: DlrSortFieldNone, + 1: DlrSortFieldID, + 2: DlrSortFieldCreatedAt, + 3: DlrSortFieldUpdatedAt, +} +var DlrSortField_value = map[DlrSortField]int32{ + DlrSortFieldNone: 0, + DlrSortFieldID: 1, + DlrSortFieldCreatedAt: 2, + DlrSortFieldUpdatedAt: 3, +} diff --git a/pkg/presentation/dto/model/dlrstatus.go b/pkg/presentation/dto/model/dlrstatus.go new file mode 100644 index 0000000..f209ab3 --- /dev/null +++ b/pkg/presentation/dto/model/dlrstatus.go @@ -0,0 +1,12 @@ +package presentation + +var DlrStatus_name = map[int32]DlrStatus{ + 0: DlrStatusNone, + 1: DlrStatusActive, + 2: DlrStatusInactive, +} +var DlrStatus_value = map[DlrStatus]int32{ + DlrStatusNone: 0, + DlrStatusActive: 1, + DlrStatusInactive: 2, +} diff --git a/pkg/presentation/dto/model/dlrtype.go b/pkg/presentation/dto/model/dlrtype.go new file mode 100644 index 0000000..f44afd8 --- /dev/null +++ b/pkg/presentation/dto/model/dlrtype.go @@ -0,0 +1,8 @@ +package presentation + +var DlrType_name = map[int32]DlrType{ + 0: DlrTypeNone, +} +var DlrType_value = map[DlrType]int32{ + DlrTypeNone: 0, +} diff --git a/pkg/presentation/dto/model/models_gen.go b/pkg/presentation/dto/model/models_gen.go index 7df9592..ca31c47 100644 --- a/pkg/presentation/dto/model/models_gen.go +++ b/pkg/presentation/dto/model/models_gen.go @@ -15,6 +15,97 @@ type AuthOps struct { Auth bool `json:"Auth"` } +// Dlr represents the basic values of the dlr +type Dlr struct { + // Id is the id of the dlr + ID string `json:"Id"` + // DlrType is the type of the dlr + DlrType DlrType `json:"DlrType"` + // DlrStatus is the status of the dlr + DlrStatus DlrStatus `json:"DlrStatus"` + // DlrBase is the base values of the dlr + DlrBase *DlrBase `json:"DlrBase"` + // DlrCore is the core values of the dlr + DlrCore *DlrCore `json:"DlrCore"` + // CreatedAt is the create time of the dlr + CreatedAt time.Time `json:"CreatedAt"` + // UpdatedAt is the update time of the dlr + UpdatedAt time.Time `json:"UpdatedAt"` +} + +// DlrBase represents the base values of the dlr +type DlrBase struct { + // Tags are the tag labels of the dlr + Tags []string `json:"Tags"` +} + +// DlrBase represents the base values of the dlr +type DlrBaseInput struct { + // Tags are the tag labels of the dlr + Tags []string `json:"Tags,omitempty"` +} + +// DlrCore represents the core values of the dlr +type DlrCore struct { + // DlrData is the dlr data of the dlr + DlrData string `json:"DlrData"` +} + +// DlrCore represents the core values of the dlr +type DlrCoreInput struct { + // DlrData is the dlr data of the dlr + DlrData *string `json:"DlrData,omitempty"` +} + +// DlrFilterInput is used for filtering the Dlrs +type DlrFilterInput struct { + // Id is the id of the dlr + ID *string `json:"Id,omitempty"` + // DlrType is the type of the dlr + DlrType *DlrType `json:"DlrType,omitempty"` + // DlrStatus is the status of the dlr + DlrStatus *DlrStatus `json:"DlrStatus,omitempty"` + // Tags are the tag labels of the dlr + Tags []string `json:"Tags,omitempty"` + // CreatedAtFrom is the start value of the create time of the dlr + CreatedAtFrom *time.Time `json:"CreatedAtFrom,omitempty"` + // CreatedAtTo is the end value of the create time of the dlr + CreatedAtTo *time.Time `json:"CreatedAtTo,omitempty"` + // UpdatedAtFrom is the start value of the update time of the dlr + UpdatedAtFrom *time.Time `json:"UpdatedAtFrom,omitempty"` + // UpdatedAtTo is the end value of the update time of the dlr + UpdatedAtTo *time.Time `json:"UpdatedAtTo,omitempty"` + // SearchText is the value of the full text search + SearchText *string `json:"SearchText,omitempty"` + // SortType is the sorting type. It can be only ASC or DESC + SortType *string `json:"SortType,omitempty"` + // SortField is the sortable field of the dlr + SortField *DlrSortField `json:"SortField,omitempty"` + // PageInput is used for pagination + Pagination *PageInput `json:"Pagination,omitempty"` +} + +// Dlr represents the basic values of the dlr +type DlrInput struct { + // Id is the id of the dlr + ID *string `json:"Id,omitempty"` + // DlrStatus is the status of the dlr + DlrType *DlrType `json:"DlrType,omitempty"` + // DlrStatus is the status of the dlr + DlrStatus *DlrStatus `json:"DlrStatus,omitempty"` + // DlrBase is the base values of the dlr + DlrBase *DlrBaseInput `json:"DlrBase,omitempty"` + // DlrCore is the core values of the dlr + DlrCore *DlrCoreInput `json:"DlrCore,omitempty"` +} + +type Dlrs struct { + // The total number of Dlrs that match the filter + Total int32 `json:"Total"` + // The Dlrs that match the filter + Dlrs []*Dlr `json:"Dlrs"` +} + // Error represents the built-in error message type Error struct { Error string `json:"Error"` @@ -224,6 +315,141 @@ type Users struct { Users []*User `json:"Users"` } +type DlrSortField string + +const ( + // No Type + DlrSortFieldNone DlrSortField = "None" + // Id + DlrSortFieldID DlrSortField = "Id" + // Created Time + DlrSortFieldCreatedAt DlrSortField = "CreatedAt" + // Updated Time + DlrSortFieldUpdatedAt DlrSortField = "UpdatedAt" +) + +var AllDlrSortField = []DlrSortField{ + DlrSortFieldNone, + DlrSortFieldID, + DlrSortFieldCreatedAt, + DlrSortFieldUpdatedAt, +} + +func (e DlrSortField) IsValid() bool { + switch e { + case DlrSortFieldNone, DlrSortFieldID, DlrSortFieldCreatedAt, DlrSortFieldUpdatedAt: + return true + } + return false +} + +func (e DlrSortField) String() string { + return string(e) +} + +func (e *DlrSortField) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = DlrSortField(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid DlrSortField", str) + } + return nil +} + +func (e DlrSortField) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type DlrStatus string + +const ( + // No Type + DlrStatusNone DlrStatus = "NONE" + // Active + DlrStatusActive DlrStatus = "ACTIVE" + // Inactive + DlrStatusInactive DlrStatus = "INACTIVE" +) + +var AllDlrStatus = []DlrStatus{ + DlrStatusNone, + DlrStatusActive, + DlrStatusInactive, +} + +func (e DlrStatus) IsValid() bool { + switch e { + case DlrStatusNone, DlrStatusActive, DlrStatusInactive: + return true + } + return false +} + +func (e DlrStatus) String() string { + return string(e) +} + +func (e *DlrStatus) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = DlrStatus(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid DlrStatus", str) + } + return nil +} + +func (e DlrStatus) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type DlrType string + +const ( + // No Type + DlrTypeNone DlrType = "NONE" +) + +var AllDlrType = []DlrType{ + DlrTypeNone, +} + +func (e DlrType) IsValid() bool { + switch e { + case DlrTypeNone: + return true + } + return false +} + +func (e DlrType) String() string { + return string(e) +} + +func (e *DlrType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = DlrType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid DlrType", str) + } + return nil +} + +func (e DlrType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + type PasswordStatus string const ( diff --git a/pkg/presentation/dto/schema/dlr.graphql b/pkg/presentation/dto/schema/dlr.graphql new file mode 100644 index 0000000..d03894a --- /dev/null +++ b/pkg/presentation/dto/schema/dlr.graphql @@ -0,0 +1,135 @@ +extend type Query { + """The Dlr EP returns a single Dlr that is given ID""" + dlr( Id: ID!): Dlr! @goField(forceResolver: true) @auth(policy: "dlr.read") + """The Dlrs EP takes filter and returns all Dlrs of matched with filter""" + dlrs(filter: DlrFilterInput): Dlrs! @goField(forceResolver: true) @auth(policy: "dlr.list") +} + +type Dlrs { + """The total number of Dlrs that match the filter""" + Total: Int! + """The Dlrs that match the filter""" + Dlrs: [Dlr!]! +} + +"""Dlr represents the basic values of the dlr""" +type Dlr { + """Id is the id of the dlr""" + Id: ID! + """DlrType is the type of the dlr""" + DlrType: DlrType! + """DlrStatus is the status of the dlr""" + DlrStatus: DlrStatus! + """DlrBase is the base values of the dlr""" + DlrBase: DlrBase! + """DlrCore is the core values of the dlr""" + DlrCore: DlrCore! + """CreatedAt is the create time of the dlr""" + CreatedAt: Timestamp! + """UpdatedAt is the update time of the dlr""" + UpdatedAt: Timestamp! +} + +"""DlrBase represents the base values of the dlr""" +type DlrBase { + """Tags are the tag labels of the dlr""" + Tags: [String!]! +} + +"""DlrCore represents the core values of the dlr""" +type DlrCore { + """DlrData is the dlr data of the dlr""" + DlrData: String! +} + +"""DlrFilterInput is used for filtering the Dlrs""" +input DlrFilterInput { + """Id is the id of the dlr""" + Id: ID + """DlrType is the type of the dlr""" + DlrType: DlrType + """DlrStatus is the status of the dlr""" + DlrStatus: DlrStatus + """Tags are the tag labels of the dlr""" + Tags: [String!] + """CreatedAtFrom is the start value of the create time of the dlr""" + CreatedAtFrom: Timestamp + """CreatedAtTo is the end value of the create time of the dlr""" + CreatedAtTo: Timestamp + """UpdatedAtFrom is the start value of the update time of the dlr""" + UpdatedAtFrom: Timestamp + """UpdatedAtTo is the end value of the update time of the dlr""" + UpdatedAtTo: Timestamp + """SearchText is the value of the full text search""" + SearchText: String + """SortType is the sorting type. It can be only ASC or DESC""" + SortType: String + """SortField is the sortable field of the dlr""" + SortField: DlrSortField + """PageInput is used for pagination""" + Pagination: PageInput +} + +"""Dlr represents the basic values of the dlr""" +input DlrInput { + """Id is the id of the dlr""" + Id: ID + """DlrStatus is the status of the dlr""" + DlrType: DlrType + """DlrStatus is the status of the dlr""" + DlrStatus: DlrStatus + """DlrBase is the base values of the dlr""" + DlrBase: DlrBaseInput + """DlrCore is the core values of the dlr""" + DlrCore: DlrCoreInput +} + +"""DlrBase represents the base values of the dlr""" +input DlrBaseInput { + """Tags are the tag labels of the dlr""" + Tags: [String!] +} + +"""DlrCore represents the core values of the dlr""" +input DlrCoreInput { + """DlrData is the dlr data of the dlr""" + DlrData: String +} + +extend type Mutation { + """Create Dlr EP creates a new dlr with given Dlr and returns it""" + createDlr(dlr: DlrInput!): Dlr! @goField(forceResolver: true) @auth(policy: "dlr.create") + """Update Dlr Base EP updates the given dlr's base values and returns it""" + updateDlrBase(dlr: DlrInput!): Dlr! @goField(forceResolver: true) @auth(policy: "dlr.update.base") + """Update Dlr Core EP updates the given dlr's core values and returns it""" + updateDlrCore(dlr: DlrInput!): Dlr! @goField(forceResolver: true) @auth(policy: "dlr.update.core") + """Update Dlr Status EP updates given dlr status and returns it""" + updateDlrStatus(dlr: DlrInput!): Dlr! @goField(forceResolver: true) @auth(policy: "dlr.update.status") + """Delete Dlr EP deletes Dlr that is given ID and returns it""" + deleteDlr(Id: ID!): Dlr! @goField(forceResolver: true) @auth(policy: "dlr.delete") +} + +enum DlrType { + """No Type""" + NONE +} + +enum DlrSortField { + """No Type""" + None + """Id""" + Id + """Created Time""" + CreatedAt + """Updated Time""" + UpdatedAt +} + +enum DlrStatus { + """No Type""" + NONE + """Active""" + ACTIVE + """Inactive""" + INACTIVE +} \ No newline at end of file diff --git a/pkg/presentation/dto/schema/user.graphql b/pkg/presentation/dto/schema/user.graphql index 9100bfe..f1a17cf 100644 --- a/pkg/presentation/dto/schema/user.graphql +++ b/pkg/presentation/dto/schema/user.graphql @@ -141,7 +141,7 @@ extend type Mutation { updateUserStatus(user: UserInput!): User! @goField(forceResolver: true) @auth(policy: "user.update.status") """Delete User EP deletes User that is given ID and returns it""" deleteUser(Id: ID!): User! @goField(forceResolver: true) @auth(policy: "user.delete") - """Change User Password EP updates given user password""" + """Change User Password EP updates given user password""" changeUserPassword(userPassword: UserPasswordInput!): Boolean @goField(forceResolver: true) @auth(policy: "user.change.password") }