Completed
Push — master ( 739b7a...711b3d )
by Glenn
01:21
created

skf/api/projects/endpoints/project_stats.py (2 issues)

Severity
1
2
from flask import request
0 ignored issues
show
Unused request imported from flask
Loading history...
3
from flask_restplus import Resource
4
from skf.api.security import security_headers, validate_privilege, select_userid_jwt
5
from skf.api.projects.business import stats_project
6
from skf.api.projects.serializers import message, project_stats
7
from skf.api.projects.parsers import authorization
8
from skf.api.restplus import api
9
10
ns = api.namespace('project', description='Operations related to project items')
11
12
13
@ns.route('/stats/<int:id>')
14
@api.doc(params={'id': 'The project id'})
15
@api.response(404, 'Validation error', message)
16
class ProjectStats(Resource):
17
18
    @api.expect(authorization)
19
    @api.marshal_with(project_stats)
20
    @api.response(400, 'No results found', message)
21
    def get(self, id):
22
        """
23
        Returns project stats.
24
        * Privileges required: **read**
25
        """
26
        validate_privilege(self, 'read')
27
        user_id = select_userid_jwt(self)
0 ignored issues
show
The variable user_id seems to be unused.
Loading history...
28
        result = stats_project(id)
29
        return result, 200, security_headers()
30
31