1
0
Fork 0

more splits

This commit is contained in:
Frank Celler 2015-01-21 22:55:17 +01:00
parent 6e456dd334
commit dd6ac8155e
4 changed files with 15 additions and 52 deletions

View File

@ -33,8 +33,6 @@ var arangodb = require("org/arangodb");
var actions = require("org/arangodb/actions"); var actions = require("org/arangodb/actions");
var cluster = require("org/arangodb/cluster"); var cluster = require("org/arangodb/cluster");
var API = "_api/collection";
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private functions // --SECTION-- private functions
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -336,7 +334,7 @@ function post_api_collection (req, res) {
} }
var headers = { var headers = {
location: databasePrefix(req, "/" + API + "/" + result.name) location: databasePrefix(req, "/_api/collection/" + result.name)
}; };
actions.resultOk(req, res, actions.HTTP_OK, result, headers); actions.resultOk(req, res, actions.HTTP_OK, result, headers);
@ -904,7 +902,7 @@ function get_api_collection (req, res) {
if (req.suffix.length === 1) { if (req.suffix.length === 1) {
result = collectionRepresentation(collection, false, false, false); result = collectionRepresentation(collection, false, false, false);
headers = { headers = {
location : databasePrefix(req, "/" + API + "/" + collection.name()) location : databasePrefix(req, "/_api/collection/" + collection.name())
}; };
actions.resultOk(req, res, actions.HTTP_OK, result, headers); actions.resultOk(req, res, actions.HTTP_OK, result, headers);
return; return;
@ -949,7 +947,7 @@ function get_api_collection (req, res) {
else if (sub === "figures") { else if (sub === "figures") {
result = collectionRepresentation(collection, true, true, true); result = collectionRepresentation(collection, true, true, true);
headers = { headers = {
location : databasePrefix(req, "/" + API + "/" + collection.name() + "/figures") location : databasePrefix(req, "/_api/collection/" + collection.name() + "/figures")
}; };
actions.resultOk(req, res, actions.HTTP_OK, result, headers); actions.resultOk(req, res, actions.HTTP_OK, result, headers);
} }
@ -961,7 +959,7 @@ function get_api_collection (req, res) {
else if (sub === "count") { else if (sub === "count") {
result = collectionRepresentation(collection, true, true, false); result = collectionRepresentation(collection, true, true, false);
headers = { headers = {
location : databasePrefix(req, "/" + API + "/" + collection.name() + "/count") location : databasePrefix(req, "/_api/collection/" + collection.name() + "/count")
}; };
actions.resultOk(req, res, actions.HTTP_OK, result, headers); actions.resultOk(req, res, actions.HTTP_OK, result, headers);
} }
@ -973,7 +971,7 @@ function get_api_collection (req, res) {
else if (sub === "properties") { else if (sub === "properties") {
result = collectionRepresentation(collection, true, false, false); result = collectionRepresentation(collection, true, false, false);
headers = { headers = {
location : databasePrefix(req, "/" + API + "/" + collection.name() + "/properties") location : databasePrefix(req, "/_api/collection/" + collection.name() + "/properties")
}; };
actions.resultOk(req, res, actions.HTTP_OK, result, headers); actions.resultOk(req, res, actions.HTTP_OK, result, headers);
} }
@ -996,7 +994,7 @@ function get_api_collection (req, res) {
} }
else { else {
actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER, actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER,
"expect GET /" + API + "/<collection-name>/<method>"); "expect GET /_api/collection/<collection-name>/<method>");
} }
} }
@ -1465,7 +1463,7 @@ function put_api_collection_rotate (req, res, collection) {
function put_api_collection (req, res) { function put_api_collection (req, res) {
if (req.suffix.length !== 2) { if (req.suffix.length !== 2) {
actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER, actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER,
"expected PUT /" + API + "/<collection-name>/<action>"); "expected PUT /_api/collection/<collection-name>/<action>");
return; return;
} }
@ -1572,7 +1570,7 @@ function put_api_collection (req, res) {
function delete_api_collection (req, res) { function delete_api_collection (req, res) {
if (req.suffix.length !== 1) { if (req.suffix.length !== 1) {
actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER, actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER,
"expected DELETE /" + API + "/<collection-name>"); "expected DELETE /_api/collection/<collection-name>");
} }
else { else {
var name = decodeURIComponent(req.suffix[0]); var name = decodeURIComponent(req.suffix[0]);
@ -1603,7 +1601,7 @@ function delete_api_collection (req, res) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
actions.defineHttp({ actions.defineHttp({
url : API, url : "_api/collection",
callback : function (req, res) { callback : function (req, res) {
try { try {
@ -1635,5 +1633,5 @@ actions.defineHttp({
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|/// @startDocuBlock\\|// --SECTION--\\|/// @\\}"
// End: // End:

View File

@ -1,5 +1,5 @@
/*jshint strict: false */ /*jshint strict: false */
/*global require, module */ /*global require */
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief foxx administration actions /// @brief foxx administration actions
@ -29,11 +29,6 @@
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var internal = require("internal");
var fs = require("fs");
var arangodb = require("org/arangodb");
var actions = require("org/arangodb/actions"); var actions = require("org/arangodb/actions");
var foxxManager = require("org/arangodb/foxx/manager"); var foxxManager = require("org/arangodb/foxx/manager");
@ -163,5 +158,5 @@ actions.defineHttp({
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|/// @startDocuBlock\\|// --SECTION--\\|/// @\\}"
// End: // End:

View File

@ -38,12 +38,6 @@ var users = require("org/arangodb/users");
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief fetches a user
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @COMMENT{######################################################################}
/// @anchor HttpUserDocument
/// @startDocuBlock JSF_api_user_fetch /// @startDocuBlock JSF_api_user_fetch
/// ///
/// @RESTHEADER{GET /_api/user/{user}, Fetch User} /// @RESTHEADER{GET /_api/user/{user}, Fetch User}
@ -103,12 +97,6 @@ function get_api_user (req, res) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new user
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @COMMENT{######################################################################}
/// @anchor HttpUserSave
/// @startDocuBlock JSF_api_user_create /// @startDocuBlock JSF_api_user_create
/// ///
/// @RESTHEADER{POST /_api/user, Create User} /// @RESTHEADER{POST /_api/user, Create User}
@ -200,10 +188,6 @@ function post_api_user (req, res) {
actions.resultOk(req, res, actions.HTTP_CREATED, doc); actions.resultOk(req, res, actions.HTTP_CREATED, doc);
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief replaces an existing user
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_api_user_replace /// @startDocuBlock JSF_api_user_replace
/// ///
@ -288,12 +272,6 @@ function put_api_user (req, res) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief partially updates an existing user
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @COMMENT{######################################################################}
/// @anchor HttpUserUpdate
/// @startDocuBlock JSF_api_user_update /// @startDocuBlock JSF_api_user_update
/// ///
/// @RESTHEADER{PATCH /_api/user/{user}, Update User} /// @RESTHEADER{PATCH /_api/user/{user}, Update User}
@ -378,10 +356,6 @@ function patch_api_user (req, res) {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief removes an existing user
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_api_user_delete /// @startDocuBlock JSF_api_user_delete
/// ///
@ -445,7 +419,7 @@ function delete_api_user (req, res) {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- actions // --SECTION-- public functions
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -494,5 +468,5 @@ actions.defineHttp({
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|/// @startDocuBlock\\|// --SECTION--\\|/// @\\}"
// End: // End:

View File

@ -1,5 +1,5 @@
/*jshint strict: false */ /*jshint strict: false */
/*global require, ArangoServerState */ /*global require */
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief administration actions /// @brief administration actions
@ -29,14 +29,10 @@
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var arangodb = require("org/arangodb");
var actions = require("org/arangodb/actions"); var actions = require("org/arangodb/actions");
var internal = require("internal"); var internal = require("internal");
var console = require("console");
var users = require("org/arangodb/users"); var users = require("org/arangodb/users");
var targetDatabaseVersion = require("org/arangodb/database-version").CURRENT_VERSION;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public functions // --SECTION-- public functions
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------