Hi xpblaha,
Can you be a bit more precise,
Like where do you code,
What kind fo code do u use
etc.
With just a screenshot we can’t do anything
Kind regards,
Kristof.
Hello
I tried example of wix-booking-backend. I do not know where set up permisons
for using this API for wix-booking-backend
this is in file bookModule.jsw
import { bookings } from “wix-bookings-backend” ;
export function queryBookings ( ) {
return bookings
. queryBookings ()
. hasSome ( “status” , [ “PENDING_CHECKOUT” , “CONFIRMED” , “CANCELED” , “PENDING” , “PENDING_APPROVAL” , “DECLINED” ])
. find ()
. then (( queryResult ) => {
return queryResult . items ;
})
. catch (( error ) => {
return error ;
});
}
and this is in file booking.js
import wixData from ‘wix-data’ ;
import { bookings } from “wix-bookings-backend” ;
const g_options = {
suppressAuth : true
}
export async function buildTable ( data ) {
**try** {
**const** allBookings = **await** retrieveAllBookings ( data );
**return** allBookings ;
} **catch** ( error ) {
**throw new** Error ( 'fail to buildTable original error - ' + error . message );
}
}
// Get all bookings from start date to end date
async function retrieveAllBookings ( data ) {
let allItems = ;
**try** {
// Query to get the bookings by date
**let** results = **await** bookings . queryBookings ();
allItems = allItems . concat ( results . items );
// Check if there are more items that match the query and get them
**while** ( results . hasNext ()) {
results = **await** results . next ();
allItems = allItems . concat ( results . items );
}
// Filter the booking items by attended bookings only
**const** attendedBookings = allItems . filter ( book => {
**if** ( book . attendanceInfo ) {
**return** book . attendanceInfo . attendanceStatus == **true**
}
});
**return** attendedBookings ;
} **catch** ( error ) {
**throw new** Error ( 'fail to retrieveAllBookings original error - ' + error . message );
}
}
// Build the JSON of all staff members with session data
}