Commit 90b57e37 authored by François Agneray's avatar François Agneray
Browse files

#37 => done

parent d2c873ec
......@@ -4,5 +4,5 @@ set -e
curl -d '{"label":"Test","dbname":"anis_test","dbtype":"pdo_pgsql","dbhost":"db","dbport":5432,"dblogin":"anis","dbpassword":"anis"}' -H "Content-Type: application/json" -X POST http://localhost/metadata/default/database
curl -d '{"name":"anis_project","label":"Anis Project Test","description":"Project used for testing","link":"http://project.com","manager":"M. Durand","id_database":1}' -H "Content-Type: application/json" -X POST http://localhost/metadata/default/project
curl -d '{"name":"obs_cat","table_ref":"obs_cat","label":"ObsCat dataset","description":"ObsCat","display":"10","count":"10000","vo":false,"data_path":"/mnt/mount","project_name":"anis_project","id_dataset_family":1}' -H "Content-Type: application/json" -X POST http://localhost/metadata/default/dataset
curl -d '{"name":"observations","table_ref":"observations_info","label":"Observations dataset","description":"Observations","display":"20","count":"177454","vo":false,"data_path":"/mnt/mount","project_name":"anis_project","id_dataset_family":1}' -H "Content-Type: application/json" -X POST http://localhost/metadata/default/dataset
curl -d '{"name":"obs_cat","table_ref":"obs_cat","label":"ObsCat dataset","description":"ObsCat","display":"10","count":"10000","vo":false,"data_path":"/mnt/mount","selectable_raw":true,"project_name":"anis_project","id_dataset_family":1}' -H "Content-Type: application/json" -X POST http://localhost/metadata/default/dataset
curl -d '{"name":"observations","table_ref":"observations_info","label":"Observations dataset","description":"Observations","display":"20","count":"177454","vo":false,"data_path":"/mnt/mount","selectable_raw":false,"project_name":"anis_project","id_dataset_family":1}' -H "Content-Type: application/json" -X POST http://localhost/metadata/default/dataset
......@@ -101,7 +101,17 @@ final class DatasetAction
$parsedBody = $request->getParsedBody();
// If mandatories empty fields 400
foreach (array('label', 'description', 'id_dataset_family', 'display', 'count', 'vo', 'data_path') as $a) {
$fields = array(
'label',
'description',
'display',
'count',
'vo',
'data_path',
'selectable_raw',
'id_dataset_family'
);
foreach ($fields as $a) {
if ($this->isEmptyField($a, $parsedBody)) {
return $this->dispatchHttpError(
$response,
......@@ -156,7 +166,8 @@ final class DatasetAction
$dataset->setCount($parsedBody['count']);
$dataset->setVo($parsedBody['vo']);
$dataset->setDataPath($parsedBody['data_path']);
$dataset->setSelectableRaw($parsedBody['selectable_raw']);
$this->memf->getMetaEntityManager()->flush();
}
}
......@@ -128,6 +128,7 @@ final class DatasetListAction
'count',
'vo',
'data_path',
'selectable_raw',
'project_name',
'id_dataset_family'
);
......@@ -191,6 +192,7 @@ final class DatasetListAction
$dataset->setCount($parsedBody['count']);
$dataset->setVo($parsedBody['vo']);
$dataset->setDataPath($parsedBody['data_path']);
$dataset->setSelectableRaw($parsedBody['selectable_raw']);
$dataset->setProject($project);
$dataset->setDatasetFamily($family);
......
......@@ -74,6 +74,13 @@ class Dataset implements \JsonSerializable
* @Column(type="string", name="data_path", nullable=true)
*/
protected $dataPath;
/**
* @var bool
*
* @Column(type="boolean", name="selectable_raw", nullable=false)
*/
protected $selectableRaw;
/**
* @var Anis\Entity\Project
......@@ -193,6 +200,16 @@ class Dataset implements \JsonSerializable
$this->dataPath = $dataPath;
}
public function getSelectableRaw()
{
return $this->selectableRaw;
}
public function setSelectableRaw($selectableRaw)
{
$this->selectableRaw = $selectableRaw;
}
public function getProject()
{
return $this->project;
......@@ -244,6 +261,7 @@ class Dataset implements \JsonSerializable
'count' => $this->getCount(),
'vo' => $this->getVo(),
'data_path' => $this->getDataPath(),
'selectable_raw' => $this->getSelectableRaw(),
'project_name' => $this->getProject()->getName(),
'id_dataset_family' => $this->getDatasetFamily()->getId()
];
......
......@@ -69,6 +69,7 @@ final class DatasetActionTest extends AbstractActionMetaTestCase
'count' => 100582,
'vo' => true,
'data_path' => '/tmp/data',
'selectable_raw' => false,
'project_name' => 'corot',
'id_dataset_family' => 1
)));
......@@ -171,6 +172,7 @@ final class DatasetActionTest extends AbstractActionMetaTestCase
'count' => 100583,
'vo' => true,
'data_path' => '/tmp/data',
'selectable_raw' => false,
'project_name' => 'corot',
'id_dataset_family' => 1
);
......
......@@ -61,6 +61,7 @@ final class DatasetListActionTest extends AbstractActionMetaTestCase
'count' => 100582,
'vo' => true,
'data_path' => '/tmp/data',
'selectable_raw' => false,
'project_name' => 'corot',
'id_dataset_family' => 1
),
......@@ -73,6 +74,7 @@ final class DatasetListActionTest extends AbstractActionMetaTestCase
'count' => 784512,
'vo' => false,
'data_path' => '/tmp/data',
'selectable_raw' => false,
'project_name' => 'vuds',
'id_dataset_family' => 2
)
......@@ -179,6 +181,7 @@ final class DatasetListActionTest extends AbstractActionMetaTestCase
'count' => 987456,
'vo' => true,
'data_path' => '/tmp/data',
'selectable_raw' => true,
'project_name' => 'corot',
'id_dataset_family' => 1
);
......
......@@ -87,6 +87,7 @@ dataset:
count: 100582
vo: true
data_path: '/tmp/data'
selectable_raw: false
project_name: 'corot'
id_dataset_family: 1
-
......@@ -98,6 +99,7 @@ dataset:
count: 784512
vo: false
data_path: '/tmp/data'
selectable_raw: false
project_name: 'vuds'
id_dataset_family: 2
file:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment