Merge pull request #3242 from connortechnology/fix_3232_api_monitor_event_summaries

Add Event_Summary model so that it is included in monitor listing
This commit is contained in:
Isaac Connor 2021-05-18 12:04:15 -04:00 committed by GitHub
commit 8506a2a75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,49 @@
<?php
App::uses('AppModel', 'Model');
/**
* Event_Summary Model
*
*/
class Event_Summary extends AppModel {
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'Event_Summaries';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'MonitorId';
/**
* Display field
*
* @var string
*/
public $displayField = 'MonitorId';
public $recursive = -1;
/**
* Validation rules
*
* @var array
*/
public $validate = array(
'MonitorId' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
}

View File

@ -134,6 +134,11 @@ class Monitor extends AppModel {
'className' => 'Monitor_Status', 'className' => 'Monitor_Status',
'foreignKey' => 'MonitorId', 'foreignKey' => 'MonitorId',
'joinTable' => 'Monitor_Status', 'joinTable' => 'Monitor_Status',
),
'Event_Summary' => array(
'className' => 'Event_Summary',
'foreignKey' => 'MonitorId',
'joinTable' => 'Event_Summaries',
) )
); );