removing endpoint tha needs refactoring
This commit is contained in:
parent
671779c5e9
commit
764ec9b681
|
@ -39,7 +39,10 @@ class TAINACAN_REST_Metadata_Controller extends WP_REST_Controller {
|
|||
* Both of GETs return the metadata of matched objects
|
||||
*/
|
||||
public function register_routes() {
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/collection/(?P<collection_id>[\d]+)',
|
||||
/*
|
||||
Removing this undocumented endpoint.. it seems wrong.
|
||||
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/collection/(?P<collection_id>[\d]+)',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
|
@ -64,6 +67,7 @@ class TAINACAN_REST_Metadata_Controller extends WP_REST_Controller {
|
|||
)
|
||||
)
|
||||
);
|
||||
*/
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/item/(?P<item_id>[\d]+)',
|
||||
array(
|
||||
array(
|
||||
|
@ -328,6 +332,8 @@ class TAINACAN_REST_Metadata_Controller extends WP_REST_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
// We need to rethink this endpoint. Its confusing...
|
||||
// and there is no need to iterato through all items...
|
||||
|
||||
$collection_id = $request['collection_id'];
|
||||
$body = json_decode($request->get_body(), true);
|
||||
|
@ -374,7 +380,7 @@ class TAINACAN_REST_Metadata_Controller extends WP_REST_Controller {
|
|||
*/
|
||||
public function update_item_permissions_check( $request ) {
|
||||
$item = $this->item_repository->fetch($request['item_id'] ? $request['item_id'] : $request['collection_id']);
|
||||
return $this->item_repository->can_edit($item);
|
||||
return $this->item_repository->can_edit($item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class Filters extends Repository {
|
|||
'can_export' => true,
|
||||
'rewrite' => true,
|
||||
'map_meta_cap' => true,
|
||||
'capability_type' => Entities\Filter::get_post_type(),
|
||||
'capability_type' => 'tainacan-filter',
|
||||
'supports' => [
|
||||
'title',
|
||||
'editor',
|
||||
|
|
|
@ -31,7 +31,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
'field_type' => $field->get_primitive_type(),
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
$request = new \WP_REST_Request(
|
||||
'POST',
|
||||
$this->namespace . '/metadata/collection/' . $collection->get_id()
|
||||
|
@ -43,6 +43,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$metadata_added = $response->get_data();
|
||||
|
||||
$this->assertEquals('Moeda', $metadata_added['name']);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,7 +90,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$Tainacan_Item_Metadata->insert($item_metadata);
|
||||
|
||||
#################### Get metadata of collection ######################
|
||||
|
||||
/*
|
||||
$request = new \WP_REST_Request(
|
||||
'GET',
|
||||
$this->namespace . '/metadata/collection/' . $collection->get_id()
|
||||
|
@ -102,7 +103,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$metadata = $data[0];
|
||||
|
||||
$this->assertEquals('Data', $metadata['name']);
|
||||
|
||||
*/
|
||||
################### Get metadata of item with value #######################
|
||||
|
||||
$request = new \WP_REST_Request(
|
||||
|
@ -182,7 +183,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
|
||||
|
||||
#### UPDATE METADATA IN COLLECTION ####
|
||||
|
||||
/*
|
||||
$values = json_encode([
|
||||
'metadata_id' => $metadata->get_id(),
|
||||
'values' => [
|
||||
|
@ -209,6 +210,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$metav = get_post_meta($item->get_id(), $data['id'], true);
|
||||
|
||||
$this->assertEquals('19/01/2018', $metav);
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue