https://github.com/laguna1/model-with-roles-2
https://github.com/laguna1/model-with-roles-2
database devise many-to-many postgresql rails
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/laguna1/model-with-roles-2
- Owner: Laguna1
- License: mit
- Created: 2021-11-11T14:30:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-20T20:58:31.000Z (over 4 years ago)
- Last Synced: 2025-03-28T08:44:55.706Z (over 1 year ago)
- Topics: database, devise, many-to-many, postgresql, rails
- Language: Ruby
- Homepage:
- Size: 4.52 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# README
There are three main models in this project:
* `User` - can create an account, log in to the account using a mobile phone number and password, log out of the account.
* `Role`-
- `Admin` - Can perform any CRUD operation on any resource,
- `Patient` - Can create and read visits. Can read own appointments,
- `Doctor` - Can read visits. Can create, read and update own appointments
* `Visit` - planned as a record of the patient for an appointment with a doctor (Model `Appointment`, as a result of the interaction of the `Patient` and the `Doctor`, will be created later)
* gem `devise` used for user authentication
* gem `cancancan` for user authorization
- The pages provide different interfaces and access rights for users with different roles
- Added several navigation links to the title according to the administrator's access rights


* Ruby version - `2.7.2`
- Rails version - `6.1.4.1`
- Postgres: >=9.5
* Clone this repo
- `https://github.com/Laguna1/Model-with-roles-2`
- `cd Model-with-roles-2`
* System dependencies
- `bundle install`
* Configuration
* Database creation
- `rails db:create`
* Database initialization
- `rails db:migrate`
* Start server
- `rails s`
- Open `http://localhost:3000/` in your browser
- `rails c` Creating the first visit:
- `v=Visit.create!(note: 'Headache', pat_id: 1, doc_id: 4)`
- `Visit.all` or Visit.all.count
- `v.pat` or v.pat.fullname
- `v.doc` or v.doc.fullname
- `User.first.created_visits`
- `User.first.created_visits.first.doc.fullname`
- `User.first.created_visits.first.doc.category.speciality`
- `User.fourth.requested_visits.first.pat.fullname`
- `User.fourth.requested_visits.first.note`
- `User.fourth.requested_visits.first.pat.role`
- `Visit.first` -
### Author
👤 **Oksana Petrova**
- GitHub: [@github/Laguna1](https://github.com/Laguna1)
- Linkedin: [linkedin/OksanaPetrova](https://www.linkedin.com/in/oksana-petrova/)
- Twitter: [@OksanaP48303303](https://twitter.com/OksanaP48303303)
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check the [issues page](https://github.com/Laguna1/Model-with-roles-2/issues).
## Show your support
Give a ⭐️ if you like this project!