4618 lines
88 KiB
JavaScript
4618 lines
88 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Gamepads = db.gamepads;
|
|
|
|
const DeviceProfiles = db.device_profiles;
|
|
|
|
const MassagePrograms = db.massage_programs;
|
|
|
|
const HapticPatterns = db.haptic_patterns;
|
|
|
|
const HapticSteps = db.haptic_steps;
|
|
|
|
const MassageSessions = db.massage_sessions;
|
|
|
|
const CalibrationRuns = db.calibration_runs;
|
|
|
|
const SafetyEvents = db.safety_events;
|
|
|
|
const UserPreferences = db.user_preferences;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const GamepadsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"display_name": "Xbox Wireless Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vendor": "Microsoft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product": "Xbox Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mapping": "standard",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"connection_type": "bluetooth",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supports_vibration": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"axes_count": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"buttons_count": 17,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Commonly used on Windows and macOS.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"display_name": "DualSense Wireless Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vendor": "Sony",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product": "PlayStation 5 Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mapping": "standard",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"connection_type": "usb",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supports_vibration": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"axes_count": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"buttons_count": 18,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Adaptive triggers not used; basic rumble supported.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"display_name": "Nintendo Switch Pro Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vendor": "Nintendo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product": "Switch Pro Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mapping": "standard",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"connection_type": "bluetooth",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supports_vibration": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"axes_count": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"buttons_count": 16,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Rumble intensity may vary by browser and OS.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"display_name": "8BitDo Pro 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vendor": "8BitDo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product": "Pro 2 Controller",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mapping": "standard",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"connection_type": "usb",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supports_vibration": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"axes_count": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"buttons_count": 16,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Supports multiple modes; use XInput when possible.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const DeviceProfilesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Office Quiet Mode",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Lower intensity for shared spaces.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain": 0.65,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain": 0.65,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_gain": 0.6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_duration_seconds": 900,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"deadzone": 0.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"intensity_curve": "ease_in",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Deep Relax Evening",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Slightly higher intensity with safety cutoff.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain": 0.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain": 0.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_gain": 0.85,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_duration_seconds": 1200,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"deadzone": 0.04,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"intensity_curve": "ease_in",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Left Motor Sensitive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Right motor reduced to prevent fatigue.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain": 0.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_gain": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_duration_seconds": 600,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"deadzone": 0.06,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"intensity_curve": "linear",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Creator Demo Profile",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Balanced intensity for livestream demos.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain": 0.8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain": 0.8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_gain": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_duration_seconds": 300,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"deadzone": 0.03,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"intensity_curve": "ease_in_out",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MassageProgramsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Gentle Wave",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Alternating left and right pulses with smooth ramps.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "public",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"category": "custom",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 600,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bpm": 58,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_intensity": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_bias": 0.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_bias": 0.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Deep Pulse",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Short strong pulses with recovery gaps.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "public",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"category": "focus_right",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 480,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bpm": 72,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_intensity": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_bias": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_bias": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Right Focus Reset",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Bias to right motor with gentle sustain.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "public",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"category": "pulsing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 420,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bpm": 52,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_intensity": 0.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_bias": -0.15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_bias": 0.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Breath Sync",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Slow rhythmic pattern suited for breathing exercises.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"category": "focus_left",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 900,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bpm": 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_intensity": 0.45,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_bias": 0.02,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_bias": 0.02,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const HapticPatternsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Wave Alternating 10m",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Timeline steps that alternate motors with ramps.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_type": "procedural",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 600000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_left_intensity": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_right_intensity": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"speed_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"loop_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_json": "{type:timeline,version:1,steps:12}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Deep Pulse 8m",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Procedural pulses with rest intervals.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_type": "procedural",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 480000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_left_intensity": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_right_intensity": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"speed_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"loop_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_json": "{type:procedural,version:1,pulse_ms:350,rest_ms:250}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Right Bias Sustain 7m",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Right motor emphasis with mild left support.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_type": "procedural",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 420000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_left_intensity": 0.35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_right_intensity": 0.65,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"speed_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"loop_enabled": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_json": "{type:timeline,version:1,steps:8}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Breath Sync 15m",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Slow swell pattern designed for relaxation.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_type": "procedural",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 900000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_left_intensity": 0.45,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_right_intensity": 0.45,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"speed_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"loop_enabled": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pattern_json": "{type:timeline,version:1,steps:10}",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const HapticStepsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence_index": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_offset_ms": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 20000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity": 0.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity": 0.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shape": "ramp_up",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_count": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_interval_ms": 0,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_offset_ms": 20000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 20000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity": 0.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity": 0.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shape": "sine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_count": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_interval_ms": 0,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence_index": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_offset_ms": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 350,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity": 0.85,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity": 0.85,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shape": "constant",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_count": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_interval_ms": 250,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence_index": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_offset_ms": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_ms": 60000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity": 0.3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shape": "constant",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_count": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"repeat_interval_ms": 0,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MassageSessionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"session_name": "Morning Reset",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-12T07:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-02-12T07:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "stopped",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stop_reason": "device_disconnected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_duration_seconds": 600,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_duration_seconds": 600,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_left_intensity": 0.48,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_right_intensity": 0.47,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_triggered": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Felt smooth and relaxing.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"session_name": "Quick Desk Break",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-11T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-02-11T15:08:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stop_reason": "safety_cutoff",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_duration_seconds": 480,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_duration_seconds": 480,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_left_intensity": 0.42,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_right_intensity": 0.43,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_triggered": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Used lower intensity to stay focused.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"session_name": "Livestream Demo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-10T20:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-02-10T20:35:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "aborted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stop_reason": "user_stop",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_duration_seconds": 300,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_duration_seconds": 285,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_left_intensity": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_right_intensity": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_triggered": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Stopped early after audience Q and A.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"session_name": "Right Shoulder Relief",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-09T22:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-02-09T22:12:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stop_reason": "safety_cutoff",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_duration_seconds": 420,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_duration_seconds": 420,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_left_intensity": 0.31,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"avg_right_intensity": 0.62,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"safety_cutoff_triggered": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Right motor bias felt appropriate.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CalibrationRunsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "DualSense Motor Test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-11T14:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-02-11T14:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mode": "latency_test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain_result": 0.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain_result": 0.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_latency_ms": 35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_notes": "Motors balanced; minor latency.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Xbox Intensity Sweep",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-10T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-02-10T08:06:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mode": "motor_test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain_result": 0.68,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain_result": 0.67,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_latency_ms": 28,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_notes": "Comfortable range found below 0.7 overall gain.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "8BitDo Balance Check",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-09T19:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-02-09T19:14:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mode": "latency_test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain_result": 0.8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain_result": 0.82,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_latency_ms": 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_notes": "Slightly stronger right motor; compensated in profile.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Switch Pro Latency Test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-02-08T21:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-02-08T21:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mode": "latency_test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_motor_gain_result": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_motor_gain_result": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_latency_ms": 55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_notes": "Bluetooth latency higher than expected.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SafetyEventsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-02-08T10:01:10Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "device_disconnected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "warning",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity_at_event": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity_at_event": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"elapsed_ms": 70000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Gamepad disconnected unexpectedly; vibration stopped immediately.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-02-08T10:01:11Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "device_disconnected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "info",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity_at_event": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity_at_event": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"elapsed_ms": 71000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Safety cutoff triggered after disconnect.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-02-10T20:34:45Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "device_disconnected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "info",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity_at_event": 0.72,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity_at_event": 0.72,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"elapsed_ms": 285000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Emergency stop activated by user during demo.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-02-11T15:04:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "over_duration",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"left_intensity_at_event": 0.42,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"right_intensity_at_event": 0.43,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"elapsed_ms": 240000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "User extended session beyond initial plan by 2 minutes.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const UserPreferencesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"theme": "system",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_view": "presets",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sound_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"haptics_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"confirm_before_stop": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quick_stop_hold_ms": 800,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_intensity": 0.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 600,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"theme": "system",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_view": "presets",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sound_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"haptics_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"confirm_before_stop": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quick_stop_hold_ms": 700,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_intensity": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 900,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"theme": "system",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_view": "presets",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sound_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"haptics_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"confirm_before_stop": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quick_stop_hold_ms": 600,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_intensity": 0.6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 420,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"theme": "system",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_view": "presets",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sound_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"haptics_enabled": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"confirm_before_stop": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quick_stop_hold_ms": 900,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_intensity": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_duration_seconds": 300,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDeviceProfileWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const DeviceProfile0 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (DeviceProfile0?.setUser)
|
|
{
|
|
await
|
|
DeviceProfile0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const DeviceProfile1 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (DeviceProfile1?.setUser)
|
|
{
|
|
await
|
|
DeviceProfile1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const DeviceProfile2 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (DeviceProfile2?.setUser)
|
|
{
|
|
await
|
|
DeviceProfile2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const DeviceProfile3 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (DeviceProfile3?.setUser)
|
|
{
|
|
await
|
|
DeviceProfile3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateDeviceProfileWithGamepad() {
|
|
|
|
const relatedGamepad0 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const DeviceProfile0 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (DeviceProfile0?.setGamepad)
|
|
{
|
|
await
|
|
DeviceProfile0.
|
|
setGamepad(relatedGamepad0);
|
|
}
|
|
|
|
const relatedGamepad1 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const DeviceProfile1 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (DeviceProfile1?.setGamepad)
|
|
{
|
|
await
|
|
DeviceProfile1.
|
|
setGamepad(relatedGamepad1);
|
|
}
|
|
|
|
const relatedGamepad2 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const DeviceProfile2 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (DeviceProfile2?.setGamepad)
|
|
{
|
|
await
|
|
DeviceProfile2.
|
|
setGamepad(relatedGamepad2);
|
|
}
|
|
|
|
const relatedGamepad3 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const DeviceProfile3 = await DeviceProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (DeviceProfile3?.setGamepad)
|
|
{
|
|
await
|
|
DeviceProfile3.
|
|
setGamepad(relatedGamepad3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMassageProgramWithAuthor() {
|
|
|
|
const relatedAuthor0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageProgram0 = await MassagePrograms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MassageProgram0?.setAuthor)
|
|
{
|
|
await
|
|
MassageProgram0.
|
|
setAuthor(relatedAuthor0);
|
|
}
|
|
|
|
const relatedAuthor1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageProgram1 = await MassagePrograms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MassageProgram1?.setAuthor)
|
|
{
|
|
await
|
|
MassageProgram1.
|
|
setAuthor(relatedAuthor1);
|
|
}
|
|
|
|
const relatedAuthor2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageProgram2 = await MassagePrograms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MassageProgram2?.setAuthor)
|
|
{
|
|
await
|
|
MassageProgram2.
|
|
setAuthor(relatedAuthor2);
|
|
}
|
|
|
|
const relatedAuthor3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageProgram3 = await MassagePrograms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MassageProgram3?.setAuthor)
|
|
{
|
|
await
|
|
MassageProgram3.
|
|
setAuthor(relatedAuthor3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateHapticPatternWithOwner() {
|
|
|
|
const relatedOwner0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const HapticPattern0 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (HapticPattern0?.setOwner)
|
|
{
|
|
await
|
|
HapticPattern0.
|
|
setOwner(relatedOwner0);
|
|
}
|
|
|
|
const relatedOwner1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const HapticPattern1 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (HapticPattern1?.setOwner)
|
|
{
|
|
await
|
|
HapticPattern1.
|
|
setOwner(relatedOwner1);
|
|
}
|
|
|
|
const relatedOwner2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const HapticPattern2 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (HapticPattern2?.setOwner)
|
|
{
|
|
await
|
|
HapticPattern2.
|
|
setOwner(relatedOwner2);
|
|
}
|
|
|
|
const relatedOwner3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const HapticPattern3 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (HapticPattern3?.setOwner)
|
|
{
|
|
await
|
|
HapticPattern3.
|
|
setOwner(relatedOwner3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateHapticPatternWithProgram() {
|
|
|
|
const relatedProgram0 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const HapticPattern0 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (HapticPattern0?.setProgram)
|
|
{
|
|
await
|
|
HapticPattern0.
|
|
setProgram(relatedProgram0);
|
|
}
|
|
|
|
const relatedProgram1 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const HapticPattern1 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (HapticPattern1?.setProgram)
|
|
{
|
|
await
|
|
HapticPattern1.
|
|
setProgram(relatedProgram1);
|
|
}
|
|
|
|
const relatedProgram2 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const HapticPattern2 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (HapticPattern2?.setProgram)
|
|
{
|
|
await
|
|
HapticPattern2.
|
|
setProgram(relatedProgram2);
|
|
}
|
|
|
|
const relatedProgram3 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const HapticPattern3 = await HapticPatterns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (HapticPattern3?.setProgram)
|
|
{
|
|
await
|
|
HapticPattern3.
|
|
setProgram(relatedProgram3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateHapticStepWithPattern() {
|
|
|
|
const relatedPattern0 = await HapticPatterns.findOne({
|
|
offset: Math.floor(Math.random() * (await HapticPatterns.count())),
|
|
});
|
|
const HapticStep0 = await HapticSteps.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (HapticStep0?.setPattern)
|
|
{
|
|
await
|
|
HapticStep0.
|
|
setPattern(relatedPattern0);
|
|
}
|
|
|
|
const relatedPattern1 = await HapticPatterns.findOne({
|
|
offset: Math.floor(Math.random() * (await HapticPatterns.count())),
|
|
});
|
|
const HapticStep1 = await HapticSteps.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (HapticStep1?.setPattern)
|
|
{
|
|
await
|
|
HapticStep1.
|
|
setPattern(relatedPattern1);
|
|
}
|
|
|
|
const relatedPattern2 = await HapticPatterns.findOne({
|
|
offset: Math.floor(Math.random() * (await HapticPatterns.count())),
|
|
});
|
|
const HapticStep2 = await HapticSteps.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (HapticStep2?.setPattern)
|
|
{
|
|
await
|
|
HapticStep2.
|
|
setPattern(relatedPattern2);
|
|
}
|
|
|
|
const relatedPattern3 = await HapticPatterns.findOne({
|
|
offset: Math.floor(Math.random() * (await HapticPatterns.count())),
|
|
});
|
|
const HapticStep3 = await HapticSteps.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (HapticStep3?.setPattern)
|
|
{
|
|
await
|
|
HapticStep3.
|
|
setPattern(relatedPattern3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMassageSessionWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageSession0 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MassageSession0?.setUser)
|
|
{
|
|
await
|
|
MassageSession0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageSession1 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MassageSession1?.setUser)
|
|
{
|
|
await
|
|
MassageSession1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageSession2 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MassageSession2?.setUser)
|
|
{
|
|
await
|
|
MassageSession2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MassageSession3 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MassageSession3?.setUser)
|
|
{
|
|
await
|
|
MassageSession3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMassageSessionWithProgram() {
|
|
|
|
const relatedProgram0 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const MassageSession0 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MassageSession0?.setProgram)
|
|
{
|
|
await
|
|
MassageSession0.
|
|
setProgram(relatedProgram0);
|
|
}
|
|
|
|
const relatedProgram1 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const MassageSession1 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MassageSession1?.setProgram)
|
|
{
|
|
await
|
|
MassageSession1.
|
|
setProgram(relatedProgram1);
|
|
}
|
|
|
|
const relatedProgram2 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const MassageSession2 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MassageSession2?.setProgram)
|
|
{
|
|
await
|
|
MassageSession2.
|
|
setProgram(relatedProgram2);
|
|
}
|
|
|
|
const relatedProgram3 = await MassagePrograms.findOne({
|
|
offset: Math.floor(Math.random() * (await MassagePrograms.count())),
|
|
});
|
|
const MassageSession3 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MassageSession3?.setProgram)
|
|
{
|
|
await
|
|
MassageSession3.
|
|
setProgram(relatedProgram3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMassageSessionWithDevice_profile() {
|
|
|
|
const relatedDevice_profile0 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const MassageSession0 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MassageSession0?.setDevice_profile)
|
|
{
|
|
await
|
|
MassageSession0.
|
|
setDevice_profile(relatedDevice_profile0);
|
|
}
|
|
|
|
const relatedDevice_profile1 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const MassageSession1 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MassageSession1?.setDevice_profile)
|
|
{
|
|
await
|
|
MassageSession1.
|
|
setDevice_profile(relatedDevice_profile1);
|
|
}
|
|
|
|
const relatedDevice_profile2 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const MassageSession2 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MassageSession2?.setDevice_profile)
|
|
{
|
|
await
|
|
MassageSession2.
|
|
setDevice_profile(relatedDevice_profile2);
|
|
}
|
|
|
|
const relatedDevice_profile3 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const MassageSession3 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MassageSession3?.setDevice_profile)
|
|
{
|
|
await
|
|
MassageSession3.
|
|
setDevice_profile(relatedDevice_profile3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMassageSessionWithGamepad() {
|
|
|
|
const relatedGamepad0 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const MassageSession0 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MassageSession0?.setGamepad)
|
|
{
|
|
await
|
|
MassageSession0.
|
|
setGamepad(relatedGamepad0);
|
|
}
|
|
|
|
const relatedGamepad1 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const MassageSession1 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MassageSession1?.setGamepad)
|
|
{
|
|
await
|
|
MassageSession1.
|
|
setGamepad(relatedGamepad1);
|
|
}
|
|
|
|
const relatedGamepad2 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const MassageSession2 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MassageSession2?.setGamepad)
|
|
{
|
|
await
|
|
MassageSession2.
|
|
setGamepad(relatedGamepad2);
|
|
}
|
|
|
|
const relatedGamepad3 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const MassageSession3 = await MassageSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MassageSession3?.setGamepad)
|
|
{
|
|
await
|
|
MassageSession3.
|
|
setGamepad(relatedGamepad3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCalibrationRunWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CalibrationRun0 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CalibrationRun0?.setUser)
|
|
{
|
|
await
|
|
CalibrationRun0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CalibrationRun1 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CalibrationRun1?.setUser)
|
|
{
|
|
await
|
|
CalibrationRun1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CalibrationRun2 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CalibrationRun2?.setUser)
|
|
{
|
|
await
|
|
CalibrationRun2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CalibrationRun3 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CalibrationRun3?.setUser)
|
|
{
|
|
await
|
|
CalibrationRun3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateCalibrationRunWithGamepad() {
|
|
|
|
const relatedGamepad0 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const CalibrationRun0 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CalibrationRun0?.setGamepad)
|
|
{
|
|
await
|
|
CalibrationRun0.
|
|
setGamepad(relatedGamepad0);
|
|
}
|
|
|
|
const relatedGamepad1 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const CalibrationRun1 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CalibrationRun1?.setGamepad)
|
|
{
|
|
await
|
|
CalibrationRun1.
|
|
setGamepad(relatedGamepad1);
|
|
}
|
|
|
|
const relatedGamepad2 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const CalibrationRun2 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CalibrationRun2?.setGamepad)
|
|
{
|
|
await
|
|
CalibrationRun2.
|
|
setGamepad(relatedGamepad2);
|
|
}
|
|
|
|
const relatedGamepad3 = await Gamepads.findOne({
|
|
offset: Math.floor(Math.random() * (await Gamepads.count())),
|
|
});
|
|
const CalibrationRun3 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CalibrationRun3?.setGamepad)
|
|
{
|
|
await
|
|
CalibrationRun3.
|
|
setGamepad(relatedGamepad3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateCalibrationRunWithDevice_profile() {
|
|
|
|
const relatedDevice_profile0 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const CalibrationRun0 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CalibrationRun0?.setDevice_profile)
|
|
{
|
|
await
|
|
CalibrationRun0.
|
|
setDevice_profile(relatedDevice_profile0);
|
|
}
|
|
|
|
const relatedDevice_profile1 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const CalibrationRun1 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CalibrationRun1?.setDevice_profile)
|
|
{
|
|
await
|
|
CalibrationRun1.
|
|
setDevice_profile(relatedDevice_profile1);
|
|
}
|
|
|
|
const relatedDevice_profile2 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const CalibrationRun2 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CalibrationRun2?.setDevice_profile)
|
|
{
|
|
await
|
|
CalibrationRun2.
|
|
setDevice_profile(relatedDevice_profile2);
|
|
}
|
|
|
|
const relatedDevice_profile3 = await DeviceProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await DeviceProfiles.count())),
|
|
});
|
|
const CalibrationRun3 = await CalibrationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CalibrationRun3?.setDevice_profile)
|
|
{
|
|
await
|
|
CalibrationRun3.
|
|
setDevice_profile(relatedDevice_profile3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSafetyEventWithSession() {
|
|
|
|
const relatedSession0 = await MassageSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await MassageSessions.count())),
|
|
});
|
|
const SafetyEvent0 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SafetyEvent0?.setSession)
|
|
{
|
|
await
|
|
SafetyEvent0.
|
|
setSession(relatedSession0);
|
|
}
|
|
|
|
const relatedSession1 = await MassageSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await MassageSessions.count())),
|
|
});
|
|
const SafetyEvent1 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SafetyEvent1?.setSession)
|
|
{
|
|
await
|
|
SafetyEvent1.
|
|
setSession(relatedSession1);
|
|
}
|
|
|
|
const relatedSession2 = await MassageSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await MassageSessions.count())),
|
|
});
|
|
const SafetyEvent2 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SafetyEvent2?.setSession)
|
|
{
|
|
await
|
|
SafetyEvent2.
|
|
setSession(relatedSession2);
|
|
}
|
|
|
|
const relatedSession3 = await MassageSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await MassageSessions.count())),
|
|
});
|
|
const SafetyEvent3 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (SafetyEvent3?.setSession)
|
|
{
|
|
await
|
|
SafetyEvent3.
|
|
setSession(relatedSession3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateSafetyEventWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SafetyEvent0 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SafetyEvent0?.setUser)
|
|
{
|
|
await
|
|
SafetyEvent0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SafetyEvent1 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SafetyEvent1?.setUser)
|
|
{
|
|
await
|
|
SafetyEvent1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SafetyEvent2 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SafetyEvent2?.setUser)
|
|
{
|
|
await
|
|
SafetyEvent2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SafetyEvent3 = await SafetyEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (SafetyEvent3?.setUser)
|
|
{
|
|
await
|
|
SafetyEvent3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateUserPreferenceWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPreference0 = await UserPreferences.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (UserPreference0?.setUser)
|
|
{
|
|
await
|
|
UserPreference0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPreference1 = await UserPreferences.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (UserPreference1?.setUser)
|
|
{
|
|
await
|
|
UserPreference1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPreference2 = await UserPreferences.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (UserPreference2?.setUser)
|
|
{
|
|
await
|
|
UserPreference2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPreference3 = await UserPreferences.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (UserPreference3?.setUser)
|
|
{
|
|
await
|
|
UserPreference3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Gamepads.bulkCreate(GamepadsData);
|
|
|
|
|
|
|
|
|
|
await DeviceProfiles.bulkCreate(DeviceProfilesData);
|
|
|
|
|
|
|
|
|
|
await MassagePrograms.bulkCreate(MassageProgramsData);
|
|
|
|
|
|
|
|
|
|
await HapticPatterns.bulkCreate(HapticPatternsData);
|
|
|
|
|
|
|
|
|
|
await HapticSteps.bulkCreate(HapticStepsData);
|
|
|
|
|
|
|
|
|
|
await MassageSessions.bulkCreate(MassageSessionsData);
|
|
|
|
|
|
|
|
|
|
await CalibrationRuns.bulkCreate(CalibrationRunsData);
|
|
|
|
|
|
|
|
|
|
await SafetyEvents.bulkCreate(SafetyEventsData);
|
|
|
|
|
|
|
|
|
|
await UserPreferences.bulkCreate(UserPreferencesData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDeviceProfileWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateDeviceProfileWithGamepad(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMassageProgramWithAuthor(),
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateHapticPatternWithOwner(),
|
|
|
|
|
|
|
|
|
|
await associateHapticPatternWithProgram(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateHapticStepWithPattern(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMassageSessionWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateMassageSessionWithProgram(),
|
|
|
|
|
|
|
|
|
|
await associateMassageSessionWithDevice_profile(),
|
|
|
|
|
|
|
|
|
|
await associateMassageSessionWithGamepad(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCalibrationRunWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateCalibrationRunWithGamepad(),
|
|
|
|
|
|
|
|
|
|
await associateCalibrationRunWithDevice_profile(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSafetyEventWithSession(),
|
|
|
|
|
|
|
|
|
|
await associateSafetyEventWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateUserPreferenceWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('gamepads', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('device_profiles', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('massage_programs', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('haptic_patterns', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('haptic_steps', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('massage_sessions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('calibration_runs', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('safety_events', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('user_preferences', null, {});
|
|
|
|
|
|
},
|
|
}; |