---
# System prepended metadata

title: Bookmate

---

# Bookmate

"Bookmate" is a social network for book lovers.

## [Table of contents](#Table-of-contents)

1. [Description](#Description)
2. [Data source](#Data-source)
3. [User Stories](#User-stories)
   - [Authentication](#Authentication)
   - [Users](#Users)
   - [Friends](#Friends)
   - [Book List](#Book-List)
   - [Reviews](#Reviews)
   - [Search](#Search)
   - [Book Offer](#Book-Offer)
   - [Book Swap](#Book-Swap)
4. [Endpoint API](#API-Endpoint)
   - [Authentication APIs](#Authentication-APIs)
   - [Users APIs](#Users-APIs)
   - [Friends APIs](#Friends-APIs)
   - [Books APIs](#Books-APIs)
   - [Reviews APIs](#Reviews-APIs)
   - [BookOffer APIs](#BookOffer-APIs)
   - [BookSwap APIs](#BookSwap-APIs)

## Description

- "Bookmate" is a social network for book lovers.
- User can see the information of a book (title, author, reviews, book cover,...)
- User can search a book to read reviews about the book and write review about the book that user finished reading.
- User can find friends who have the same interest in books and send a friend request to send message or follow friend's list of books.
- User can exchange book with another users.
- Only registered users can search books, write reviews, find friends and exchange books

## Data source

[Kaggle](https://www.kaggle.com/)

## User stories

### Authentication

- As a user, I can register a new account with an unique username, unique email and password.
- As a user, I can register a new account with google account
- Password will be encrypted and protected from being seen.
- When logged in, registered user will be logged in persistently until user decides to logout
- After logged in, registered user can access their own account page and full homepage.

### Users

- As a user, I can see full homepage (include book swap information)
- As a user, I can write reviews for books
- As a user, I can find and send friend request to another users or accept/ reject my pending friend request
- As a user, I can offer books that I want to exchange with another users
- As a user, I can add my favorite books to my wishlist to swap when someone offers

### Friends

- As a user, I can send friend request to another user who is not my friend
- As a user, I can see list of friend requests I have received
- As a user, I can see list of friend requests I have sent
- As a user, I can see list of my friends
- As a user, I can accept or decline a friend request
- As a user, I can cancel a friend request that I sent
- As a user, I can unfriend a user in my friend list

### Book List

- As a user, I can see list of books on homepage.
- Only registered users can see the full list with reviews about books.

### Reviews

- As a user, I can see reviews of a book.
- As a user, I can write, edit or delete my reviews of a book.

### Search

- As a user, I can search book by title, author, ...

### Book Offer

- As a user, I can offer books that I want to exchange with another users
- As a user, I can see the list of books that I offered
- As a user, I can edit my book offer's info (description about book, change receiver, or status of book offer)
- As a user, I can delete my pending book offer that I created

### Book Swap (Book Exchange)

- As a user, I can apply to a book offer to borrow book that I want to read from another user
- As a user, I can see the list of books that I borrow
- As a user, I can delete my pending request for book offer

## Endpoint API

### Authentication APIs

```Javascript
/**
 * @route POST /auth/login
 * @description login with email and pass
 * @body { username, email, password }
 * @access public
 */
```

### Users APIs

```Javascript
/**
 * @route POST /users
 * @description Register new account
 * @body { username, email, password }
 * @access public
 */
```

```Javascript
/**
 * @route GET /users?page=1&limit=10
 * @description Get users with pagination
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /users/me
 * @description Get current user info
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /users/:id
 * @description Get a user info
 * @access Login required
 */
```

```Javascript
/**
 * @route PUT /users/:id
 * @description Update a user info
 * @body { name, avatarUrl, aboutMe, city, country, wishlist }
 * @access Login required
 */
```

### Friends APIs

```Javascript
/**
 * @route POST /friends/request
 * @description Send a friend request
 * @body { to: userId }
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /friends/request/incoming
 * @description Get the list of received pending requests
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /friends/request/outgoing
 * @description Get the list of sent pending requests
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /friends
 * @description Get the list of friends
 * @access Login required
 */
```

```Javascript
/**
 * @route PUT /friends/requests/:userId
 * @description Accepted/Reject a received pending friend request
 * @body { status: 'accepted' or 'declined' }
 * @access Login required
 */
```

```Javascript
/**
 * @route DELETE /friends/requests/:userId
 * @description Delete a received pending friend request
 * @access Login required
 */
```

```Javascript
/**
 * @route DELETE /friends/:userId
 * @description Remove a friend
 * @access Login required
 */
```

### Book List

```Javascript
/**
 * @route GET /books
 * @description Get the list of books
 * @access public
 */
```

```Javascript
/**
 * @route GET /books/:id
 * @description Get a single book
 * @access public
 */
```

### Reviews APIs

```Javascript
/**
 * @route GET /reviews/user/:userId?page=1&limit=10
 * @description Get all reviews an user can see with pagination
 * @access Login required
 */
```

```Javascript
/**
 * @route POST /reviews
 * @description Create a new review
 * @body { content }
 * @access Login required
 */
```

```Javascript
/**
 * @route DELETE /reviews/:id
 * @description Delete a review
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /reviews/:id
 * @description Get a single review
 * @access Login required
 */
```

```Javascript
/**
 * @route PUT /reviews/:id
 * @description Update a review
 * @body { content }
 * @access Login required
 */
```

### BookOffer APIs

```Javascript
/**
 * @route POST /bookoffer
 * @description Create new offer
 * @body { condition, points, delivery, status }
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /bookoffer?page=1&limit=10
 * @description Get all books on offer an user can see with pagination
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /bookoffer/:id
 * @description Get a single book on offer
 * @access Login required
 */
```

```Javascript
/**
 * @route PUT /bookoffer/:id
 * @description Update a book offer
 * @body { condition, points, delivery, status, receiver }
 * @access Login required
 */
```

```Javascript
/**
 * @route DELETE /bookoffer/:id
 * @description Delete a book offer
 * @access Login required
 */
```

### BookSwap APIs

```Javascript
/**
 * @route POST /bookswap
 * @description Create new book swap (book exchange)
 * @body { condition, points, delivery, status }
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /bookswap/incoming
 * @description Get the list of received pending bookswap
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /bookswap/outgoing
 * @description Get the list of sent pending bookswap
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /bookswap?page=1&limit=10
 * @description Get all books swap an user can see with pagination
 * @access Login required
 */
```

```Javascript
/**
 * @route GET /bookswap/:id
 * @description Get a single book swap
 * @access Login required
 */
```

```Javascript
/**
 * @route PUT /bookswap/:id
 * @description Update a book swap
 * @body { status }
 * @access Login required
 */
```

```Javascript
/**
 * @route DELETE /bookswap/:id
 * @description Delete a book swap
 * @access Login required
 */
```

## License

[HoaiAnh](https://github.com/hoaianh1611)
