Skip to content

Commit 38a6af4

Browse files
committed
domain/gql: adds and wires CurrentUserType
1 parent 8075bb9 commit 38a6af4

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

domain/gql/fields/fields.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var PingField = &graphql.Field{
1919

2020
var CurrentUserField = &graphql.Field{
2121
Name: "CurrentUser",
22-
Type: types.UserType,
22+
Type: types.CurrentUserType,
2323
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
2424
srvs, err := servicesFromResolveParams(p)
2525
if err != nil {
@@ -43,7 +43,7 @@ var CurrentUserField = &graphql.Field{
4343
}
4444

4545
var AuthUserField = &graphql.Field{
46-
Type: types.UserType,
46+
Type: types.CurrentUserType,
4747
Description: "Authenticates and authorizes an user.",
4848
Args: graphql.FieldConfigArgument{
4949
"username": &graphql.ArgumentConfig{

domain/gql/types/types.go

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"github.com/graphql-go/graphql"
55
)
66

7-
var UserType = graphql.NewObject(graphql.ObjectConfig{
8-
Name: "UserType",
7+
var CurrentUserType = graphql.NewObject(graphql.ObjectConfig{
8+
Name: "CurrentUserType",
99
Fields: graphql.Fields{
1010
"id": &graphql.Field{
1111
Description: "The id of the user.",
@@ -21,3 +21,17 @@ var UserType = graphql.NewObject(graphql.ObjectConfig{
2121
},
2222
},
2323
})
24+
25+
var UserType = graphql.NewObject(graphql.ObjectConfig{
26+
Name: "UserType",
27+
Fields: graphql.Fields{
28+
"id": &graphql.Field{
29+
Description: "The id of the user.",
30+
Type: graphql.String,
31+
},
32+
"username": &graphql.Field{
33+
Description: "The username of the user.",
34+
Type: graphql.String,
35+
},
36+
},
37+
})

0 commit comments

Comments
 (0)