Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-155
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-155
2021-155
Commits
dfab6b84
Commit
dfab6b84
authored
Sep 23, 2021
by
Kamal Thennakoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor user model
parent
0886ec45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
portfolio-backend/models/user.js
portfolio-backend/models/user.js
+26
-23
No files found.
portfolio-backend/models/user.js
View file @
dfab6b84
const
mongoose
=
require
(
'
mongoose
'
);
const
uniqueValidator
=
require
(
'
mongoose-unique-validator
'
);
const
Schema
=
mongoose
.
Schema
;
const
mongoose
=
require
(
"
mongoose
"
);
const
uniqueValidator
=
require
(
"
mongoose-unique-validator
"
);
const
Schema
=
mongoose
.
Schema
;
const
userSchema
=
new
Schema
({
username
:{
type
:
String
,
required
:
true
,
unique
:
true
},
name
:{
type
:
String
},
avatar_url
:{
type
:
String
},
bio
:{
type
:
String
},
company
:{
type
:
String
},
location
:{
type
:
String
},
created_at
:{
type
:
String
},
git_level
:{
type
:
Number
},
git_score
:{
type
:
Number
},
git_badge
:{
type
:
String
},
git_points
:{
type
:
Number
},
total_prs
:{
type
:
Number
},
total_commits
:{
type
:
Number
},
total_issues
:{
type
:
Number
},
total_stars
:{
type
:
Number
},
contributed_to
:{
type
:
Number
},
latestUpdate
:{
type
:
Date
}
})
const
userSchema
=
new
Schema
({
username
:
{
type
:
String
,
required
:
true
,
unique
:
true
},
name
:
{
type
:
String
},
avatar_url
:
{
type
:
String
},
bio
:
{
type
:
String
},
company
:
{
type
:
String
},
location
:
{
type
:
String
},
created_at
:
{
type
:
String
},
coding
:
{
level
:
{
type
:
Number
},
score
:
{
type
:
Number
},
badge
:
{
type
:
String
},
points
:
{
type
:
Number
},
},
git_langs
:
[{
name
:
{
type
:
String
},
lines
:
{
type
:
Number
}
}],
total_prs
:
{
type
:
Number
},
total_commits
:
{
type
:
Number
},
total_issues
:
{
type
:
Number
},
total_stars
:
{
type
:
Number
},
contributed_to
:
{
type
:
Number
},
latest_update
:
{
type
:
Date
},
});
userSchema
.
plugin
(
uniqueValidator
);
module
.
exports
=
User
=
mongoose
.
model
(
'
User
'
,
userSchema
);
module
.
exports
=
User
=
mongoose
.
model
(
"
User
"
,
userSchema
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment