Updated machineDefault/getState but [NOT FINISHED]
This commit is contained in:
parent
e208dade95
commit
ad13cf0f6e
|
@ -28,7 +28,7 @@
|
||||||
/* [1] Creation de l'utilisateur
|
/* [1] Creation de l'utilisateur
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$create_entry = new Repo('history/create', [
|
$create_entry = new Repo('history/create', [
|
||||||
$id_entry,
|
$id_user,
|
||||||
$id_machine,
|
$id_machine,
|
||||||
$id_action,
|
$id_action,
|
||||||
$timestamp
|
$timestamp
|
||||||
|
|
|
@ -404,6 +404,12 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (4) STARTED (last state)
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
if( count($history) > 0 && $history[0]['id_action'] == $action['start'] )
|
||||||
|
return [ 'state' => 'started' ];
|
||||||
|
|
||||||
|
|
||||||
/* (5) DETACHED (no state)
|
/* (5) DETACHED (no state)
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
return [ 'state' => 'detached' ];
|
return [ 'state' => 'detached' ];
|
||||||
|
|
|
@ -41,11 +41,11 @@
|
||||||
$check_history = self::getByTimestamp($timestamp);
|
$check_history = self::getByTimestamp($timestamp);
|
||||||
|
|
||||||
// Si on trouve pas, erreur
|
// Si on trouve pas, erreur
|
||||||
if( $check_history === false )
|
if( count($check_history) < 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Sinon, on retourne son id
|
// Sinon, on retourne son id
|
||||||
return $check_history['id_history'];
|
return $check_history[0]['id_history'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,17 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"historyDefault": {
|
"historyDefault": {
|
||||||
|
"POST::create": {
|
||||||
|
"description": "Retourne l'historique complet",
|
||||||
|
"permissions": ["warehouse", "admin"],
|
||||||
|
"parameters": {
|
||||||
|
"id_machine": { "description": "Machine UID", "type": "id" },
|
||||||
|
"id_user": { "description": "User UID", "type": "id" },
|
||||||
|
"id_action": { "description": "Action UID", "type": "id" },
|
||||||
|
"timestamp": { "description": "timestamp", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {}
|
||||||
|
},
|
||||||
"POST::getAll": {
|
"POST::getAll": {
|
||||||
"description": "Retourne l'historique complet",
|
"description": "Retourne l'historique complet",
|
||||||
"permissions": ["warehouse", "admin"],
|
"permissions": ["warehouse", "admin"],
|
||||||
|
|
Loading…
Reference in New Issue