Skip to content

Commit ffc659b

Browse files
committed
do some renames
1 parent de5e928 commit ffc659b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

backend/src/routes/users/snippets/personal-snippets.router.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ personalSnippetsRouter.put('/:snippetId', keycloak.protect(), async (request, re
120120

121121
UserIdValidator.validateUserId(request);
122122

123-
const codeletData = request.body;
123+
const snippetData = request.body;
124124

125125
const {userId, snippetId} = request.params;
126-
const updatedBookmark = await PersonalSnippetsService.updateSnippet(userId, snippetId, codeletData);
126+
const updatedSnippet = await PersonalSnippetsService.updateSnippet(userId, snippetId, snippetData);
127127

128-
return response.status(HttpStatus.OK).send(updatedBookmark);
128+
return response.status(HttpStatus.OK).send(updatedSnippet);
129129
});
130130

131131
/*

backend/src/routes/users/snippets/personal-snippets.service.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ const Snippet = require('../../../model/snippet');
22

33
const NotFoundError = require('../../../error/not-found.error');
44

5-
const CodeletInputValidator = require('./snippet-input.validator');
5+
const SnippetInputValidator = require('./snippet-input.validator');
66

77
/**
88
* CREATE snippet for user
99
*/
1010
let createSnippet = async function (userId, snippetData) {
11-
CodeletInputValidator.validateSnippetInput(userId, snippetData);
11+
SnippetInputValidator.validateSnippetInput(userId, snippetData);
1212

1313
const snippet = new Snippet(snippetData);
1414
let newSnippet = await snippet.save();
@@ -52,24 +52,24 @@ let getAllMySnippets = async (userId) => {
5252
* full UPDATE via PUT - that is the whole document is required and will be updated
5353
* the descriptionHtml parameter is only set in backend, if only does not come front-end (might be an API call)
5454
*/
55-
let updateSnippet = async (userId, codeletId, codeletData) => {
55+
let updateSnippet = async (userId, codeletId, snippetData) => {
5656

57-
CodeletInputValidator.validateSnippetInput(userId, codeletData);
57+
SnippetInputValidator.validateSnippetInput(userId, snippetData);
5858

59-
const updatedCodelet = await Snippet.findOneAndUpdate(
59+
const updatedSnippet = await Snippet.findOneAndUpdate(
6060
{
6161
_id: codeletId,
6262
userId: userId
6363
},
64-
codeletData,
64+
snippetData,
6565
{new: true}
6666
);
6767

68-
const codeletNotFound = !updatedCodelet;
69-
if ( codeletNotFound ) {
70-
throw new NotFoundError('Snippet NOT_FOUND with id: ' + codeletId + ' AND title: ' + codeletData.title);
68+
const snippetNotFound = !updatedSnippet;
69+
if ( snippetNotFound ) {
70+
throw new NotFoundError('Snippet NOT_FOUND with id: ' + codeletId + ' AND title: ' + snippetData.title);
7171
} else {
72-
return updatedCodelet;
72+
return updatedSnippet;
7373
}
7474
};
7575

0 commit comments

Comments
 (0)