-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib_user_profile_detail.js.html
91 lines (68 loc) · 4.21 KB
/
lib_user_profile_detail.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: lib/user_profile_detail.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: lib/user_profile_detail.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* @module
* @author zccz14 <[email protected]>
* @requires co
* @requires models/index
* @requires lib/on_error
*/
const co = require('co');
const {User} = require('../models');
const OnError = require('./on_error');
/**
* @name UserProfileDetail
* @description 获取用户个人信息的中间件
* @function
* @param {HTTPRequest} req - HTTPRequest
* @param {HTTPRequest} res - HTTPResponse
* @returns {void}
*
* @api {get} /user/profile 用户个人信息
* @apiVersion 0.1.0
* @apiName UserProfile
* @apiGroup User
* @apiPermission user
*
* @apiSuccess {Number} code 0
* @apiSuccess {User} user 用户文档(个人信息)
*
*/
function UserProfileDetail(req, res) {
co(function* () {
let {user} = req.session;
user = yield User.findById(user._id).exec();
res.json({ code: 0, user });
}).catch(OnError(req, res));
}
module.exports = UserProfileDetail;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-config.html">config</a></li><li><a href="module-lib_on_error.html">lib/on_error</a></li><li><a href="module-lib_problem_create.html">lib/problem_create</a></li><li><a href="module-lib_problem_delete.html">lib/problem_delete</a></li><li><a href="module-lib_problem_detail.html">lib/problem_detail</a></li><li><a href="module-lib_problem_list_create.html">lib/problem_list_create</a></li><li><a href="module-lib_problem_list_detail.html">lib/problem_list_detail</a></li><li><a href="module-lib_problem_list_problem_create.html">lib/problem_list_problem_create</a></li><li><a href="module-lib_problem_list_retrieve.html">lib/problem_list_retrieve</a></li><li><a href="module-lib_problem_retrieve.html">lib/problem_retrieve</a></li><li><a href="module-lib_problem_update.html">lib/problem_update</a></li><li><a href="module-lib_submission_create.html">lib/submission_create</a></li><li><a href="module-lib_submission_detail.html">lib/submission_detail</a></li><li><a href="module-lib_submission_retrieve.html">lib/submission_retrieve</a></li><li><a href="module-lib_submission_sentence_update.html">lib/submission_sentence_update</a></li><li><a href="module-lib_user_create.html">lib/user_create</a></li><li><a href="module-lib_user_detail.html">lib/user_detail</a></li><li><a href="module-lib_user_login.html">lib/user_login</a></li><li><a href="module-lib_user_logout.html">lib/user_logout</a></li><li><a href="module-lib_user_profile_detail.html">lib/user_profile_detail</a></li><li><a href="module-lib_user_retrieve.html">lib/user_retrieve</a></li><li><a href="module-models_index.html">models/index</a></li><li><a href="module-routes_group.html">routes/group</a></li><li><a href="module-routes_index.html">routes/index</a></li><li><a href="module-routes_problem.html">routes/problem</a></li><li><a href="module-routes_problem_list.html">routes/problem_list</a></li><li><a href="module-routes_submission.html">routes/submission</a></li><li><a href="module-routes_user.html">routes/user</a></li><li><a href="module-server.html">server</a></li></ul><h3>Classes</h3><ul><li><a href="Problem.html">Problem</a></li><li><a href="ProblemList.html">ProblemList</a></li><li><a href="Submission.html">Submission</a></li><li><a href="User.html">User</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Mar 23 2017 05:16:25 GMT+0000 (UTC)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>