From dd6ac8155e069fe0cd42e167ff64abe09a6040c9 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 21 Jan 2015 22:55:17 +0100 Subject: [PATCH] more splits --- .../collection/app.js} | 22 +++++++------- js/actions/{api-foxx.js => _api/foxx/app.js} | 9 ++---- js/actions/{api-user.js => _api/user/app.js} | 30 ++----------------- js/actions/api-system.js | 6 +--- 4 files changed, 15 insertions(+), 52 deletions(-) rename js/actions/{api-collection.js => _api/collection/app.js} (98%) rename js/actions/{api-foxx.js => _api/foxx/app.js} (96%) rename js/actions/{api-user.js => _api/user/app.js} (91%) diff --git a/js/actions/api-collection.js b/js/actions/_api/collection/app.js similarity index 98% rename from js/actions/api-collection.js rename to js/actions/_api/collection/app.js index f2b505f144..77a7b926c5 100644 --- a/js/actions/api-collection.js +++ b/js/actions/_api/collection/app.js @@ -33,8 +33,6 @@ var arangodb = require("org/arangodb"); var actions = require("org/arangodb/actions"); var cluster = require("org/arangodb/cluster"); -var API = "_api/collection"; - // ----------------------------------------------------------------------------- // --SECTION-- private functions // ----------------------------------------------------------------------------- @@ -336,7 +334,7 @@ function post_api_collection (req, res) { } var headers = { - location: databasePrefix(req, "/" + API + "/" + result.name) + location: databasePrefix(req, "/_api/collection/" + result.name) }; actions.resultOk(req, res, actions.HTTP_OK, result, headers); @@ -904,7 +902,7 @@ function get_api_collection (req, res) { if (req.suffix.length === 1) { result = collectionRepresentation(collection, false, false, false); headers = { - location : databasePrefix(req, "/" + API + "/" + collection.name()) + location : databasePrefix(req, "/_api/collection/" + collection.name()) }; actions.resultOk(req, res, actions.HTTP_OK, result, headers); return; @@ -949,7 +947,7 @@ function get_api_collection (req, res) { else if (sub === "figures") { result = collectionRepresentation(collection, true, true, true); 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); } @@ -961,7 +959,7 @@ function get_api_collection (req, res) { else if (sub === "count") { result = collectionRepresentation(collection, true, true, false); 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); } @@ -973,7 +971,7 @@ function get_api_collection (req, res) { else if (sub === "properties") { result = collectionRepresentation(collection, true, false, false); 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); } @@ -996,7 +994,7 @@ function get_api_collection (req, res) { } else { actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER, - "expect GET /" + API + "//"); + "expect GET /_api/collection//"); } } @@ -1465,7 +1463,7 @@ function put_api_collection_rotate (req, res, collection) { function put_api_collection (req, res) { if (req.suffix.length !== 2) { actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER, - "expected PUT /" + API + "//"); + "expected PUT /_api/collection//"); return; } @@ -1572,7 +1570,7 @@ function put_api_collection (req, res) { function delete_api_collection (req, res) { if (req.suffix.length !== 1) { actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER, - "expected DELETE /" + API + "/"); + "expected DELETE /_api/collection/"); } else { var name = decodeURIComponent(req.suffix[0]); @@ -1603,7 +1601,7 @@ function delete_api_collection (req, res) { //////////////////////////////////////////////////////////////////////////////// actions.defineHttp({ - url : API, + url : "_api/collection", callback : function (req, res) { try { @@ -1635,5 +1633,5 @@ actions.defineHttp({ // Local Variables: // mode: outline-minor -// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" +// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|/// @startDocuBlock\\|// --SECTION--\\|/// @\\}" // End: diff --git a/js/actions/api-foxx.js b/js/actions/_api/foxx/app.js similarity index 96% rename from js/actions/api-foxx.js rename to js/actions/_api/foxx/app.js index 8956c529b4..fca2f7bb1f 100644 --- a/js/actions/api-foxx.js +++ b/js/actions/_api/foxx/app.js @@ -1,5 +1,5 @@ /*jshint strict: false */ -/*global require, module */ +/*global require */ //////////////////////////////////////////////////////////////////////////////// /// @brief foxx administration actions @@ -29,11 +29,6 @@ /// @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 foxxManager = require("org/arangodb/foxx/manager"); @@ -163,5 +158,5 @@ actions.defineHttp({ // Local Variables: // mode: outline-minor -// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" +// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|/// @startDocuBlock\\|// --SECTION--\\|/// @\\}" // End: diff --git a/js/actions/api-user.js b/js/actions/_api/user/app.js similarity index 91% rename from js/actions/api-user.js rename to js/actions/_api/user/app.js index 5fc6f5753b..7e883e9490 100644 --- a/js/actions/api-user.js +++ b/js/actions/_api/user/app.js @@ -38,12 +38,6 @@ var users = require("org/arangodb/users"); // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// -/// @brief fetches a user -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @COMMENT{######################################################################} -/// @anchor HttpUserDocument /// @startDocuBlock JSF_api_user_fetch /// /// @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 /// /// @RESTHEADER{POST /_api/user, Create User} @@ -200,10 +188,6 @@ function post_api_user (req, res) { actions.resultOk(req, res, actions.HTTP_CREATED, doc); } -//////////////////////////////////////////////////////////////////////////////// -/// @brief replaces an existing user -//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// @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 /// /// @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 /// @@ -445,7 +419,7 @@ function delete_api_user (req, res) { } // ----------------------------------------------------------------------------- -// --SECTION-- actions +// --SECTION-- public functions // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// @@ -494,5 +468,5 @@ actions.defineHttp({ // Local Variables: // mode: outline-minor -// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" +// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|/// @startDocuBlock\\|// --SECTION--\\|/// @\\}" // End: diff --git a/js/actions/api-system.js b/js/actions/api-system.js index 6a06408311..46801e7b44 100644 --- a/js/actions/api-system.js +++ b/js/actions/api-system.js @@ -1,5 +1,5 @@ /*jshint strict: false */ -/*global require, ArangoServerState */ +/*global require */ //////////////////////////////////////////////////////////////////////////////// /// @brief administration actions @@ -29,14 +29,10 @@ /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -var arangodb = require("org/arangodb"); var actions = require("org/arangodb/actions"); var internal = require("internal"); -var console = require("console"); var users = require("org/arangodb/users"); -var targetDatabaseVersion = require("org/arangodb/database-version").CURRENT_VERSION; - // ----------------------------------------------------------------------------- // --SECTION-- public functions // -----------------------------------------------------------------------------