1.0.3 • Published 7 months ago

@wishcbg/bob-appointment-time-package v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

BOB 專案其他預約預約時間計算

Example

const { ReverseAppointmentTime } = require('./dist/index.js')

const reverseAppointmentTime = new ReverseAppointmentTime([
  {
    id: '20d3e2fe-f19d-453a-9c2c-f17d35906c09',
    name: 't',
    AppointmentServices: [
      {
        id: '38e218cc-2700-43b8-aafa-b88ef6653dd5',
        name: 's',
        enableSubService: true,
        bookingTime: 30,
        AppointmentSubServices: [
          {
            id: 'ad29656e-e8c8-4e38-bcd5-fa8caecc6a7c',
            name: '美甲2.0',
            bookingTime: 120,
            allAppointmentUnit: false,
            AppointmentUnits: [],
          },
        ],
        AppointmentUnits: [
          {
            id: 'a09aea30-5246-4449-b675-91da46e855a3',
          },
          {
            id: '536a7ed9-61e6-4ceb-9a99-13d8072c6196',
          },
        ],
      },
      {
        id: '11842444-eb9e-43b7-b5d9-1ff2bc8def3a',
        name: '美甲2.0(有子服務)',
        enableSubService: true,
        bookingTime: 60,
        AppointmentSubServices: [
          {
            id: '48159855-6a8b-420d-888b-dde0ceef3f09',
            name: '只要美甲1',
            bookingTime: 180,
            allAppointmentUnit: true,
            AppointmentUnits: [
              {
                id: '536a7ed9-61e6-4ceb-9a99-13d8072c6196',
              },
              {
                id: 'a09aea30-5246-4449-b675-91da46e855a3',
              },
            ],
          },
        ],
        AppointmentUnits: [
          {
            id: 'a09aea30-5246-4449-b675-91da46e855a3',
          },
          {
            id: '536a7ed9-61e6-4ceb-9a99-13d8072c6196',
          },
        ],
      },
    ],
  },
], [
  {
    appointmentUnitId: 'a09aea30-5246-4449-b675-91da46e855a3',
    availableBookingTime: 220,
  },
  {
    appointmentUnitId: '536a7ed9-61e6-4ceb-9a99-13d8072c6196',
    availableBookingTime: 120,
  },
])

console.log('checkAppointmentCategories', reverseAppointmentTime.checkAppointmentCategories(['20d3e2fe-f19d-453a-9c2c-f17d35906c09']))
console.log('checkAppointmentServices', reverseAppointmentTime.checkAppointmentServices(['38e218cc-2700-43b8-aafa-b88ef6653dd5', '11842444-eb9e-43b7-b5d9-1ff2bc8def3a']))
console.log('checkAppointmentSubServices', reverseAppointmentTime.checkAppointmentSubServices(['48159855-6a8b-420d-888b-dde0ceef3f09']))

console.log('getUnitAvailableBookingTimeByAppointmentServiceId', reverseAppointmentTime.getUnitAvailableBookingTimeByAppointmentServiceId('38e218cc-2700-43b8-aafa-b88ef6653dd5'))
console.log('getUnitAvailableBookingTimeByAppointmentSubServiceId', reverseAppointmentTime.getUnitAvailableBookingTimeByAppointmentSubServiceId('48159855-6a8b-420d-888b-dde0ceef3f09'))
1.0.3

7 months ago