UNPKG

@kadconsulting/dry

Version:
65 lines 2.61 kB
// @ts-nocheck export function createMockSchedule(numberOfRecords) { // Helper function to create a random timestamp function randomTimestamp() { const randomDate = new Date(Date.now() - Math.floor(Math.random() * 10000000000)); return randomDate.toISOString(); } // Helper function to create a calendar function createCalendar(name) { return { id: Math.floor(Math.random() * 1000), createdAt: randomTimestamp(), updatedAt: randomTimestamp(), name, startHoursOfOperation: '08:00:00', endHoursOfOperation: '20:00:00', }; } // Function to create multiple records of a given type function createMultipleRecords(creator) { return Array.from({ length: numberOfRecords }, creator); } // Individual record creators for each entity type const createSimBay = () => ({ id: Math.floor(Math.random() * 1000), name: `Simulator ${Math.floor(Math.random() * 1000)}`, createdAt: randomTimestamp(), updatedAt: randomTimestamp(), publishedAt: randomTimestamp(), calendar: createCalendar('Simulator Bay Calendar'), times: Array.from({ length: 5 }, randomTimestamp), }); const createCoach = () => ({ id: Math.floor(Math.random() * 1000), fullName: `Coach ${Math.floor(Math.random() * 1000)}`, createdAt: randomTimestamp(), updatedAt: randomTimestamp(), publishedAt: randomTimestamp(), title: null, yearsOfExperience: null, calendar: createCalendar('Coach Calendar'), times: Array.from({ length: 5 }, randomTimestamp), }); const createLocation = () => ({ id: Math.floor(Math.random() * 1000), title: `Location ${Math.floor(Math.random() * 1000)}`, phoneNumber: '123-456-7890', email: 'email@example.com', slug: `location-${Math.floor(Math.random() * 1000)}`, createdAt: randomTimestamp(), updatedAt: randomTimestamp(), publishedAt: randomTimestamp(), calendar: createCalendar('Location Calendar'), times: Array.from({ length: 5 }, randomTimestamp), }); // Create the full schedule with specified number of records const schedule = { day: randomTimestamp(), simBays: createMultipleRecords(createSimBay), coachAvailability: createMultipleRecords(createCoach), locationAvailability: createLocation(), // Assuming only one location needed }; return schedule; } //# sourceMappingURL=createMockSchedule.js.map