go_training

command module
v0.0.0-...-2132b1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 6 Imported by: 0

README

Yêu cầu chức năng:

  • User có thể tạo mới task. Mỗi ngày user được phép tạo tối đa N task (ví dụ: 1 ngày tạo tối đa 10 task)
  • Nếu user đã tạo max số task được tạo trong ngày. trả về lỗi 4xx cho client và từ chối request tạo mới task đó.

Yêu cầu phi chức năng:

  • Fork repository, và sử dụng PR khi bạn phát triển xong.
  • Sử dụng một loại db khác mà bạn thành thao nhất thay thế sqlite (MySql, Postgree, Oracle).
  • Phân chia thành các layer rõ ràng (service layer, use-case layer, storage 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL