Exemplo n.º 1
0
        },
        'private': {
            'type': "boolean"
        },
        'type': {
            'type': "string",
            'enum': ["upload", "gerrit", "github"]
        },
        'github_repo_name': {
            'type': "string"
        }
    },
    'required': ["name", "private", "type"]
}

add_project_model = api.schema_model('AddProject', add_project_schema)


@ns.route('/')
@api.response(403, 'Not Authorized')
class Projects(Resource):
    @api.marshal_list_with(project_model)
    def get(self):
        '''
        Returns user's projects
        '''
        projects = g.db.execute_many_dict(
            """
            SELECT p.id, p.name, p.type, p.public, co.role AS userrole
            FROM project p
            INNER JOIN collaborator co
Exemplo n.º 2
0
        },
        'private': {
            'type': "boolean"
        },
        'type': {
            'type': "string",
            'enum': ["upload", "gerrit", "github"]
        },
        'github_repo_name': {
            'type': "string"
        }
    },
    'required': ["name", "private", "type"]
}

add_project_model = api.schema_model('AddProject', add_project_schema)


@ns.route('/')
@api.response(403, 'Not Authorized')
class Projects(Resource):
    @api.marshal_list_with(project_model)
    def get(self):
        '''
        Returns user's projects
        '''
        projects = g.db.execute_many_dict(
            """
            SELECT p.id, p.name, p.type, p.public, co.role AS userrole
            FROM project p
            INNER JOIN collaborator co