Sunday 2 October 2016

GSoC'16 overview

summerofcode.withgoogle.com/archive/2016/projects/4901518415233024

It's been an entire month after GSoC'16 ended. I provided a GitHub link of my contributions as the final submission link. I didn't write a blog post covering my contributions. This post covers my work done during the GSoC period. It contains links to some of my posts at blog.fossasia.org. I mainly worked with the APIs and the Permissions system.

# APIs

Swagger

blog.fossasia.org/swagger

A part of the project was creating Swagger specification for our APIs. Our application was written in Flask and APIs were supposed to be written in Flask-RESTplus. The best part about RESTplus was its integration with Swagger. You could document your API Views and it would generate the specification. RESTplus provides Pluggable Resource views that can be extended for GET, POST, PUT and DELETE request handlers. It also provides decorators for documenting other details about the Resource, like response models and possible error responses.

API Error Response Models

blog.fossasia.org/errors-and-error-handlers-for-rest-api

During the initial GSoC period we spent some time on discussing how the APIs should be structured. Here's an Issue#336 of the same. Later that period I defined error response models for the APIs. Implementing them was quite easy with RESTplus.

ETag based caching for GET APIs

blog.fossasia.org/etag-based-caching-for-get-apis

This post includes implementing ETag based caching and how clients can cache responses based on the ETags.


# Permissions System

Roles and Permissions

blog.fossasia.org/organizer-server-permissions-system

Apart from the APIs I also worked a lot on the Servers Permission System. It included defining System Roles and Event Roles that could be assigned to users. The blog post covers these roles and their permissions in detail.

Shell Hacks

blog.fossasia.org/shell-hacks

A small post about some hacks I took up to increase productivity when using shell.

Permission Decorators for APIs

blog.fossasia.org/permission-decorators

If you have defined the APIs nicely, then implementing permissions becomes really easy. As I told before, Flask RESTplus provides a Resource class that has get(), post(), put(), delete() methods to deal with the different request methods. We had DAOs (Data Access Objects) defined for our database models that had create(), update() like methods defined for them. Every Resource was bound to a DAO, and fulfilling an HTTP request meant using a DAO method according to the request method.

To implement permissions, I created decorators over the DAO methods create(), read(), etc. The post is about the same.


# Real-Time user notifications

Setting up Nginx and Gunicorn for using Sockets

blog.fossasia.org/setting-up-nginx-gunicorn-and-flask-socketio

This post is about setting up environment for creating Real-Time user notifications.

Flask-SocketIO

blog.fossasia.org/flask-socketio-notifications

Implementing User notifications through WebSockets using Flask-SocketIO.


# Others

Apart from these I also worked on Tickets, mainly UI and form handling.

Multiple Tickets: UI

blog.fossasia.org/multiple-tickets-user-interface

Multiple Tickets: Backend

blog.fossasia.org/multiple-tickets-back-end

AJAX image upload

blog.fossasia.org/ajax-image-upload-at-wizard

User Notifications: DB model

blog.fossasia.org/user-notifications