실제 GraphQL로 비지니스 로직 작성하기
@Resolver
requestPaymentSession: async (parent, {
pgId, name, sex, birthDay, phoneNumber, amount, productName, ref
}, context, info) => {
const ret = await requestPaymentSession({ pgId, name, birthDay, phoneNumber, sex, amount, productName, ref })
return removeSymbol(ret)
},
requestPaymentApprove: async (parent, {
sessionKey, authNumber
}, context, info) => {
const ret = await requestApprovePayment({ sessionKey, authNumber })
return removeSymbol(ret)
}
type Book {
id: ID
title: String
author: Author
}
type Author {
id: ID
firstName: String
lastName: String
books: [Book]
}
type Query {
book(id: ID!): Book
author(id: ID!): Author
}
3
/graphql?query={ book(id: "1") { title, author { firstName } } }
4
{
"title": "Black Hole Blues",
"author": {
"firstName": "Janna"
}
}
(정리중)