Returns an array of resources, slugs, and schedules that match the query.
The current page of resources, slugs, and schedules retrieved by the query.
The page size is defined by the limit()
function, can be retrieved using the pageSize
property, and
navigating through pages is done with the prev()
and
next()
functions.
When no items match the query, the array is empty.
import { resources } from "wix-bookings-backend";
// ...
resources
.queryResourceCatalog()
.find()
.then((results) => {
if (results.items.length > 0) {
let items = results.items; // see below
} else {
// handle case where no matching items found
}
})
.catch((error) => {
console.error(error);
});
/* items:
*
* [
* {
* "resource": {
* "_id": "2015d816-4ae1-4eb3-8f93-3c97441b5832",
* "name": "John Doe",
* "email": "john@doe.com",
* "phone": "555 4567",
* "description": "Fitness Instructor",
* "tags": [
* "staff"
* ],
* "scheduleIds": [
* "3ade521f-ba4e-4782-977c-0efe84e7c797"
* ],
* "status": "UPDATED"
* },
* "schedules": [
* {
* "availability": {
* "linkedSchedules": [],
* "start": "2021-01-01T06:00:00Z"
* },
* "_id": "3ade521f-ba4e-4782-977c-0efe84e7c797",
* "scheduleOwnerId": "2015d816-4ae1-4eb3-8f93-3c97441b5832"
* }
* ],
* "slugs": [
* {
* "_createdDate": "2021-04-12T11:49:50.416Z",
* "name": "john-doe-6"
* }
* ]
* },
* {
* "resource": {
* "_id": "290113d8-e525-4619-a154-b0c45110348f",
* "name": "Jack Brown",
* "email": "jbrown@test.com",
* "phone": "555 4321",
* "description": "Instructor",
* "tags": [
* "staff"
* ],
* "scheduleIds": [
* "95d8769e-ce74-4fe2-ab79-ab24e5c14e0e"
* ],
* "status": "UPDATED"
* },
* "schedules": [
* {
* "availability": {
* "linkedSchedules": [
* {
* "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17"
* }
* ],
* "start": "2021-04-18T07:22:42.274Z"
* },
* "_id": "95d8769e-ce74-4fe2-ab79-ab24e5c14e0e",
* "scheduleOwnerId": "290113d8-e525-4619-a154-b0c45110348f"
* }
* ],
* "slugs": [
* {
* "_createdDate": "2021-04-18T07:22:43.392Z",
* "name": "jack-brown"
* }
* ]
* },
* {
* "resource": {
* "_id": "4c17a7cc-c1d8-4fd1-aacd-0768df100b6d",
* "name": "Joe Blue",
* "email": "jb@gmail.com",
* "description": "Joe is a good guy",
* "tags": [
* "staff"
* ],
* "scheduleIds": [
* "d165e99c-bae4-4e6f-a064-7d4108902be0"
* ],
* "status": "UPDATED"
* },
* "schedules": [
* {
* "availability": {
* "linkedSchedules": [
* {
* "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17"
* }
* ],
* "start": "2021-03-24T16:08:16.832Z"
* },
* "_id": "d165e99c-bae4-4e6f-a064-7d4108902be0",
* "scheduleOwnerId": "4c17a7cc-c1d8-4fd1-aacd-0768df100b6d"
* }
* ],
* "slugs": [
* {
* "_createdDate": "2021-01-18T10:41:31.652Z",
* "name": "joe-blue"
* }
* ]
* },
* {
* "resource": {
* "_id": "b5147aad-f117-4f8e-90fe-d61043112c94",
* "name": "Joe Smith",
* "email": "js@s.com",
* "phone": "8888",
* "description": "",
* "tags": [
* "staff"
* ],
* "scheduleIds": [
* "892714a8-01f6-491c-b07c-89ae4f416dc0"
* ],
* "status": "UPDATED"
* },
* "schedules": [
* {
* "availability": {
* "linkedSchedules": [
* {
* "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17"
* }
* ],
* "start": "2021-01-01T06:00:00Z"
* },
* "_id": "892714a8-01f6-491c-b07c-89ae4f416dc0",
* "scheduleOwnerId": "b5147aad-f117-4f8e-90fe-d61043112c94"
* }
* ],
* "slugs": [
* {
* "_createdDate": "2021-01-25T18:10:42.682Z",
* "name": "joe-smith"
* }
* ]
* }
* ]
*/