Skip to content

Community Bonding Period I

Tarun Kumar Singhal edited this page Jun 14, 2017 · 3 revisions

There has been a lot of excitement after getting the selection from Sugar Labs in Google Summer of Code 2017. I always wanted to contribute to open source projects and I definitely believe that this is going to be a great opportunity and learning experience for me.

Now I will start talking about the focus and importance of community bonding period. It is a great time to understand your mentors, community as well as the codebase because it is really necessary to lay out foundation properly before you can start building something on the top of it. During this period, our focus primarily consists of revising the proposal, understanding the code base and brainstorming of what exactly we are going to make for the next 3 months. Now I will discuss a bit more about the things that I have been working on during this period.

The overall discussion was the around redesign the current API for the sugarizer backend so that it is according to REST API standards, and can deal a large amount of data with features like filtering and pagination. After some discussion and exchange of emails, we have finally decided the routes for the API. They look as follows:

ACTIVITIES ROUTES

    [GET]  /api/v1/activities/org.olpcfrance.Abecedarium
    [GET]  /api/v1/activities/org.olpcfrance.Abecedarium?fields=id,name,icon
    [GET]  /api/v1/activities/
    [GET]  /api/v1/activities?q=Abece
    [GET]  /api/v1/activities?favorite=true
    [GET]  /api/v1/activities?version=2
    [GET]  /api/v1/activities?name=Gears
    [GET]  /api/v1/activities?favorite=true&version=2 
    [GET]  /api/v1/activities?fields=id,name,icon
    [GET]  /api/v1/activities?fields=id,name,icon&sort=-name
    [GET]  /api/v1/activities?fields=id,name,icon&favorite=true&sort=name

USERS ROUTES

    [POST]  /login
    [POST]  /signup
    [GET]   /api/v1/users
    [GET]   /api/v1/users/:uid
    [POST]  /api/v1/users
    [PUT]   /api/v1/users/:uid
    [GET]   /api/v1/adminusers
    [GET]   /api/v1/adminusers/:uid
    [POST]  /api/v1/adminusers
    [PUT]   /api/v1/adminusers/:uid
    [GET]   /api/v1/users?q=tarun&language=fr&page=3&limit=20

JOURNAL ROUTES

    [GET]    api/v1/journal/shared
    [GET]    api/v1/journal/:jid
    [GET]    api/v1/journal/:jid?fields=metadata,text
    [GET]    api/v1/journal/:jid?aid=:aid
    [GET]    api/v1/journal/:jid?aid=:aid&fields=metadata,text
    [GET]    api/v1/journal/:jid?aid=:aid&fields=metadata,text&page=3&limit=20&sort=-timestamp
    [GET]    api/v1/journal/:jid?uid=:uid
    [GET]    api/v1/journal/:jid?uid=:uid&fields=metadata,text
    [GET]    api/v1/journal/:jid?uid=:uid&fields=metadata,text&page=3&limit=20
    [GET]    api/v1/journal/:jid?uid=:uid&aid=:aid&fields=metadata,text&page=3&limit=20&sort=-timestamp
    [GET]    api/v1/journal/:jid?oid=:oid
    [POST]   api/v1/journal/:jid
    [GET]    api/v1/journal/:jid?oid=:oid
    [PUT]    api/v1/journal/:jid?oid=:oid
    [DELETE] api/v1/journal/:jid?oid=:oid

Next focus was coming out with a new folder structure for server directory. Here is finalized structure looks like:

    ├── sugarizer.js
    ├── package.json
    ├── apidoc.json
    ├── env
    │   ├── test.ini
    │   └── sugarizer.ini
    ├── docs
    │   ├── www
    │   ├── docfooter.md
    │   └── docheader.md
    ├── public /* dashboard style files would be here */
    │   ├── images
    │   ├── javascripts
    │   └── stylesheets
    │       └── style.css
    └── app
        ├── config
        │    ├── settings.js
        │    └── secret.js
        ├── models /* changed from routes to models */
        │    ├── auth.js
        │    ├── journal.js
        │    ├── activities.js
        │    └── users.js
        ├── test
        │    ├── auth.js
        │    ├── journal.js
        │    ├── activities.js
        │    └── users.js
        ├── controller /* dashboard logic would be here */
        │   ├── index.js
        │   ├── journal.js
        │   ├── activities.js
        │   └── users.js
        └── views /* dashboard html would be here */
            ├── error.ejs
            ├── index.ejs
            └── layout.ejs
        └── middleware
             ├── presense.js
             └── validate.js

Finally, my focus is on understanding the unit testing tool mocha and recommend some modification. So far it has been a good experience and I hope it will remain the same in future too.

Clone this wiki locally