Skip to content

Commit

Permalink
updated readme and document database schema
Browse files Browse the repository at this point in the history
  • Loading branch information
josueBarretogit committed Aug 4, 2024
1 parent 6efe9ec commit c662226
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 6 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ https://github.com/user-attachments/assets/2b693bd3-ec30-4d6e-bcc4-6cf457a860b1

https://github.com/user-attachments/assets/c1e21aa1-8a51-4c47-baea-9f56dcd0d6a4

- Read manga in your terminal
- Read manga in your terminal (Wezterm, iTerm2, or Kitty, any terminal that has support for graphics protocol)

https://github.com/user-attachments/assets/70f321ff-13d1-4c4b-9c37-604271456ab2

Expand All @@ -51,6 +51,9 @@ https://github.com/user-attachments/assets/64880a98-74c8-4656-8cf8-2c1daf5375d2
```shell
cargo install manga-tui
```
## Binary release

Download a binary from the [binary release]()

## Image rendering

Expand Down Expand Up @@ -85,7 +88,7 @@ On the `manga-tui` directory there will be 3 directories

If you want to change the location you can set the environment variable `MANGA_TUI_DATA_DIR` to some path pointing to a directory, like: <br />

export MANGA_TUI_DATA_DIR="/home/user/Desktop/mangas"
`export MANGA_TUI_DATA_DIR="/home/user/Desktop/mangas"`

## Configuration

Expand All @@ -97,7 +100,7 @@ By default `manga-tui` will search mangas in english, you can change the languag
manga-tui lang --set 'es'
```

Check the available languages by running:
Check the available languages and their Iso codes by running:


```shell
Expand All @@ -110,7 +113,7 @@ I wanted to make a "How linux user does ..." but for manga, [here is the video](
## Credits

Many thanks to Mangadex for providing the free API please consider supporting them ❤️ <br />
Many thanks to [Ratatui](https://github.com/ratatui-org) for making such a good library for making TUI's 🐭 <br />
Many thanks to the [Ratatui organization](https://github.com/ratatui-org) for making such a good library for making TUI's 🐭 <br />
Many thanks to the developer of the [Ratatui-image crate](https://crates.io/crates/ratatui-image) for providing a widget that renders images in the terminal 🖼️ <br />

Consider giving a start to this project ⭐
Consider giving a star to this project ⭐
1 change: 1 addition & 0 deletions src/backend/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub static DBCONN: Lazy<Mutex<Option<Connection>>> = Lazy::new(|| {
)
.unwrap();


let already_has_data: i32 = conn
.query_row("SELECT COUNT(*) from app_version", [], |row| row.get(0))
.unwrap();
Expand Down
64 changes: 64 additions & 0 deletions src/backend/database_scheme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
# Manga-tui sqlite database

# app_version

This table is used to keep track of what version the user has installed on their machines, maybe this will be useful for future updates idk

- version
- type: TEXT PRIMARY KEY


# history_types

The types of history, which are : `ReadingHistory` and `PlanToRead`

- id
- type: INTEGER PRIMARY KEY AUTOINCREMENT
- name
- type: TEXT NOT NULL UNIQUE

# mangas

To store which mangas the user is reading

- id
- type : TEXT PRIMARY KEY
- title
- type: TEXT NOT NULL,
- created_at
- type: DATETIME DEFAULT (datetime('now'))
- updated_at
- type: DATETIME DEFAULT (datetime('now'))
- last_read
- type: DATETIME DEFAULT (datetime('now'))
- deleted_at
- type: DATETIME NULL
- img_url
- type: TEXT NULL

# chapters

To know which chapters the user has read

- id
- type: TEXT PRIMARY KEY
- title
- type: TEXT NOT NULL
- manga_id
- type: TEXT NOT NULL
- is_read
- type: BOOLEAN NOT NULL DEFAULT 0
- is_downloaded
- type: BOOLEAN NOT NULL DEFAULT 0

FOREIGN KEY (manga_id) REFERENCES mangas (id)

# manga_history_union

To query mangas that are in reading history or plan to read

- manga_id
- type: TEXT
- type_id
- type: INTEGER

PRIMARY KEY (manga_id, type_id),
FOREIGN KEY (manga_id) REFERENCES mangas (id),
FOREIGN KEY (type_id) REFERENCES history_types (id)
3 changes: 2 additions & 1 deletion src/view/pages/manga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl MangaPage {
.send(MangaPageActions::ToggleOrder)
.ok();
}
KeyCode::Char('r') => {
KeyCode::Char('r') | KeyCode::Enter => {
if PICKER.is_some() {
self.local_action_tx
.send(MangaPageActions::ReadChapter)
Expand Down Expand Up @@ -436,6 +436,7 @@ impl MangaPage {
.send(MangaPageActions::SearchPreviousChapterPage)
.ok();
}

_ => {}
}
}
Expand Down

0 comments on commit c662226

Please sign in to comment.