Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
97 changes: 95 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,96 @@
# UE-AD-A1-REST
# Introduction

test
This Repo contains the Practical work on REST and FLASK

## Installation

### 1. With a docker container

If docker is installed on your computer, you must :

1. clone the github repository
2. open a cmd
3. go into the repository using

```bash
cd path/to/your/repository
```

4. open the docker app to start the kernel
5. run

```
docker-compose up --build
```

### 2. Without a docker container

If you don't have docker on your computer, you can :

1. clone the github repository
2. open a 4 cmd
3. go into the repository using

```bash
cd path/to/your/repository
```

4. go into showtimes using

```bash
cd ./showtime
```

5. then, to launch the service, use

```bash
python showtime.py
```

6. repeat in a different cmd for user, movie and booking

## What we did

We suceeded to finish the integrality of what was asked in this pratical work. Moreover, we add enough time to complexify a
the services Movies, Bookings and User. Let's see what we add in each service :

### Movies

As explained before we suceeded to produce a service movie which respects what was ask in the practical work.
Furthemore, we added few entry points which were not asked :

1. _/help_ which gives all the entries available in the service movie

2. _/directors_ which returns all the **directors** of the movies available

3. _/directors/<**movie_id**>/<**director_name**>_ which change the **director** of the movie with the id **movie_id**

4. _/movies_per_ratings_ which returns the list of the movies available \*sorted by **decreasing rate\***

5. _/movieid_linked_movietitle_ which returns a dict python which associates an **id** to a **movie name** (used in **User**)

We also added few **error code** to our service.

### Bookings

Same as above :

1. _/bookings/<**userid**>_ which change a little. Here decided to not throw and error and take account of the case when the _user isn't in the database_, when _the user is in the database and there isn't any bookings at the date_ given and finally when _the user is in the database and the date exists but the movie wasn't booked at this date_.

2. _/movies_at_the_date/<**date**>_ which calls the service showtime and return all the movies available at the date **date**

### User

We decided to deem this service as our frontend so all the entry points returns a html page associated with a template located in the folder _/templates_.

Moreover, we decided to suppose that user of this service give only his name and not his id. Thus we convert his name into an id thanks to the user.json database

Let's see what is able **User** :

1. _/movies_per_ratings_ : It is able to show the list of the movies available calling **Movies**.

2. _/movies_available/<**date**>_ : By calling **Movies** (to get the names of the movies) and **Bookings**, this service can show the name of the movies available at **date**.

3. _/book_a_movie_ : this entry call **Booking** to book a movie at the specified date. It needs to also call **Movies** because the user gives the name of the movie and we need the id of the movie

4. _/booking_made/<**username**>_ : It calls **Booking** to get all the bookings made by the user **username**
2 changes: 1 addition & 1 deletion booking/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ WORKDIR /app
COPY requirements.txt /app
RUN pip install -r requirements.txt
ADD . /app/
CMD ["python","-u","booking.py"]
CMD ["python","-u","booking.py","docker"]
43 changes: 43 additions & 0 deletions booking/UE-archi-distribuees-Booking-1.0.0-resolved.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,37 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/BookingsUser'
"201":
description: 'bad input parameter'
"400":
description: 'Wrong input"'
"409":
description: an existing item already exists
/movies_at_the_date/{date}:
get:
tags:
- admins
- developers
summary: get all the bookings available at the date date
description: Contact the API Times to get all the bookings available at the date date
operationId: get_movie_at_date
parameters:
- name: date
in: path
description: date of the booking
required: true
style: simple
schema:
type: string
responses:
"200":
description: Boonkings returned
content:
application/json:
schema:
$ref: '#/components/schemas/Schedule'
"400":
description: There was a problem with the request
components:
schemas:
AllBookings:
Expand Down Expand Up @@ -146,3 +175,17 @@ components:
movieid:
type: string
example: 276c79ec-a26a-40a6-b3d3-fb242a5947b6
Schedule:
required:
- date
- movies
type: object
properties:
date:
type: string
example: "20151130"
movies:
type: array
items:
type: string
example: 720d006c-3a57-4b6a-b18f-9b713b073f3c
Loading