Toggle navigation
Toggle navigation
This project
Loading...
Sign in
송용우
/
oss-Jaksimsamil
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
송용우
2020-08-21 16:47:12 +0900
1
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
b885b7d57a174d235aa638ce631efc6ec938fddf
b885b7d5
2 parents
591e44cb
bd5f5ee6
Merge commit '
bd5f5ee6
' into develop
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
20 deletions
jaksimsamil-server/.gitignore
jaksimsamil-server/package-lock.json
jaksimsamil-server/package.json
jaksimsamil-server/src/api/profile/profile.ctrl.js
jaksimsamil-server/src/models/problem.js
jaksimsamil-server/src/models/user.js
jaksimsamil-server/yarn.lock
jaksimsamil-server/.gitignore
View file @
b885b7d
...
...
@@ -8,3 +8,4 @@ access.log
# dependencies
/node_modules
...
...
jaksimsamil-server/package-lock.json
View file @
b885b7d
...
...
@@ -402,12 +402,12 @@
}
},
"bcrypt"
:
{
"version"
:
"
3.0.8
"
,
"resolved"
:
"https://registry.npmjs.org/bcrypt/-/bcrypt-
3.0.8
.tgz"
,
"integrity"
:
"sha512-j
KV6RvLhI36TQnPDvUFqBEnGX9c8dRRygKxCZu7E+MgLfKZbmmXL8a7/SFFOyHoPNX9nV81cKRC5tbQfvEQtpw
=="
,
"version"
:
"
5.0.0
"
,
"resolved"
:
"https://registry.npmjs.org/bcrypt/-/bcrypt-
5.0.0
.tgz"
,
"integrity"
:
"sha512-j
B0yCBl4W/kVHM2whjfyqnxTmOHkCX4kHEa5nYKSoGeYe8YrjTYTc87/6bwt1g8cmV0QrbhKriETg9jWtcREhg
=="
,
"requires"
:
{
"n
an"
:
"2.14
.0"
,
"node-pre-gyp"
:
"0.1
4
.0"
"n
ode-addon-api"
:
"^3.0
.0"
,
"node-pre-gyp"
:
"0.1
5
.0"
}
},
"bcrypt-pbkdf"
:
{
...
...
@@ -2415,11 +2415,6 @@
"resolved"
:
"https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
,
"integrity"
:
"sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"nan"
:
{
"version"
:
"2.14.0"
,
"resolved"
:
"https://registry.npmjs.org/nan/-/nan-2.14.0.tgz"
,
"integrity"
:
"sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"natural-compare"
:
{
"version"
:
"1.4.0"
,
"resolved"
:
"https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz"
,
...
...
@@ -2451,14 +2446,19 @@
"resolved"
:
"https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz"
,
"integrity"
:
"sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"node-addon-api"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.0.tgz"
,
"integrity"
:
"sha512-sSHCgWfJ+Lui/u+0msF3oyCgvdkhxDbkCS6Q8uiJquzOimkJBvX6hl5aSSA7DR1XbMpdM8r7phjcF63sF4rkKg=="
},
"node-pre-gyp"
:
{
"version"
:
"0.1
4
.0"
,
"resolved"
:
"https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.1
4
.0.tgz"
,
"integrity"
:
"sha512-
+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2Ozcx
A=="
,
"version"
:
"0.1
5
.0"
,
"resolved"
:
"https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.1
5
.0.tgz"
,
"integrity"
:
"sha512-
7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaor
A=="
,
"requires"
:
{
"detect-libc"
:
"^1.0.2"
,
"mkdirp"
:
"^0.5.
1
"
,
"needle"
:
"^2.
2.1
"
,
"mkdirp"
:
"^0.5.
3
"
,
"needle"
:
"^2.
5.0
"
,
"nopt"
:
"^4.0.1"
,
"npm-packlist"
:
"^1.1.6"
,
"npmlog"
:
"^4.0.2"
,
...
...
jaksimsamil-server/package.json
View file @
b885b7d
...
...
@@ -5,7 +5,7 @@
"license"
:
"MIT"
,
"dependencies"
:
{
"axios"
:
"^0.19.2"
,
"bcrypt"
:
"^
3
.0.0"
,
"bcrypt"
:
"^
5
.0.0"
,
"body-parser"
:
"^1.19.0"
,
"cheerio"
:
"^1.0.0-rc.3"
,
"cookie-parser"
:
"^1.4.5"
,
...
...
jaksimsamil-server/src/api/profile/profile.ctrl.js
View file @
b885b7d
...
...
@@ -134,7 +134,7 @@ exports.recommend = async (ctx) => {
problem_set
.
problem_set
);
ctx
.
body
=
compareBJ
.
randomItem
(
unsolved_data
);
//데이터가 비었을 떄 예외처리 필요
//
TODO:
데이터가 비었을 떄 예외처리 필요
}
catch
(
e
)
{
ctx
.
throw
(
500
,
e
);
}
...
...
jaksimsamil-server/src/models/problem.js
View file @
b885b7d
...
...
@@ -8,6 +8,7 @@ const ProblemSchema=new Schema({
solvedacLevel
:
{
type
:
Number
},
sumbitNum
:
{
type
:
Number
,
required
:
true
},
correctNum
:
{
type
:
Number
,
required
:
true
},
count
:
{
type
:
Number
},
category
:
{
type
:[
String
]}
});
...
...
@@ -46,6 +47,10 @@ ProblemSchema.methods.getCorrectNum=function(){
return
this
.
correctNum
;
}
ProblemSchema
.
methods
.
getCount
=
function
(){
return
this
.
count
;
}
ProblemSchema
.
methods
.
getCategory
=
function
(){
return
this
.
category
;
}
...
...
jaksimsamil-server/src/models/user.js
View file @
b885b7d
...
...
@@ -7,8 +7,18 @@ const Schema = mongoose.Schema;
const
UserSchema
=
new
Schema
({
username
:
String
,
hashedPassword
:
String
,
userBJID
:
String
,
sovledBJ
:
Object
,
solvedBJ_date
:
Object
,
friendList
:
[
String
],
slackWebHookURL
:
String
,
goalNum
:
Number
,
});
UserSchema
.
statics
.
findByUsername
=
function
(
username
)
{
return
this
.
findOne
({
username
});
};
UserSchema
.
methods
.
setPassword
=
async
function
(
password
)
{
const
hash
=
await
bcrypt
.
hash
(
password
,
10
);
this
.
hashedPassword
=
hash
;
...
...
@@ -17,14 +27,13 @@ UserSchema.methods.checkPassword = async function (password) {
const
result
=
await
bcrypt
.
compare
(
password
,
this
.
hashedPassword
);
return
result
;
};
UserSchema
.
statics
.
findByUsername
=
function
(
username
)
{
return
this
.
findOne
({
username
});
};
UserSchema
.
methods
.
serialize
=
function
()
{
const
data
=
this
.
toJSON
();
delete
data
.
hashedPassword
;
return
data
;
};
UserSchema
.
methods
.
generateToken
=
function
()
{
const
token
=
jwt
.
sign
(
{
...
...
@@ -38,5 +47,32 @@ UserSchema.methods.generateToken = function () {
);
return
token
;
};
UserSchema
.
statics
.
findByUsername
=
function
(
username
)
{
return
this
.
findOne
({
username
});
};
UserSchema
.
methods
.
getBJID
=
function
()
{
return
this
.
userBJID
;
};
UserSchema
.
methods
.
getBJdata
=
function
()
{
return
this
.
solvedBJ
;
};
UserSchema
.
methods
.
getslackURL
=
function
()
{
return
this
.
slackWebHookURL
;
};
UserSchema
.
methods
.
getgoalNum
=
function
()
{
return
this
.
goalNum
;
};
UserSchema
.
methods
.
getTodaySovled
=
function
()
{
if
(
this
.
solvedBJ_date
)
{
return
this
.
solvedBJ_date
.
presentNum
;
}
};
const
User
=
mongoose
.
model
(
"User"
,
UserSchema
);
module
.
exports
=
User
;
...
...
jaksimsamil-server/yarn.lock
View file @
b885b7d
This diff is collapsed. Click to expand it.
송용우
@2019102188
2020-09-26 12:41:26 UTC
Mentioned in commit
70f9fca2
Please
register
or
login
to post a comment