top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
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 }