unifying API paths to lower-case

This commit is contained in:
azivner 2017-12-01 22:47:23 -05:00
parent cba9d8b5c1
commit 0521deb304
5 changed files with 15 additions and 15 deletions

View File

@ -30,7 +30,7 @@ const editTreePrefix = (function() {
formEl.submit(() => {
const prefix = treePrefixInputEl.val();
server.put('tree/' + noteTreeId + '/setPrefix', {
server.put('tree/' + noteTreeId + '/set-prefix', {
prefix: prefix
}).then(() => noteTree.setPrefix(noteTreeId, prefix));

View File

@ -141,7 +141,7 @@ const protected_session = (function() {
async function protectSubTree(noteId, protect) {
await ensureProtectedSession(true, true);
await server.put('tree/' + noteId + "/protectSubTree/" + (protect ? 1 : 0));
await server.put('tree/' + noteId + "/protect-sub-tree/" + (protect ? 1 : 0));
showMessage("Request to un/protect sub tree has finished successfully");

View File

@ -2,7 +2,7 @@
const treeChanges = (function() {
async function moveBeforeNode(node, beforeNode, changeInPath = true) {
await server.put('notes/' + node.data.note_tree_id + '/moveBefore/' + beforeNode.data.note_tree_id);
await server.put('notes/' + node.data.note_tree_id + '/move-before/' + beforeNode.data.note_tree_id);
node.moveTo(beforeNode, 'before');
@ -14,7 +14,7 @@ const treeChanges = (function() {
}
async function moveAfterNode(node, afterNode, changeInPath = true) {
await server.put('notes/' + node.data.note_tree_id + '/moveAfter/' + afterNode.data.note_tree_id);
await server.put('notes/' + node.data.note_tree_id + '/move-after/' + afterNode.data.note_tree_id);
node.moveTo(afterNode, 'after');
@ -27,7 +27,7 @@ const treeChanges = (function() {
// beware that first arg is noteId and second is noteTreeId!
async function cloneNoteAfter(noteId, afterNoteTreeId) {
const resp = await server.put('notes/' + noteId + '/cloneAfter/' + afterNoteTreeId);
const resp = await server.put('notes/' + noteId + '/clone-after/' + afterNoteTreeId);
if (!resp.success) {
alert(resp.message);
@ -38,7 +38,7 @@ const treeChanges = (function() {
}
async function moveToNode(node, toNode) {
await server.put('notes/' + node.data.note_tree_id + '/moveTo/' + toNode.data.note_id);
await server.put('notes/' + node.data.note_tree_id + '/move-to/' + toNode.data.note_id);
node.moveTo(toNode);
@ -53,7 +53,7 @@ const treeChanges = (function() {
}
async function cloneNoteTo(childNoteId, parentNoteId) {
const resp = await server.put('notes/' + childNoteId + '/cloneTo/' + parentNoteId);
const resp = await server.put('notes/' + childNoteId + '/clone-to/' + parentNoteId);
if (!resp.success) {
alert(resp.message);
@ -95,7 +95,7 @@ const treeChanges = (function() {
return;
}
await server.put('notes/' + node.data.note_tree_id + '/moveAfter/' + node.getParent().data.note_tree_id);
await server.put('notes/' + node.data.note_tree_id + '/move-after/' + node.getParent().data.note_tree_id);
if (node.getParent() !== null && node.getParent().getChildren().length <= 1) {
node.getParent().folder = false;

View File

@ -7,7 +7,7 @@ const utils = require('../../services/utils');
const auth = require('../../services/auth');
const sync_table = require('../../services/sync_table');
router.put('/:noteTreeId/moveTo/:parentNoteId', auth.checkApiAuth, async (req, res, next) => {
router.put('/:noteTreeId/move-to/:parentNoteId', auth.checkApiAuth, async (req, res, next) => {
const noteTreeId = req.params.noteTreeId;
const parentNoteId = req.params.parentNoteId;
@ -26,7 +26,7 @@ router.put('/:noteTreeId/moveTo/:parentNoteId', auth.checkApiAuth, async (req, r
res.send({});
});
router.put('/:noteTreeId/moveBefore/:beforeNoteTreeId', async (req, res, next) => {
router.put('/:noteTreeId/move-before/:beforeNoteTreeId', async (req, res, next) => {
const noteTreeId = req.params.noteTreeId;
const beforeNoteTreeId = req.params.beforeNoteTreeId;
@ -55,7 +55,7 @@ router.put('/:noteTreeId/moveBefore/:beforeNoteTreeId', async (req, res, next) =
}
});
router.put('/:noteTreeId/moveAfter/:afterNoteTreeId', async (req, res, next) => {
router.put('/:noteTreeId/move-after/:afterNoteTreeId', async (req, res, next) => {
const noteTreeId = req.params.noteTreeId;
const afterNoteTreeId = req.params.afterNoteTreeId;
@ -82,7 +82,7 @@ router.put('/:noteTreeId/moveAfter/:afterNoteTreeId', async (req, res, next) =>
}
});
router.put('/:childNoteId/cloneTo/:parentNoteId', auth.checkApiAuth, async (req, res, next) => {
router.put('/:childNoteId/clone-to/:parentNoteId', auth.checkApiAuth, async (req, res, next) => {
const parentNoteId = req.params.parentNoteId;
const childNoteId = req.params.childNoteId;
@ -126,7 +126,7 @@ router.put('/:childNoteId/cloneTo/:parentNoteId', auth.checkApiAuth, async (req,
});
});
router.put('/:noteId/cloneAfter/:afterNoteTreeId', async (req, res, next) => {
router.put('/:noteId/clone-after/:afterNoteTreeId', async (req, res, next) => {
const noteId = req.params.noteId;
const afterNoteTreeId = req.params.afterNoteTreeId;

View File

@ -35,7 +35,7 @@ router.get('/', auth.checkApiAuth, async (req, res, next) => {
});
});
router.put('/:noteId/protectSubTree/:isProtected', auth.checkApiAuth, async (req, res, next) => {
router.put('/:noteId/protect-sub-tree/:isProtected', auth.checkApiAuth, async (req, res, next) => {
const noteId = req.params.noteId;
const isProtected = !!parseInt(req.params.isProtected);
const dataKey = protected_session.getDataKey(req);
@ -47,7 +47,7 @@ router.put('/:noteId/protectSubTree/:isProtected', auth.checkApiAuth, async (req
res.send({});
});
router.put('/:noteTreeId/setPrefix', auth.checkApiAuth, async (req, res, next) => {
router.put('/:noteTreeId/set-prefix', auth.checkApiAuth, async (req, res, next) => {
const noteTreeId = req.params.noteTreeId;
const prefix = utils.isEmptyOrWhitespace(req.body.prefix) ? null : req.body.prefix;