GraphQL Level 1

Grace·2021년 11월 3일
0

1) 철수의 나이는 몇살인가요?(나이만 조회해 주세요.)

query {
  fetchProfile(name:"철수"){
    age
  }
}

2) 영희의 학교는 어디인가요?(학교만 조회해 주세요.)

query {
  fetchProfile(name:"영희"){
		school
  }
}

3) 3번 게시글의 내용과 작성일이 무엇인가요?(내용과 작성일만 조회해 주세요.)

query {
  fetchBoard(number:3){
    contents
	createdAt
  }
}

4) 본인의 이름으로 프로필을 작성해 보세요.

mutation {
  createProfile(name:"노은정", age:27, school:"당근초등학교"){
    _id
    number
    message
  }
}

5) 본인의 이름으로 게시글을 작성해 보세요.

mutation {
  createBoard(writer:"노은정", title:"당근", contents:"맛있어요"){
    _id
    number
    message
  }
}

6) 자신의 프로필을 조회해 보세요.

query {
  fetchProfile(name:"노은정"){
    number
    age
    school
  }
}

7) 자신의 게시글을 조회해 보세요.

query {
  fetchBoard(number:68){
    number
    writer
    title
    contents
    like
    createdAt
  }
}

8) 본인의 프로필에서, 학교를 자신이 졸업한 초등학교로 바꿔보세요.

mutation{
  updateProfile(school:"당근초등학교"){
  	_id
    number
    message
  }
}

9) 본인의 게시글에서, 제목과 내용을 바꿔보세요.

mutation{
  updateBoard(title:"토마토", contents:"멋져요"){
    _id
    number
    message
  }
}

10) 자신이 좋아하는 만화 주인공으로 프로필을 작성해 보세요.

mutation{
  createProfile(name:"짱구",age:5, school:"떡잎유치원"){
    _id
    number
    message
  }
}

11) 위 10번에서 작성한 프로필을 삭제해 보세요.

mutation{
  deleteProfile(name:"짱구"){
    _id
    number
    message
  }
}

12) 상품을 하나 만들어 보세요.

mutation{
  createProduct(seller:"노은정", createProductInput:{name:"당근",detail:"유기농 당근 맛있어요",price:100000}
  ){
   _id
   number
    message
  }
}

13) 위 12번에서 만들었던 상품의 가격을 500원 인상해 보세요.

mutation{
  updateProduct(productId:"9e317743-8c16-4c47-bd91-4c1f024b9510", updateProductInput:{price:100500}
  ){
    _id
   number
    message
  }
}

14) 위에서 만든 상품을 조회하되, 가격만 조회해 보세요.

query {
  fetchProduct(productId:"9e317743-8c16-4c47-bd91-4c1f024b9510" ){
    price
  }
}

15) 조회했던 상품을 삭제해 보세요.

mutation{
  deleteProduct(productId:"9e317743-8c16-4c47-bd91-4c1f024b9510"
  ){
    _id
   number
    message
  }
}

16) 삭제한 상품이 정말로 삭제되었는지 다시 한번 조회해 보세요.

query {
  fetchProduct(productId:"9e317743-8c16-4c47-bd91-4c1f024b9510" ){
    price
  }
}

17) 게시물 목록 중, 2페이지를 조회해 보세요.

query {
  fetchBoards(page: 2){
    number
  	writer
	title
    contents
    like
    createdAt
  }
}

18) 게시물 목록을 조회할 때, page를 입력하지 않으면, 어떤 결과가 발생하나요?
최근 게시물이 10개 조회됩니다!

19) 프로필이 전체 몇 개가 있는지 확인해 보세요.

query {
  fetchProfilesCount
}

20) 게시물은 몇 개가 있나요?

{
  "data": {
    "fetchProfilesCount": 27
  }
}
profile
기술블로그 이전:: https://meercat.tistory.com/

0개의 댓글