Commit 4d3ad8d2 authored by Jean-Marc Le Roux's avatar Jean-Marc Le Roux

Merge branch 'hack42-alicia' into 'master'

Refactor user retrieval and amedment update API endpoints.

See merge request !22
parents 7175bc4a c20f94c0
Pipeline #40938 passed with stages
in 48 seconds
......@@ -327,15 +327,23 @@ app.post(
*
* @apiParam (URL) {String} project_id the ID of the project
* @apiParam (URL) {String} amendment_id the amendment id
* @apiParam (PUT) {Labels} status
*
*/
app.delete('/api/v1/project/:project_id/amendment/:amendment_id', proxy('localhost:8000', {
proxyReqOptDecorator: proxyAuthorizationHeader,
proxyReqPathResolver: (req) => {
return '/admin/api/v4/projects/' + req.params.project_id
+ '/merge_requests/' + req.params.amendment_id;
},
}));
app.put(
'/api/v1/project/:project_id/amendment/:amendment_id',
(req, res) => request.put(
'http://127.0.0.1:8000/admin/api/v4'
+ '/projects/' + req.params.project_id
+ '/merge_requests/' + req.params.amendment_id
)
.send({
// FIXME: check that status is one of draft, accepted...
labels: req.body.status
})
.set(getRequestAuthorizationHeader(req))
.end((err, gitlabRes) => res.apiResponse(err, gitlabRes, 'merge_request.njk'))
);
/**
* @api {get} /project/:project_id/amendement amendments list of the projects (= branches) of the specified project
......@@ -455,39 +463,18 @@ app.get(
* "id": 1,
* "name": "Administrator",
* "username": "root",
* "state": "active",
* "avatar_url": "https://secure.gravatar.com/avatar/249d3d16937c76c40b67e0a15b802522?s=80&d=identicon",
* "web_url": "https://amenda.test/admin/root",
* "created_at": "2017-11-20T20:40:53.860Z",
* "bio": null,
* "location": null,
* "skype": "",
* "linkedin": "",
* "twitter": "",
* "website_url": "",
* "organization": null,
* "last_sign_in_at": "2017-12-27T08:25:20.078Z",
* "confirmed_at": "2017-11-20T20:40:53.533Z",
* "last_activity_on": null,
* "email": "admin@amenda.test",
* "theme_id": 1,
* "color_scheme_id": 1,
* "projects_limit": 100000,
* "current_sign_in_at": "2017-12-27T10:02:50.945Z",
* "identities": [],
* "can_create_group": true,
* "can_create_project": true,
* "two_factor_enabled": false,
* "external": false,
* "is_admin": true
* }
*/
app.get('/api/v1/user', proxy('localhost:8000', {
proxyReqOptDecorator: proxyAuthorizationHeader,
proxyReqPathResolver: (req) => {
return '/admin/api/v4/user';
}
}));
app.get(
'/api/v1/user',
(req, res) => request.get(
'http://localhost:8000/admin/api/v4/'
+ '/user/'
)
.set(getRequestAuthorizationHeader(req))
.end((err, gitlabRes) => res.apiResponse(err, gitlabRes, 'user.njk'))
);
app.listen(3001, () => {
console.log('API server listening on port 3001');
......
{
"id": "{{ body.id }}",
"name": "{{ body.name }}",
"username": "{{ body.username }}",
"avatar_url": "{{ body.avatar_url }}"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment