{"id":19534788,"url":"https://github.com/berecat/django-rest-booking-api","last_synced_at":"2025-04-26T14:35:27.368Z","repository":{"id":171825842,"uuid":"505075013","full_name":"berecat/django-rest-booking-api","owner":"berecat","description":"A Restful api which allows you to book sports events or update existing odds.","archived":false,"fork":false,"pushed_at":"2023-06-02T02:27:19.000Z","size":3220,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-12T03:18:47.013Z","etag":null,"topics":["api","django","postgresql","python"],"latest_commit_sha":null,"homepage":"","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/berecat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-19T10:17:33.000Z","updated_at":"2023-06-02T02:32:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d2fa44a-4f44-4d9c-8157-5ee7a792d2a6","html_url":"https://github.com/berecat/django-rest-booking-api","commit_stats":null,"previous_names":["dreemhai/django-rest-booking-api","berecat/django-rest-booking-api"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berecat%2Fdjango-rest-booking-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berecat%2Fdjango-rest-booking-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berecat%2Fdjango-rest-booking-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berecat%2Fdjango-rest-booking-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berecat","download_url":"https://codeload.github.com/berecat/django-rest-booking-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224036197,"owners_count":17245035,"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":["api","django","postgresql","python"],"created_at":"2024-11-11T02:15:35.609Z","updated_at":"2024-11-11T02:15:36.887Z","avatar_url":"https://github.com/berecat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\"\u003eDjango RestApi Nested Serializers\u003c/h1\u003e\n\n\u003cimg src=\"https://github.com/gurupratap-matharu/midware/blob/master/staticfiles/img/hero.jpg\" alt=\"drawing\" width=\"1920\"/\u003e\n\n## LIVE\n\n\u003chttps://midware.herokuapp.com/api/v1/\u003e\n\n### Browsable Request API\n\n\u003cimg src=\"https://github.com/gurupratap-matharu/midware/blob/master/staticfiles/img/request.png\" alt=\"drawing\" width=\"1920\"/\u003e\n\n## Motivation 🎯\n\n- App suggestion based on interview assignment\n- Deployment with docker on heroku\n- Working with tools that are free for open source\n- Working with payment methods like stripe and REST apis\n\n## Features ✨\n\n- Manage data about sporting events to allow users to place bets.\n- Provide API to receive data from external providers and update our system with the latest data about events in real time.\n- Provide access to support team to allow the to see the most recent data for each event and to query data.\n- multiple connected models with foreign keys\n- nested serializers which permit showing related model in json\n- Updates only part of data based on request\n- Versioning of api possible see `/api/v1/`\n- Fast response time\n- Easily customizable with Login | Logout | reset password features and rest-token authentication\n- Make file for faster setup and reusability\n\n## Development setup 🛠\n\nSteps to locally setup development after cloning the project.\n\n`docker-compose up -d --build`\nor simple\n`make build` ;)\n\n## Requirements\n\nPython (3.4, 3.5, 3.6, 3.7)\nDjango (2.0, 2.1, 3.1)\n\n## Implementation Details\n\n* Data:\n  - Markets are unique per Sport\n  - Selections are unique per Market\n\n* Receiving data:\n  - For our purposes we can assume this API will be used by a single provider, so no need to keep track of which provider is sending the\n    message.\n\n## API Features\n\n* Listing all the match stored in the system\n* Filtering of listed items based on query parameters like `name`, `sport`, `ordering`\n* Detailed view of a particular match using its `id`\n* Uses nested serializers for detailed view for full details\n* Retrieve match by id. Ex \u003chttp://127.0.0.1:8000/api/match/994839351740\u003e\n* Retrieve football matches ordered by start_time Ex: \u003chttp://127.0.0.1:8000/api/match/?sport=football\u0026ordering=startTime\u003e\n* Retrieve matches filtered by name Ex: \u003chttp://127.0.0.1:8000/api/match/?name=Real%20Madrid%20vs%20Barcelona\u003e\n\n## Message Types\n\n* NewEvent:\nA complete new sporting event is being created. Once the event is created successfully\nthe only field that will updated is the selection odds.\n\n* UpdateOdds:\nThere is an update for the odds field (all the other fields remain unchanged)\n\n## How to run\n\nIf running on local machine do\n\n```python\npython manage.py runserver\n./manage.py runserver\n```\n\nYou can now open the API in your browser at \u003chttp://127.0.0.1:8000/api/\u003e, and view your new 'match' API.\nFor this exercise we are not using authentication. So all users have full CRUD access.\n\nIf you don't use the database provided on your local machine you need to do the\nmigrations and create a super user.\n\npython manage.py createsuperuser\n\nAccess admin panel at \u003chttp://127.0.0.1:8000/admin/\u003e\nFrom the admin panel you can do more operations like add, create and delete models,\nusers, do grouping, etc.\n\nYou can also interact with the API using command line tools such as curl. For example, to list the match endpoint:\n\nExample\n\nLet's take a look at a quick example of using REST framework to build a simple model-backed API.\n\nStartup up a new project like so...\n\n```python\npip install django\npip install djangorestframework\ndjango-admin startproject example .\n./manage.py migrate\n./manage.py createsuperuser\n```\n\nNow edit the `example/urls.py` module in your project:\n\n```python\nfrom django.conf.urls import url, include\nfrom django.contrib.auth.models import User\nfrom rest_framework import serializers, viewsets, routers\n\n# Serializers define the API representation.\nclass MatchListSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Match\n        fields = ('id', 'url', 'name', 'startTime')\n```\n\n```python\n\n\n# ViewSets define the view behavior.\nclass MatchViewSet(viewsets.ModelViewSet):\n    queryset = Match.objects.all()\n    serializer_class = MatchSerializer\n```\n\n```python\n\n# Routers provide a way of automatically determining the URL conf.\nrouter = routers.DefaultRouter()\nrouter.register(r'match', MatchViewSet)\n\n```\n\n```python\n# Wire up our API using automatic URL routing.\n# Additionally, we include login URLs for the browsable API.\nurlpatterns = [\n    url(r'^', include(router.urls)),\n    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))\n]\n\n```\n\nWe'd also like to configure a couple of settings for our API.\n\nAdd the following to your settings.py module:\n\n```python\nINSTALLED_APPS = (\n    ...  # Make sure to include the default installed apps here.\n    'rest_framework',\n)\n\nREST_FRAMEWORK = {\n    # Use Django's standard `django.contrib.auth` permissions,\n    # or allow read-only access for unauthenticated users.\n    'DEFAULT_PERMISSION_CLASSES': [\n        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'\n    ]\n}\n```\n\nDocumentation \u0026 Support\n\nFull documentation for the project is available at \u003chttps://www.django-rest-framework.org/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberecat%2Fdjango-rest-booking-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberecat%2Fdjango-rest-booking-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberecat%2Fdjango-rest-booking-api/lists"}