Skip to content

A backend API built in Rust to hold logic for the Boiler Book Club library.

Notifications You must be signed in to change notification settings

BoilerBookClub/club-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Club Library

A backend application built in Rust to hold logic for the Boiler Book Club library. This was previously done purely through a google sheet, but we would like more accessible methods to be built. Currently, only basic features such as adding, borrowing, and returning are being prioritized. The project will hopefully encompass all the functions that a real library has, such as holds and renewals, in the future.

Installation

To run the application with the club library you must have access to the [email protected] account. Otherwise, you will have to modify the spreadsheet ID used in src/db/sheet.rs and supply your own. You can find a template for the spreadsheet here.

  1. Install Rust through rustup
  2. Clone this repository
  3. Create a credentials.json file in the top level club-library/ directory. You can obtain the ID and secret from the google API console. Populate it with something like the following:
{
    "installed": {
        "client_id": "your id",
        "client_secret": "your secret",
        "project_id": "your project id",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://accounts.google.com/o/oauth2/token",
        "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
    }
}
  1. Run the program with cargo run

Please also note that the program requests the API token for you and caches it. As a result, the first time you run it you will have to manually approve it by copy pasting a link. These tokens do expire, so this will need to be repeated every so often.

Usage

Once deployed, updating the sheet is easy. We have:

  • /books: A GET request to /books will return all books currently in the library.
  • /books: A POST request to /books will add a new book and require a title, author, genre, name, and email.
  • /borrowing: A POST request to /borrowing will require an id, name, and email
  • /borrowing: A GET request to /borrowing with a name and email will get a list of book that user is borrowing.
  • /returning: A POST request to /returning will require an id, name, and email.

For example, you could do:

localhost:3000/books?title=Siege and Storm&author=Leigh Bardugo&genre=YA Fantasy&name=Kai Tinkess&[email protected]

Checklist

These do not have tracking issues or PRs yet, but are good places to take the project.

  • Make status codes and errors more accurate
  • Add tracing through tower
  • Hard due dates
  • Renewals
  • Holds
  • Email Reminders
  • Removing books
  • Rename the project

Contributors

  • Kai Tinkess

Technology

  • Rust
  • Axum is the API crate of choice.
  • sheets4 is used to update the google sheet.
  • Various other crates like Tokio and Serde

About

A backend API built in Rust to hold logic for the Boiler Book Club library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages