alextselegidis / easyappointments

:date: Easy!Appointments - Self Hosted Appointment Scheduler
https://easyappointments.org
GNU General Public License v3.0
3.35k stars 1.28k forks source link

Add support for month based availability generation on the availabilities API. #1282

Open gabrielfin opened 2 years ago

gabrielfin commented 2 years ago

Currently, the /availabilities endpoint only returns the available hour slots for a specific date. I would like to submit a PR that adds a new endpoint that would return the days with availabilities for a certain month or date range. Something like:

/availabilities/dates?month=2022-07&providerId=xx&serviceId=xx

which returns either an array of available dates:

["2022-07-05", "2022-07-14", "2022-07-22"]

or perhaps an array of dates and slots:

[
   {
      date: "2022-07-05",
      hours: ["08:00", "11:30", "15:00"]
   },
   {
      date: "2022-07-14",
      hours: ["09:30", "11:30"]
   },
]

Would that be OK?

alextselegidis commented 2 years ago

Hello!

This sounds like a good idea, but please consider the following:

[
  "2022-07-01": [
    "08:00",
    "09:00"
  ],
  "2022-07-02": [
    "08:00",
    "09:00"
  ],
  ... 
]

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

gabrielfin commented 2 years ago

Change the endpoint to /api/v1/availabilities?date=2022-07&providerId=&serviceId=

Do you mean I should replace the current existing endpoint? Because /api/v1/availabilities already exists. Or you just meant that the new endpoint should begin with /api/v1/?

alextselegidis commented 2 years ago

Hello!

Sorry, I accidentally skipped this one.

Do you mean I should replace the current existing endpoint?

Yes, I'd say for simplicity's sake, that we use the same endpoint without specifying and exact date.

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!