PM-1762 "HTTP status code will be set to 200 no coincide..." SOLVED

Issue:
    - PM-1762: HTTP status code will be set to 200 no coincide con el real que indica 201
    - PM-1759: Create Department: POST /department /api/1.0/{workspace}/department
Cause:
    - PM-1762: Definicion incorrecta del siguiente End-point:
               PUT department/{dep_uid}/assign-user/{usr_uid}
    - PM-1759: No se valida de manera correcta el titulo de un departamento
Solution:
    - PM-1762: Se a cambiado la definicion del End-point al siguiente:
                   POST /api/1.0/{workspace}/department/{dep_uid}/assign-user
                   >>>>>
                   {
                       "usr_uid": "41825464054f5b9b0e2dc48048580849"
                   }
                   <<<<<
                   (201)
               Este cambio debera ser replicado en la wiki
               Los "status code" retornados por los End-point son los siguientes:
                   GET    ----> 200
                   POST   ----> 201
                   PUT    ----> 200
                   DELETE ----> 200
               Esto debe ser reflejado en la wiki, caso contrario es un bug de documentacion
    - PM-1759: Se ha agregado los metodos necesarios para validar el titulo de un Departamento
This commit is contained in:
Victor Saisa Lopez
2015-03-10 11:04:10 -04:00
parent 450fc3462b
commit 84b0007076
3 changed files with 132 additions and 72 deletions

View File

@@ -35,47 +35,6 @@ class Validator
return $dep_uid;
}
/**
* Validate dep_title
* @var string $dep_title. Name or Title for Departament
* @var string $dep_uid. Uid for Departament
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url GET
*/
static public function depTitle($dep_title, $dep_uid = '')
{
$dep_title = trim($dep_title);
if ($dep_title == '') {
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',''))));
}
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn( \ContentPeer::CON_CATEGORY );
$oCriteria->addSelectColumn( \ContentPeer::CON_VALUE );
$oCriteria->addSelectColumn( \DepartmentPeer::DEP_PARENT );
$oCriteria->add( \ContentPeer::CON_CATEGORY, 'DEPO_TITLE' );
$oCriteria->addJoin( \ContentPeer::CON_ID, \DepartmentPeer::DEP_UID, \Criteria::LEFT_JOIN );
$oCriteria->add( \ContentPeer::CON_VALUE, $dep_title );
$oCriteria->add( \ContentPeer::CON_LANG, SYS_LANG );
if ($dep_uid != '') {
$oCriteria->add( \ContentPeer::CON_ID, $dep_uid, \Criteria::NOT_EQUAL );
}
$oDataset = \DepartmentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
if ($oDataset->next()) {
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',$dep_title))));
}
return $dep_title;
}
/**
* Validate dep_status
* @var string $dep_uid. Uid for Departament