Skip to content

GraphQL API

yellow2041 edited this page Dec 10, 2020 · 4 revisions

GraphQL API

QUERY

items(genre: String): [Item]
itemDetail(itemId: ID): Item
scheduleListByMonth(itemId: ID, startDate: String, endDate: String): [Schedule]
bookingListByUserId(userId: ID): [Booking]
genres: [Genre]

MUTATION

createUser(userName: String): UserResult
bookItem(userId: ID, item: ItemInput, schedule: ScheduleInput, seats: [SeatInput]): [Booking]
cancelItem(userId: ID, bookingId: ID): [Booking]

Schema

type Booking {
  _id: ID
  item: Item
  schedule: BookedSchedule
  seats: [BookingSeat]
}

type BookingSeat {
  _id: ID
  name: String
  class: String
  status: String
  color: String
  price: Int
}

type Class {
  class: String
  color: String
}

scalar Date

scalar DateTime

type Genre {
  name: String
}

type Item {
  _id: ID
  name: String
  startDate: DateTime
  endDate: DateTime
  place: Place
  img: String
  minBookingCount: Int
  maxBookingCount: Int
  prices: [Price]
  classes: [Class]
  genre: String
  runningTime: String
  ageLimit: String
}

input ItemInput {
  _id: ID
  name: String
  place: PlaceInput
}

type Mutation {
  createUser(userName: String): UserResult
  bookItem(
    userId: ID
    item: ItemInput
    schedule: ScheduleInput
    seats: [SeatInput]
  ): [Booking]
  cancelItem(userId: ID, bookingId: ID): [Booking]
}

type Place {
  name: String
  location: String
}

input PlaceInput {
  name: String
  location: String
}

type Price {
  class: String
  price: Int
}

type Query {
  items(genre: String): [Item]
  itemDetail(itemId: ID): Item
  scheduleListByMonth(
    itemId: ID
    startDate: String
    endDate: String
  ): [Schedule]
  bookingListByUserId(userId: ID): [Booking]
  genres: [Genre]
}

type Schedule {
  _id: ID
  date: DateTime
  seatGroups: [Class]
}

type BookedSchedule {
  _id: ID
  date: String
}

input ScheduleInput {
  _id: ID
  date: String
}

type Seat {
  _id: ID
  name: String
  status: String
  color: String
  class: String
}

input SeatInput {
  _id: ID
  name: String
  class: String
}

type User {
  _id: ID
  userName: String
}

type UserResult {
  result: Boolean
  user: User
}
Clone this wiki locally