https://github.com/kananinirav/sleep_tracker
Sleep Tracker
https://github.com/kananinirav/sleep_tracker
api ruby ruby-on-rails sleep-tracker
Last synced: 2 months ago
JSON representation
Sleep Tracker
- Host: GitHub
- URL: https://github.com/kananinirav/sleep_tracker
- Owner: kananinirav
- Created: 2023-03-15T01:41:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-18T08:34:08.000Z (over 3 years ago)
- Last Synced: 2025-05-29T09:03:01.294Z (about 1 year ago)
- Topics: api, ruby, ruby-on-rails, sleep-tracker
- Language: Ruby
- Homepage:
- Size: 955 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sleep Tracker
## Features
- User Create
- User Can Follow And Un-follow Each Other
- User Can Tracking Sleep Time (Using Clock In And Clock Out Event)
- User Can View It's Friend Sleep Time Data
## Technologies and Gems used
- Ruby on Rails (Ruby: 3.2.0, Rails: 7.0.4)
- Test Framework (Rspec)
- Factory_bot_rails
- PostgreSQL@14
- Database_cleaner (clean the database before running tests)
- shoulda-matchers (Simple one-liner tests for common Rails functionality)
- apipie-rails (for api documentation)
## DB Design
- [User](/db_design.md#user)
- [Sleep Tracking](/db_design.md#sleep-tracking)
- [User Friendship](/db_design.md#user-friendship)
### Relations
- User has many sleep tracking records
- User has many followers
- User has many followings
## Setup
```sh
# Clone Repository
git clone https://github.com/kananinirav/sleep_tracker.git
# Go to Folder
cd ./sleep_tracker
# Run bundle to install dependencies
bundle
# Create Database
rails db:create
# Run migration
rails db:migrate
# Finally start server
rails s
# APIs Documentations
open http://localhost:3000/apipie/
```
## Run Specs
```sh
bundle exec rspec
```
## APIs List
| No. | End Point | Request Type | Description |
| --- | ---------------------------------------------------- | ------------ | --------------------------------------------- |
| 1. | /api/v1/users | POST | Create User |
| 2. | /api/v1/users/:user_id/follow/:following_id | POST | Follow User |
| 3. | /api/v1/users/:user_id/unfollow/:following_id | DELETE | Un-Follow User |
| 4. | /api/v1/users/:user_id/sleep_trackings | GET | User Friends Last Week Sleep Tracking Records |
| 5. | /api/v1/users/:user_id/sleep_trackings/clock_in | POST | Clock In Event |
| 6. | /api/v1/users/:user_id/sleep_trackings/clock_out | PATCH | Clock Out Event |
## APIs Documentations
For API documentations i have used `apipie-rails` gem, For more details about each APIs setup project and open `/apipie` url
### You can see screen like below with each APIs links

#### For example if you want to see sleep trackings APIs details then click on `Sleep trackings` link


#### For more details about each API click right side `>>>` link