Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VILLASweb-backend-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASweb-backend-node
Commits
17bbcaaa
Commit
17bbcaaa
authored
8 years ago
by
Markus Grigull
Browse files
Options
Downloads
Patches
Plain Diff
Add user email attribute
Change response on delete routes.
parent
ad53a566
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
models/user.js
+2
-1
2 additions, 1 deletion
models/user.js
routes/projects.js
+3
-9
3 additions, 9 deletions
routes/projects.js
routes/users.js
+2
-2
2 additions, 2 deletions
routes/users.js
with
7 additions
and
12 deletions
models/user.js
+
2
−
1
View file @
17bbcaaa
...
...
@@ -9,7 +9,8 @@ var userSchema = new Schema({
username
:
{
type
:
String
,
unique
:
true
,
required
:
true
},
password
:
{
type
:
String
,
required
:
true
},
adminLevel
:
{
type
:
Number
,
default
:
0
},
projects
:
[{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'
Project
'
}]
projects
:
[{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'
Project
'
}],
mail
:
{
type
:
String
}
});
userSchema
.
methods
.
verifyPassword
=
function
(
password
,
callback
)
{
...
...
This diff is collapsed.
Click to expand it.
routes/projects.js
+
3
−
9
View file @
17bbcaaa
...
...
@@ -51,7 +51,7 @@ router.route('/projects').post(function(req, res) {
});
});
router
.
route
(
'
/projects/:id
'
).
p
atch
(
function
(
req
,
res
)
{
router
.
route
(
'
/projects/:id
'
).
p
ut
(
function
(
req
,
res
)
{
// get project
Project
.
findOne
({
_id
:
req
.
params
.
id
},
function
(
err
,
project
)
{
if
(
err
)
{
...
...
@@ -85,18 +85,12 @@ router.route('/projects/:id').get(function(req, res) {
});
router
.
route
(
'
/projects/:id
'
).
delete
(
function
(
req
,
res
)
{
Project
.
findOn
e
({
_id
:
req
.
params
.
id
},
function
(
err
,
project
)
{
Project
.
remov
e
({
_id
:
req
.
params
.
id
},
function
(
err
,
project
)
{
if
(
err
)
{
return
res
.
send
(
err
);
}
Project
.
remove
({
_id
:
req
.
params
.
id
},
function
(
err
)
{
if
(
err
)
{
return
res
.
send
(
err
);
}
res
.
send
({
success
:
true
,
message
:
'
Project deleted
'
});
});
res
.
send
({
project
:
project
});
});
});
...
...
This diff is collapsed.
Click to expand it.
routes/users.js
+
2
−
2
View file @
17bbcaaa
...
...
@@ -84,12 +84,12 @@ router.route('/users/:id').get(auth.validateAdminLevel(1), function(req, res) {
});
router
.
route
(
'
/users/:id
'
).
delete
(
auth
.
validateAdminLevel
(
1
),
function
(
req
,
res
)
{
User
.
remove
({
_id
:
req
.
params
.
id
},
function
(
err
)
{
User
.
remove
({
_id
:
req
.
params
.
id
},
function
(
err
,
user
)
{
if
(
err
)
{
return
res
.
send
(
err
);
}
res
.
send
({
success
:
true
,
message
:
'
User deleted
'
});
res
.
send
({
user
:
user
});
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment