Skip to content
Discussion options

You must be logged in to vote

Hi,

I’d usually keep it simple with three collections:

  • tradesmen (skills, timezone, capacity per slot)
  • availability (date, ranges of working hours, plus exceptions)
  • bookings (start/end times, job info)

When auto-assigning, you:

  1. Filter tradesmen by skill.
  2. Check availability for that date.
  3. Subtract existing bookings and exceptions from the ranges.
  4. Pick a free slot where bookedCount < capacity.

If you need speed, you can pre-generate discrete time slots (e.g. 15-min blocks) and just findOneAndUpdate with a condition on bookedCount, which makes the assignment atomic.

Everything stored in UTC, and convert back on display.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@sirajahmedx
Comment options

Answer selected by sirajahmedx
Comment options

You must be logged in to vote
1 reply
@sirajahmedx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Ask and answer questions about GitHub features and usage
3 participants