{"id":15448209,"url":"https://github.com/laguna1/model-with-roles-2","last_synced_at":"2026-04-12T09:41:26.720Z","repository":{"id":45557488,"uuid":"427031168","full_name":"Laguna1/Model-with-roles-2","owner":"Laguna1","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-20T20:58:31.000Z","size":4738,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T08:44:55.706Z","etag":null,"topics":["database","devise","many-to-many","postgresql","rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Laguna1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-11T14:30:12.000Z","updated_at":"2022-01-20T19:53:03.000Z","dependencies_parsed_at":"2022-09-23T16:51:38.353Z","dependency_job_id":null,"html_url":"https://github.com/Laguna1/Model-with-roles-2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"Laguna1/Model-with-roles","purl":"pkg:github/Laguna1/Model-with-roles-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laguna1%2FModel-with-roles-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laguna1%2FModel-with-roles-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laguna1%2FModel-with-roles-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laguna1%2FModel-with-roles-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Laguna1","download_url":"https://codeload.github.com/Laguna1/Model-with-roles-2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laguna1%2FModel-with-roles-2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272116772,"owners_count":24876266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","devise","many-to-many","postgresql","rails"],"created_at":"2024-10-01T20:22:34.904Z","updated_at":"2026-04-12T09:41:21.689Z","avatar_url":"https://github.com/Laguna1.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\nThere are three main models in this project:\n* `User` - can create an account, log in to the account using a mobile phone number and password, log out of the account.\n* `Role`-\n- `Admin` - Can perform any CRUD operation on any resource,\n- `Patient` - Can create and read visits. Can read own appointments, \n- `Doctor` - Can read visits. Can create, read and update own appointments\n* `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)\n* gem `devise` used for user authentication\n* gem `cancancan` for user authorization\n- The pages provide different interfaces and access rights for users with different roles\n- Added several navigation links to the title according to the administrator's access rights\n\n![/admin/vizits](./app/assets/images/vizits.png)\n![/admin/roles](./app/assets/images/roles.png)\n\n* Ruby version - `2.7.2`\n- Rails version - `6.1.4.1`\n- Postgres: \u003e=9.5\n\n* Clone this repo\n- `https://github.com/Laguna1/Model-with-roles-2`\n- `cd Model-with-roles-2` \n\n* System dependencies\n- `bundle install`\n* Configuration\n\n* Database creation\n- `rails db:create`\n\n* Database initialization\n- `rails db:migrate`\n\n* Start server\n- `rails s`\n- Open `http://localhost:3000/` in your browser\n\n\n- `rails c` Creating the first visit:\n- `v=Visit.create!(note: 'Headache', pat_id: 1, doc_id: 4)`\n- `Visit.all` or Visit.all.count\n- `v.pat` or v.pat.fullname\n- `v.doc` or v.doc.fullname\n- `User.first.created_visits`\n- `User.first.created_visits.first.doc.fullname`\n- `User.first.created_visits.first.doc.category.speciality`\n- `User.fourth.requested_visits.first.pat.fullname`\n- `User.fourth.requested_visits.first.note`\n- `User.fourth.requested_visits.first.pat.role`\n- `Visit.first` - \u003cVisit id: 1, date: \"2021-12-12 10:30:00.000000000 +0000\", note: \"Headache\", pat_id: 1, doc_id: 4, created_at: \"2021-12-07 00:07:25.766721000 +0000\", updated_at: \"2021-12-07 02:31:26.303473000 +0000\"\u003e\n\n### Author\n\n👤 **Oksana Petrova**\n\n- GitHub: [@github/Laguna1](https://github.com/Laguna1)\n- Linkedin: [linkedin/OksanaPetrova](https://www.linkedin.com/in/oksana-petrova/)\n- Twitter: [@OksanaP48303303](https://twitter.com/OksanaP48303303)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\n\nFeel free to check the [issues page](https://github.com/Laguna1/Model-with-roles-2/issues).\n\n## Show your support\n\nGive a ⭐️ if you like this project!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaguna1%2Fmodel-with-roles-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaguna1%2Fmodel-with-roles-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaguna1%2Fmodel-with-roles-2/lists"}