Coder Social home page Coder Social logo

togo's Introduction

Notes

This is a simple backend for a todo service, right now this service can handle login/list/create simple tasks, to make it run:

  • go run main.go
  • Import Postman collection from docs to check example

Candidates are invited to implement the below requirements but the point is NOT to resolve everything perfectly but selective about what you can do best in a limited time.
Thus, there is no correct-or-perfect answer, your solutions are a way for us to continue the discussion and collaboration.

We're using Golang but candidates can use any language (NodeJS/Java/PHP/Python...) as long as:

  • You show us how to run reliably - many of us use Ubuntu, some use Mac
  • Your solution is compatible with our REST interface and we can use our Postman collection for verifying

Functional requirement:

Right now a user can add as many tasks as they want, we want the ability to limit N tasks per day.
For example, users are limited to create only 5 tasks only per day, if the daily limit is reached, return 4xx code to the client and ignore the create request.

Non-functional requirements:

  • A nice README on how to run, what is missing, what else you want to improve but don't have enough time
  • Consistency is a MUST
  • Fork this repo and show us your development progress by a PR
  • Write integration tests for this project
  • Make this code DRY
  • Write unit test for the services layer
  • Change from using SQLite to Postgres with docker-compose
  • This project includes many issues from code to DB structure, feel free to optimize them
  • Write unit test for storages layer
  • Split services layer to use case and transport layer

DB Schema

-- users definition

CREATE TABLE users (
	id TEXT NOT NULL,
	password TEXT NOT NULL,
	max_todo INTEGER DEFAULT 5 NOT NULL,
	CONSTRAINT users_PK PRIMARY KEY (id)
);

INSERT INTO users (id, password, max_todo) VALUES('firstUser', 'example', 5);

-- tasks definition

CREATE TABLE tasks (
	id TEXT NOT NULL,
	content TEXT NOT NULL,
	user_id TEXT NOT NULL,
    created_date TEXT NOT NULL,
	CONSTRAINT tasks_PK PRIMARY KEY (id),
	CONSTRAINT tasks_FK FOREIGN KEY (user_id) REFERENCES users(id)
);

Sequence diagram

auth and create tasks request

togo's People

Contributors

phi0411141 avatar lhtrieu87 avatar thaiquangquy avatar nvcnvn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.