-
All the query have pagination, you can use
page
andlimit
as input to get data -
Use
login
first for authentication
mutation login {
User {
login(input: {
email: "admin@techvify.com"
password: "admin@123"
}) {
userId
token
}
}
}
Create user specify accessID
to 2
for User or 3
for Admin
-
Create User need authentication or API will return
access denied
-
Add below section in header
{
"Authorization": "token_admin_here"
}
mutation createUser {
User {
createUser(input:{
email:"john.techvify@gmail.com"
password: "123@abc123" # min 8 characters
accessID: 3 # 2: User, 3: Admin
})
}
}
When customer want to register, they need to provide email
, password
, customerName
, address
, phoneNumber
, identifyNumber
, dateOfBirth
mutation registerCustomer {
User {
registerCustomer(input: {
email: "john.techvify@gmail.com",
password: "123@abc123", # min 8 characters
customerName: "John Tran",
address:"Ha Noi",
phoneNumber: "0195364958", # min 10 characters
identifyNumber: "7vc12531",
dateOfBirth: "2000-01-02T15:04:05Z"
}) {
data {
id
customerID
}
token
}
}
}
Query User using for Admin
- Query User need authentication or API will return
access denied
- Add below section in header
{
"Authorization": "token_admin_here"
}
query queryUser{
User {
users(page: 1, limit: 5) {
data{
id
email
password
customer{
id
name
email
address
phoneNumber
identifyNumber
dateOfBirth
memberCode
createdAt
updatedAt
}
accessType {
id
name
createdAt
updatedAt
}
createdAt
updatedAt
}
page
limit
total
}
}
}
Login for everyone
mutation login {
User {
login(input: {
email: "john.techvify@gmail.com"
password: "123@abc123"
}) {
userId
token
}
}
}
For customer change password, they need to provide oldPassword
and newPassword
-
changePassword need authentication or API will return
access denied
-
Add below section in header
{
"Authorization": "token_user_here"
}
mutation changePassword {
Customer {
changePassword(input: {
oldPassword: "123123123",
newPassword: "321321321"
})
}
}
For Customer Update their information, they need to provide email
, name
, address
, phoneNumber
, identifyNumber
, dateOfBirth
-
update customer need authentication or API will return
access denied
-
Add below section in header
{
"Authorization": "token_user_here"
}
mutation updateCustomer {
Customer {
updateCustomer(input: {
email: "john.techvify@gmail.com",
name: "any",
address: "any",
phoneNumber: "min 10 characters"
identifyNumber: "123123123", # max 12 characters
dateOfBirth: "2002-01-02T15:04:05Z",
})
}
}
Using for Admin
- queryCustomer need authentication or API will return
access denied
- Add below section in header
{
"Authorization": "token_admin_here"
}
query queryCustomer {
Customer {
customers(page: 1, limit: 5) {
data {
id
name
email
address
phoneNumber
identifyNumber
dateOfBirth
memberCode
createdAt
updatedAt
}
page
limit
total
}
}
}
For Admin create flight, they need to provide name
, from
, to
, departureDate
, arrivalDate
, available_first_slot
, available_economy_slot
, status
- createFlight need authentication or API will return
access denied
- Add below section in header
{
"Authorization": "token_admin_here"
}
mutation createFlight {
Flight {
createFlight(input: {
name: "112",
from: "HN"
to: "SGN"
departureDate:"2023-05-20T13:50:20+07:00",
arrivalDate: "2023-05-22T06:00:20.720717Z",
available_first_slot: 30,
available_economy_slot: 70,
status: "Available", # Cancel, Available, Arrived
})
}
}
For Admin update flight, they need to provide name
, departureDate
, arrivalDate
, available_first_slot
, available_economy_slot
, status
-
For status:
Cancel
,Available
,Arrived
-
If the flight was marked as
Cancel
orArrived
before, it can not be updated -
updateFlight need authentication or API will return
access denied
-
Add below section in header
{
"Authorization": "token_admin_here"
}
mutation updateFlight {
Flight {
updateFlight(id: 442944984, input: {
name:"113"
departureDate: "2023-06-08T03:31:20.720717Z"
arrivalDate: "2023-06-08T03:31:20.720717Z"
available_first_slot: 30,
available_economy_slot: 70,
status: "Cancel" # Cancel, Available, Arrived
})
}
}
For Customer cancel booking, they need to provide bookingCode
For Guest booking, it will return call airline for cancel booking
-
cancelBooking need authentication or API will return
access denied
-
Add below section in header
{
"Authorization": "token_user_here"
}
mutation cancelBooking {
Booking {
cancelBooking(input: {bookingCode: "4283XS"}) {
code
data {
bookingCode
cancelDate
customerId
flightId
status
}
}
}
}
- If guest booking with no login, they need to provide
flight name
,email
,phone number
,name
,address
,date of birth
,identify number
,ticket type
mutation createBooking {
Booking {
createBooking(input:{
flightName: "1345"
email: "john.techvify@gmail.com"
phoneNumber: "012345677"
name: "nvl"
address: "Ha Noi"
dateOfBirth: "2023-04-08T03:31:20+07:00"
identifyNumber: "u2c22c2ccc"
ticketType: 1
}) {
code
data {
bookingCode
bookingDate
customerId
flightId
status
}
}
}
}
- If user booking, only
flight name
andticket type
needed
{
"Authorization": "token_user_here"
}
mutation createBooking {
Booking {
createBooking(input:{
flightName: "1345"
# email: "john.techvify@gmail.com"
# phoneNumber: "012345677"
# name: "nvl"
# address: "Ha Noi"
# dateOfBirth: "2023-04-08T03:31:20+07:00"
# identifyNumber: "u2c22c2ccc"
ticketType: 1
}) {
code
data {
bookingCode
bookingDate
customerId
flightId
status
}
}
}
}
-
viewBooking show booking which booked by guest
-
booking code
andidentify number
is required -
if identify number not match with booking, it will return
identify number not match
query viewBooking {
Booking {
viewBooking(bookingCode: "R87Q26", identifyNumber: "13512331"){
code
data {
bookingCode
bookingDate
bookingStatus
customer {
id
name
email
address
phoneNumber
memberCode
}
flight {
id
name
from
to
departureDate
arrivalDate
}
}
}
}
}
-
bookingHistory show booking history which booked by user
-
bookingHistory need authentication or API will return
access denied
{
"Authorization": "token_user_here"
}
query bookingHistory {
Booking {
bookingHistory(page: 1, limit: 5) {
code
data {
bookingCode
bookingDate
bookingStatus
customer {
id
name
email
address
phoneNumber
memberCode
}
flight {
id
name
from
to
departureDate
arrivalDate
status
}
}
page
limit
total
}
}
}
For everyone search flight, they need to provide from
, to
, departureDate
, ticketType
- searchFlight show flight which match with
from
,to
, and betweendepartureDate
,ticketType
query searchFlight {
Flight {
searchFlights(
page: 1
limit: 5
input: {
from: "HN"
to: "SGN"
arrivalDate: "2023-05-20T13:50:20+07:00"
departureDate: "2023-05-22T13:50:20+07:00"
}) {
data {
id
name
from
to
departureDate
arrivalDate
available_first_slot
available_economy_slot
status
}
page
limit
total
}
}
}
For admin query flight
-
queryFlight show all flight
-
queryFlight need authentication or API will return
access denied
query queryFlights {
Flight {
flights(page: 1, limit: 20) {
data {
id
name
from
to
departureDate
arrivalDate
available_first_slot
available_economy_slot
status
createdAt
updatedAt
}
page
limit
total
}
}
}
For Admin change admin account password
- updatePassword need authentication of admin or API will return
access denied
{
"Authorization": "token_admin_here"
}
mutation updateUserPassword {
User {
updateUserPassword(input: {
oldPassword: "123123123"
password: "321321321"
})
}
}