-
Notifications
You must be signed in to change notification settings - Fork 0
graphql 쿼리 예시
Minwook Je edited this page Feb 18, 2021
·
14 revisions
- 키워드 place 검색
- page를 넣어주면 원하는 page의 데이터 반환합니다.
{
places(filters: {
query: "돼지",
page: 5
x: 126.54587355630036,
y: 33.379777816446165
size: 10
}){
pageInfo {
total_count
is_end
total_page_count
cur_page
}
places {
id
place_name
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
}
}
}
- x,y 기반 place 검색
{
places(filters: {
query: "돼지",
page: 3
x: 126.54587355630036,
y: 33.379777816446165
}){
pageInfo {
total_count
is_end
total_page_count
cur_page
}
places {
id
place_name
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
}
}
}
- 모든 스티커 확인
{
stickers {
_id
sticker_category
is_used
spot(populate:false){
_id
}
}
}
- 스티커 생성
mutation {
createSticker(createStickerInput: {
place_id: "201796840"
place_name: "할망라면"
x: 126.525700988171
y: 33.241145974544
sticker_category: "당도70"
}){
sticker_category
is_used
spot(populate:true){
_id
place_id
stickers(populate:false){
_id
}
place_name
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
}
}
}
- get all spots
{
spots{
place_name
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
}
}
- get spots by keyword
{
spots(searchSpotDto: {
keyword: "라면"
}){
place_name
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
}
}
- get spots by keyword and (x,y)
{
spots(searchSpotDto: {
keyword: "상점"
x:127.069475150126
y:37.2965566367321
}){
place_name
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
}
}
- spot 삭제
mutation {
removeSpot(id: "6001ee99ca1c83001503ffd9") {
n
}
}
- customspot 생성
mutation {
customSpot(createCustomSpotInput: {
place_name: "욕쟁이 할머니 손맛 붕어빵"
x: 127.0623627535741
y: 37.281262770914716
category_group_name: "음식점"
})
{
_id
place_name
place_id
category_name
category_group_code
category_group_name
phone
address_name
road_address_name
place_url
distance
x
y
is_custom
is_custom_share
stickers(populate: false){
_id
}
}
}
- 코스 생성
- 스티커를 먼저 생성 한 뒤, 스티커들을 순서에 맞게 리스트에 넣어준다.
mutation {
createCourse(createCourseInput: {
stickers: ["60238405bc7cab131aa133b9","60238425bc7cab131aa133bb","60238440bc7cab131aa133bd"]
title: "광교 데이트"
is_share: false
}){
_id
title
is_share
stickers
}
}
-
코스 이미지 url을 포함해서 정보 얻기
- 만약 테스트를 해보고 싶다면
- place 검색 (place id 얻기)
- 스티커 생성 (place id로 스티커 생성)
- 모든 스티커 확인을 통해 id 얻기
- 코스 생성
- 아래 쿼리를 통해 코스 확인
- 만약 테스트를 해보고 싶다면
{
course(courseInput: {
courseId: "6023b7700d3e81506decd05e"
courseImageInput: {
theme: dark
width: 700
height: 700
}
}){
_id
stickers
title
is_share
courseImage
}
}
- 위의 쿼리를 할경우 다음과 같은 response를 받게 됩니다.
{
"data": {
"course": {
"_id": "6023b7700d3e81506decd05e",
"stickers": [
"6023b5033cf8244f7f830443",
"6023b51b3cf8244f7f830445"
],
"title": "광교 데이트2",
"is_share": false,
"courseImage": "https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/path-4%2Bff512f(mvsbFqfqfWtGnAWhC),url-https%3A%2F%2Fuser-images.githubusercontent.com%2F37536298%2F107210367-5ff44b80-6a47-11eb-926f-ba9952911e92.png(127.069363534097,37.2978289663421),url-https%3A%2F%2Fuser-images.githubusercontent.com%2F37536298%2F107210367-5ff44b80-6a47-11eb-926f-ba9952911e92.png(127.067817114706,37.2964386614798)/auto/700x700?access_token=pk.eyJ1IjoibWlua2oxOTkyIiwiYSI6ImNra3F6eGxscjBuNzcyb21yM2N4N2JvZTcifQ.pUWQ8GYaWJXB0oE10Ukq1Q"
}
}
}