Skip to content
Snippets Groups Projects
Commit 9e71d93b authored by abs's avatar abs
Browse files

MRM-2047 added new graphql method 'getprivate'

parent 7a0a8d5a
Branches feature/MRM-2047
Tags
No related merge requests found
......@@ -27,7 +27,7 @@ require (
gitlab.okta-solutions.com/mashroom/backend/oauth/api v0.0.0-20191125222648-8a5d1cadbdc0
gitlab.okta-solutions.com/mashroom/backend/offer/api v0.0.0-20200504092044-ca02c5f591a4
gitlab.okta-solutions.com/mashroom/backend/payment/api v0.0.0-20191129081017-2306b15ad0b5
gitlab.okta-solutions.com/mashroom/backend/property/api v0.0.0-20200512122034-f2c7adb55ab2
gitlab.okta-solutions.com/mashroom/backend/property/api v0.0.0-20200514175638-503385aac0f1
gitlab.okta-solutions.com/mashroom/backend/rightmove/api v0.0.0-20200325223727-4b487414dd79
gitlab.okta-solutions.com/mashroom/backend/signature/api v0.0.0-20200514151536-0aac143063df
gitlab.okta-solutions.com/mashroom/backend/twilio/api v0.0.0-20200212151345-93dfd06da473
......
......@@ -33,6 +33,12 @@ func init() {
Resolve: PropertyQueryGetResolver,
Type: util.BindOutput(property.GetResponse{}, "Property information", nil),
},
"getprivate": &graphql.Field{
Description: "Retrieves specified property",
Args: util.BindArguments(property.GetRequest{}),
Resolve: PropertyQueryGetPrivateResolver,
Type: util.BindOutput(property.GetResponse{}, "Property information", nil),
},
"my": &graphql.Field{
Description: "Retrieves owned property",
Args: util.BindArguments(property.PropertyListRequest{}),
......@@ -228,6 +234,24 @@ func PropertyQueryGetResolver(params graphql.ResolveParams) (interface{}, error)
return resp, nil
}
func PropertyQueryGetPrivateResolver(params graphql.ResolveParams) (interface{}, error) {
user := params.Context.Value("user").(*auth.AuthResponse)
request := &property.GetPrivateRequest{}
if err := util.UnmarshalArguments(params.Args, request); err != nil {
return nil, err
}
if user != nil {
request.User = user.GetAccount().GetIdValue()
request.IsAdmin = HasRole(user, AdminRole)
}
resp, err := connections.PropertyService.GetPrivate(params.Context, request)
if err != nil {
return nil, err
}
return resp, nil
}
func PropertyQueryMyResolver(params graphql.ResolveParams) (interface{}, error) {
user := params.Context.Value("user").(*auth.AuthResponse)
if user == nil {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment