Skip to content

Latest commit

 

History

History
118 lines (86 loc) · 1.27 KB

Design.md

File metadata and controls

118 lines (86 loc) · 1.27 KB

Entity

CREATE TABLE todos
(
    namespace  VARCHAR(36) NOT NULL,
    id         SERIAL      NOT NULL,
    content    TEXT        NOT NULL,
    status     VARCHAR(32) NOT NULl,
    created_at TIMESTAMP   NOT NULL,
    updated_at TIMESTAMP   NOT NULL,
    PRIMARY KEY (namespace, id)
);

API Endpoints

Common Header

t-ns short for todo namespace

t-ns: {NS}

GET /todos

get a list of todos

query

?status=todo

body

[
  {
    "id": 1,
    "namespace": "default",
    "content": "first thing",
    "status": "todo",
    "create_at": 1647151812778
  }
]

POST /todos

create a todo

body

{
  "content": "second thing"
}

PATCH /todos/{id}

update todo, available status:

  • todo
  • done
  • archive
{
  "content": "updated thing",
  "status": "done"
}

DELETE /todos/{id}

delete a archived todo

Status Transform

img.png

Project Structure

Common

shared by backend and frontend

- client.rs
- model.rs

Backend

- handlers/
    - todo_handler.rs
- domains/
    - todo_domain.rs
    - todo_repository.rs
- infra/
    - utils.rs
    - config.rs
    - db.rs

Frontend

- components/
- hooks.rs
- icons.rs
- states.rs