rnewson commented on a change in pull request #1482: add partition endpoint for 
views along with validation on which
URL: https://github.com/apache/couchdb/pull/1482#discussion_r206904350
 
 

 ##########
 File path: src/chttpd/src/chttpd_db.erl
 ##########
 @@ -250,20 +251,83 @@ handle_view_cleanup_req(Req, Db) ->
     ok = fabric:cleanup_index_files_all_nodes(Db),
     send_json(Req, 202, {[{ok, true}]}).
 
+
+handle_partition_design_req(#httpd{
+        path_parts=[DbName, <<"_partition">>, PartitionKey, _Design, Name, 
<<"_",_/binary>> = Action | _Rest]
+    }=Req, Db) -> 
+    validate_partition_key(PartitionKey),
+
+    case chttpd:qs_value(Req, "partition") of
+        undefined ->
+            ok;
+        _ ->
+            throw({
+                bad_request,
+                <<"Partition key is not allowed in the query string">>
+            })
+     end,
+
+    case mem3:is_partitioned(DbName) of
+        false -> throw(<<"Database is not partitioned">>);
 
 Review comment:
   {bad_request, ..}

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to