diff --git a/server/controllers/system/init-settings.php b/server/controllers/system/init-settings.php index f03960c8..e4d81831 100644 --- a/server/controllers/system/init-settings.php +++ b/server/controllers/system/init-settings.php @@ -15,6 +15,7 @@ class InitSettingsController extends Controller { $this->storeGlobalSettings(); $this->storeMailTemplates(); $this->storeMockedDepartments(); + $this->createMockedStaff(); Response::respondSuccess(); } else { @@ -80,4 +81,18 @@ class InitSettingsController extends Controller { $department->store(); } } + + private function createMockedStaff() { + $staff = new Staff(); + $staff->setProperties([ + 'name' => 'Emilia Clarke', + 'email' => 'staff@opensupports.com', + 'password' => Hashing::hashPassword('staff'), + 'profilePic' => 'http://i65.tinypic.com/9bep95.jpg', + 'level' => 1, + 'sharedDepartmentList' => Department::getAllDepartments(), + 'sharedTicketList' => [] + ]); + $staff->store(); + } } \ No newline at end of file diff --git a/server/models/Department.php b/server/models/Department.php index a019bc77..f2c93407 100644 --- a/server/models/Department.php +++ b/server/models/Department.php @@ -21,4 +21,15 @@ class Department extends DataStore { return $departmentsNameList; } + + public static function getAllDepartments() { + $departmentsQuantity = RedBean::count(Department::TABLE); + $departmentList = new DataStoreList(); + + for ($departmentIndex = 1; $departmentIndex <= $departmentsQuantity; ++$departmentIndex) { + $departmentList->add(Department::getDataStore($departmentIndex)); + } + + return $departmentList; + } } \ No newline at end of file diff --git a/server/models/Staff.php b/server/models/Staff.php new file mode 100644 index 00000000..1f5b7084 --- /dev/null +++ b/server/models/Staff.php @@ -0,0 +1,28 @@ + 1 + ]; + } + + public static function getUser($value, $property = 'id') { + return parent::getDataStore($value, $property); + } +}