index.js
database에 supplice 라는 테이블에 쿼리를 날려보자
supplice 테이블의 구조
const typeDefs = gql`
type Query {
teams: [Team]
equipment: [Equipment]
supplice: [Supplice]
}
type Team {
id: Int
manager: String
office: String
extension_number: String
mascot: String
cleaning_duty: String
project: String
}
type Equipment {
id: String
user_by: String
count: Int
new_or_user: String
}
type Supplice {
id: String
team: Int
}
`
const resolvers = {
Query: {
teams: () => database.teams,
equipment: () => database.equipments,
supplice: () => database.supplies
}
}
supplice 로 쿼리를 날리면
Supplice 에 정의된 객체가 배열형태로 반환됨