{"id":16771559,"url":"https://github.com/meysam81/yara","last_synced_at":"2025-11-02T04:30:25.202Z","repository":{"id":39844779,"uuid":"175000019","full_name":"meysam81/yara","owner":"meysam81","description":"A project defined in an interview session","archived":true,"fork":false,"pushed_at":"2024-06-26T19:43:59.000Z","size":42,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T15:50:31.306Z","etag":null,"topics":["authentication","django","django-rest-framework","django-rest-framework-jwt","python","sqlite3","throttling"],"latest_commit_sha":null,"homepage":"https://yaramobile.com/","language":"Python","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/meysam81.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":"2019-03-11T12:56:06.000Z","updated_at":"2024-09-18T15:05:46.000Z","dependencies_parsed_at":"2022-08-27T17:21:35.174Z","dependency_job_id":null,"html_url":"https://github.com/meysam81/yara","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysam81%2Fyara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysam81%2Fyara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysam81%2Fyara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysam81%2Fyara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meysam81","download_url":"https://codeload.github.com/meysam81/yara/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239377698,"owners_count":19628584,"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","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":["authentication","django","django-rest-framework","django-rest-framework-jwt","python","sqlite3","throttling"],"created_at":"2024-10-13T06:28:30.872Z","updated_at":"2025-11-02T04:30:25.140Z","avatar_url":"https://github.com/meysam81.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yara\nThis repository is a project demanded by an interviewer at [Yara Corp.](https://yaramobile.com/) to implement a simple and basic RESTful server using the following stacks:\n* [Django](https://www.djangoproject.com/)\n* [Django REST Framework](https://www.django-rest-framework.org/)\n\n## Model\nThe so-called DB in this project is a single table containing the following fields:\n\n\n| Field Name    |  Data Type                 | Constraint       |\n|---------------|--------------------------- |------------------|\n| purchase_date |  `datetime`                |                  |\n| purchase_name |  `string`                  | max_length=150   |\n| user_id       |  `integer`                 |                  |\n| username      |  `string (max_length=150)` | max_length=150   |\n| phone_number  |  `string (max_length=20)`  | max_length=20    |\n| email         |  `string (max_length=150)` | max_length=150   |\n| address       |  `text`                    |                  |\n\n## Prerequisite\nThis project was written using `python3.7.2`, so you might as well install that before going any further.\n[Python Official Website](https://www.python.org/)\n\nYou'll have to run this project in an environment, so I recommend installing them first hand.\n```bash\npip install -U pip # install the latest pip, as it is updating frequently\npip install virtualenv\n```\n\n## Quickstart\nYou can clone the repository using the following comands in your terminal:\n```bash\ngit clone git@github.com:meysam81/yara.git\n```\n\nAnd then:\n```bash\ncd yara\n```\n\nNow you're gonna have to create a new virtual environment inside the project's root directory.\n```bash\nvirtualenv venv\nsource ./venv/bin/activate\n``` \n\nNow install the requirements:\n```bash\npip install -r requirements.txt\n```\n\nNow you are good to go, just run the server and have fun :smiley:\n```bash\npython manage.py runserver\n```\n### Base URL\nThis is what you should prepend to every requesting URL:\n```\nlocalhost:8000\n```\n### Login\nAnd you can login to the server using the following endpoint:\n```bash\nPOST /api/login/\n```\n\nWith the body:\n```json\n{\n  \"username\": \"\u003cusername\u003e\",\n  \"password\": \"\u003cpassword\u003e\"\n}\n```\n\nOf course you're gonna have to insert some username \u0026 password in the DB so here's how you can do that. Enter the following command in your terminal:\n```bash\npython manage.py shell\n```\n\nAnd then:\n```python\nfrom django.contrib.auth.models import User\nu = User(username=\"\u003cusername\u003e\", password=\"\u003cpassword\u003e\")\nu.save()\n```\n\nAfter logging in from the login endpoint, a token is given back to you in a json format:\n```json\n{\n  \"token\": \"\u003ctoken\u003e\"\n}\n```\n\nInclude that token in every of your request's Header:\n```\nAuthorization: Bearer \u003ctoken\u003e\n```\n### Service Endpoints\nAnd now you have access to not only reading the database, but also insert, update \u0026 deleting an object from the database:\n\n| Method  | Endpoint                       | Permission                 |\n| --------|--------------------------------|----------------------------|\n| GET     | /purchases/                    | anonymous access available |\n| GET     | /purchases/{ID}/               | anonymous access available |\n| POST    | /purchases/                    | authenticated access only  |\n| DELETE  | /purchases/{ID}/               | authenticated access only  |\n| PUT     | /purchases/{ID}/               | authenticated access only  |\n| PATCH   | /purchases/{ID}/               | authenticated access only  |\n\nCheers! :clinking_glasses: \nAnd have fun. :100: \n\n## Contribute\nI don't know why you'd wanna do that, but PR's are welcomed anytime :relaxed:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeysam81%2Fyara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeysam81%2Fyara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeysam81%2Fyara/lists"}