Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph QL Info #3

Open
matt-a-t opened this issue Apr 13, 2018 · 9 comments
Open

Graph QL Info #3

matt-a-t opened this issue Apr 13, 2018 · 9 comments

Comments

@matt-a-t
Copy link
Collaborator

Service List query

query {
  serviceList {
    service_code,
    service_name,
    description,
    metadata,
    type,
    keywords,
    group
  }
}

Service Definition Query

This query is required if in the above query metadata === true. The (service_code:${foo}) should be replaced with the service_code from the query above.

query {
  serviceDefinition(service_code: 37){
    variable,
    code,
    datatype,
    required,
    datatype_description,
    values {
      key,
      name
    }
  }
}

Service Requests Query

While likely not required by this project, this returns all the requests that have been made. Eventually if we were to implement users and/or keeping track of issues, it would be through this query and a list of service_request_ids for a user.

query {
  serviceRequests {
    service_request_id,
    status,
    status_notes,
    service_name,
    service_code,
    description,
    agency_responsible,
    service_notice,
    requested_datetime
  }
}

Post Service Request

This is used to post the request. There are a number of parameters to the query, and the final request is returned (can be used to verify it was successful).

Required fields:

  • service_code
  • EITHER:
    • lat & long
      • or
    • address_string
mutation {
  postServiceRequest (
    service_code: $service_code,
    lat: $lat,
    long: $long,
    address_string: $address_string,
    email: $email,
    device_id: $device_id,
    account_id: $account_id,
    first_name: $first_name,
    last_name: $last_name
  ) {
    service_request_id,
    status,
    status_notes,
    service_name,
    service_code,
    description,
    agency_responsible,
    service_notice,
    requested_datetime,
    updated_datetime,
    expected_datetime,
    address,
    address_id,
    zipcode,
    lat,
    long,
    media_url
  }
}

TODO

I still need to handle two more parameters in the POST: media and attributes. Media is going to be hard to load through a graphql query, so hopefully there's some libraries out there for that or I'll have to really rethink things. The other relates to the attibutes from the service definition query. According to the API docs:

This takes the form of attribute[code]=value where multiple code/value pairs can be specified as well as multiple values for the same code in the case of a multivaluelist datatype (attribute[code1][]=value1&attribute[code1][]=value2&attribute[code1][]=value3) - see example.

This is only required if the service_code requires a service definition with required fields`.

@dpalazz
Copy link
Collaborator

dpalazz commented Apr 13, 2018 via email

@mattbatman mattbatman mentioned this issue Apr 13, 2018
15 tasks
@matt-a-t
Copy link
Collaborator Author

Thinking through media uploads, I think it might be easier to upload to a service like Dropbox then reference the URL through the API. Does this seem reasonable to anybody else? I know it adds a layer of complexity, but I foresee major problems trying to upload an image as a field in a graphql query.

Dropbox has a free version with an API that I've used a bit. Before I go barking up that tree too much I wanted to see what everybody thinks.

@mattbatman
Copy link
Collaborator

I actually don't have any experience with handling media uploads.

Does Apollo Upload Server seem helpful? Or is the difficulty in passing the file on after the GraphQL server?

@mattbatman
Copy link
Collaborator

Personally, I feel like if you're confident that using Dropbox will be quicker to implement, we might as well do it. We can suggest alternatives with our project submission.

@matt-a-t
Copy link
Collaborator Author

matt-a-t commented Apr 13, 2018 via email

@mattbatman
Copy link
Collaborator

mattbatman commented Apr 15, 2018

The description and order seem to be missing from our service definition query.

@matt-a-t
Copy link
Collaborator Author

Yup, it looks like I forgot them. I'm working on the media upload bit but I will fix this in the next little bit. Is it a roadblock for you right now? If so I can have it working in the next 15 min.

@mattbatman
Copy link
Collaborator

Is it a roadblock for you right now?

There's plenty of other things to do in the meantime.

@matt-a-t
Copy link
Collaborator Author

Alright, just wanted to say that the description and order have been added to the GraphQL query.

I've mentioned it elsewhere, but the media upload portion is set in parameter media_url. This can be posted to the mutation and will associate the image with the request being submitted.

I believe that everything should be ready to go on the server. Please let me know if it is behaving unexpectedly and we can get that nailed down before tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants