Pomidori Project — Solving distractions — Episode #1 recap

Stephens Xu
Fullstack Network
Published in
2 min readJul 6, 2017

--

Time management and the ability to focus is one of the most important skills for pretty much everyone in our professional lives.

If you haven’t heard of it before, Pomodoro Technique is the a method for helping ourselves to stay focused for a defined time interval(honestly I haven’t heard of it before yesterday).

Avi had an idea about building a cloud integrated Pomodoro timer that can help removing distraction at work and track our records. The most interesting part is we are planning to work on both hardware and software(and everything will be open sourced). I’m really thrilled about this project, not only because I’d be able to learn a lot but also this is actually something I’d love to have and use in real life.
Details of plan see this blog.

In short, here is the short list of components we are planning to work on:

Server application(Node.js, postgresSQL, Google Compute Engine)
OSX Client — Electron and Node.js
Mobile Client — React Native
Web Client(React and Redux)
LED light with USB connector(yes! a physical box with LED light and connects to laptop)

Last night was the first session in this series. We started with the nodeJS server application. See source code here

We started with a boilerplate node Express application. First thing we wanted to build a Task model, this model will represent a single pomodoro, which is the time interval the user wanted to focus on and keep track of. This task will be associated with its user and have a Status such as started, in-progress and stopped etc. Task schema look like this:

const TaskSchema = new mongoose.Schema({
userId: { type: String, unique: false },
title: { type: String, unique: false },
startTime: { type: Date, unique: false, default: Date.now },
taskTime: { type: Number, unique: false },
taskStatus: { type: Number, unique: false, default: TaskStatus.STARTED },
createdAt: { type: Date, default: Date.now }
})

A TaskFactory for testing purpose

export default class TaskFactory {
static create(taskObject) {
let task = new Task(taskObject);
return task.save()
}
}

And specs

describe('## Task APIs', () => {
it('should create a new task', () => {
expect.assertions(1);

return TaskFactory.create({ userId: "xxx", taskTime: 25 }).then(task => {
console.log(task);
expect(task).toBeTruthy()
}).catch((err) => {
console.log(err);
});
});

it('should create a new task with the default status', () => {
expect.assertions(1);

return TaskFactory.create({ userId: "xxx", taskTime: 25 }).then(task => {
expect(task.taskStatus).toEqual(TaskStatus.STARTED);
}).catch((err) => {
console.log(err);
});
});
});

We use supertest as our testing library and it actually took quit a bit of time to get the specs right. Javascript testing can be such a pain comparing with Rails and even Go. It wasn’t really anything complicated but rather about the lack of visibility of what the problem is when tests failed or timed out.

The plan for next session we will build an asynchronous worker that checks and changes the Status of this task object when different even triggers.

Join here for live streaming of the session. We are streaming daily at 8pm PST and all of the episodes will go on the YouTube channel as well

--

--