Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location resource classes #38

Open
wants to merge 160 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
3a9e64d
Create home
ivanmilara Nov 13, 2018
21ff107
Update home
ivanmilara Nov 13, 2018
3af32fd
Update home
ivanmilara Nov 13, 2018
438edae
Update home
ivanmilara Nov 13, 2018
be5b544
Update home
ivanmilara Nov 14, 2018
2904d37
Update home
ivanmilara Nov 14, 2018
b77f849
Update home
ivanmilara Nov 14, 2018
d54ff76
Update home
ivanmilara Nov 14, 2018
ace01f9
Update home
ivanmilara Nov 14, 2018
3639b97
Update home
ivanmilara Nov 14, 2018
01c0952
Update home
ivanmilara Dec 3, 2018
6f2d238
Update home
ivanmilara Dec 3, 2018
85c579d
Update home
ivanmilara Dec 3, 2018
2b8d277
Update home
ivanmilara Dec 3, 2018
bcd6f49
Update home
ivanmilara Dec 3, 2018
759a3c5
Create RESTTful API description
ivanmilara Dec 3, 2018
5a9ddb9
Update RESTTful API description
ivanmilara Dec 3, 2018
09ced34
Create database design and implementation
ivanmilara Dec 3, 2018
f7fbcef
Create restful api design
ivanmilara Dec 3, 2018
87d21da
Create restful api implementation
ivanmilara Dec 3, 2018
f41b998
Create restful client design and implementation
ivanmilara Dec 3, 2018
3273aef
Create analysis and reflection
ivanmilara Dec 3, 2018
b2c3284
Update RESTTful API description
ivanmilara Dec 3, 2018
b3ecc80
Update RESTTful API description
ivanmilara Dec 3, 2018
b7ca898
Update RESTTful API description
ivanmilara Dec 3, 2018
e70727d
Update RESTTful API description
ivanmilara Dec 3, 2018
32f9e72
Update RESTTful API description
ivanmilara Dec 3, 2018
87ff04f
Update RESTTful API description
ivanmilara Dec 3, 2018
78de78d
Update RESTTful API description
ivanmilara Dec 3, 2018
aa2f180
Update RESTTful API description
ivanmilara Dec 3, 2018
96a0686
Update RESTTful API description
ivanmilara Dec 3, 2018
78d8433
Update RESTTful API description
ivanmilara Dec 3, 2018
28d1f2f
Update RESTTful API description
ivanmilara Dec 7, 2018
0c5400d
Update RESTTful API description
ivanmilara Dec 10, 2018
84174f6
Added sidebar
ivanmilara Dec 10, 2018
87d1bf7
Done sidebar
ivanmilara Dec 10, 2018
8404a23
Added api description
ivanmilara Dec 10, 2018
7cb66cf
Added the database
ivanmilara Dec 11, 2018
2dc7a8e
Upload attachment Forum_state_diagram.png
ivanmilara Dec 11, 2018
bf30929
Added first version of document
ivanmilara Dec 11, 2018
19bcc7b
Merge branch 'master' of gitlab.com:programmable-web-project-/pwp-.wiki
ivanmilara Dec 11, 2018
8ae2143
Update restful api implementation
ivanmilara Dec 11, 2018
9fc98c4
Update extra_work
ivanmilara Dec 11, 2018
4ae1859
Update extra_work
ivanmilara Dec 11, 2018
635032f
Removed .md from sidebar
ivanmilara Dec 11, 2018
1fb7e26
Merge branch 'master' of gitlab.com:programmable-web-project-/pwp-.wiki
ivanmilara Dec 11, 2018
9a1a783
modified first line
ivanmilara Dec 12, 2018
2a2ac05
Corrected some headlines
ivanmilara Dec 12, 2018
9ef4e6c
space after pencil
ivanmilara Dec 12, 2018
81ce645
Added grades
ivanmilara Dec 12, 2018
cfa3ce7
Solving format from this section
ivanmilara Dec 12, 2018
8b27d7f
Clarified chapter evaluation and summary
ivanmilara Dec 12, 2018
07353b9
Update analysis and reflection
ivanmilara Dec 12, 2018
9108a3b
Updated Section 1
ivanmilara Jan 14, 2019
13bbd33
Updated database
ivanmilara Jan 14, 2019
faf9525
Small changes to database
ivanmilara Jan 14, 2019
aed974e
RESTful implementation modified
ivanmilara Jan 14, 2019
4971778
Tuned evaluation design
ivanmilara Jan 14, 2019
219d6a9
Tuned client
ivanmilara Jan 14, 2019
0e795db
Tuned client
ivanmilara Jan 14, 2019
a1e4380
Tuned client
ivanmilara Jan 14, 2019
5c07321
Tuned analysis
ivanmilara Jan 14, 2019
7a81082
Tuning analisys
ivanmilara Jan 14, 2019
557fe69
Tuned api implementation
ivanmilara Jan 14, 2019
882932b
Initial Home page
ivanmilara Jan 14, 2019
9eb54eb
Update Database design and implementation
ivanmilara Jan 18, 2019
f62365e
Merge branch 'master' of https://gitlab.com/programmable-web-project-…
ivanmilara Jan 18, 2019
bbbb633
Minor grammar corrections
ivanmilara Jan 19, 2019
716b283
added home
ivanmilara Jan 19, 2019
228e098
Temporal remove home to solve problems with github
ivanmilara Jan 19, 2019
fc7026b
Added home.md to solve problems with github
ivanmilara Jan 19, 2019
1fb8bd1
Small correction in RESTful API implementation. Removed 0.5
ivanmilara Feb 12, 2019
cadd8b4
Update Database design and implementation
ivanmilara Feb 18, 2019
de87216
Update Database design and implementation
ivanmilara Feb 18, 2019
1b0185c
Removed unnecessary requirements in the Uniform Interface section
ivanmilara Feb 26, 2019
b371f2a
Updated RESTful API design (markdown)
ivanmilara Feb 26, 2019
96f30ad
Removed code comment related scoring criteria, distributed the points
Jun 5, 2019
ad3eae6
Merge branch 'master' of https://gitlab.com/programmable-web-project-…
Jun 5, 2019
0d66b4c
fixing commit mess
Jun 5, 2019
caee743
Added changed to evaluation in 2020
ivanmilara Jan 20, 2020
f0de8d5
Solving conflicts
ivanmilara Jan 20, 2020
925aa60
Small problem in grading of deadline 1
ivanmilara Jan 20, 2020
6a968c4
Solved a new mismatch in evaluation
ivanmilara Jan 20, 2020
60e62ea
Updated RESTful-Api
ivanmilara Jan 20, 2020
5587058
Removed replica in implementation
ivanmilara Jan 20, 2020
75cc1a8
moved Project management and exercises at the end
ivanmilara Jan 20, 2020
5e3adde
Other errors
ivanmilara Jan 21, 2020
e2836e5
Created sidebar
ivanmilara Jan 21, 2020
50d15f1
Change naming for DL2
ivanmilara Jan 18, 2021
82de2f1
Changed grades in database implementation)
ivanmilara Jan 18, 2021
7e9edbf
Modified year 2021
ivanmilara Jan 18, 2021
6ddf65d
Corrected minor mismatch in grading in database
ivanmilara Jan 18, 2021
b15ca60
Added points for giving feedback in palaute
ivanmilara Jan 21, 2021
adca79c
Adding grading to course feedback
ivanmilara Jan 21, 2021
a79b268
Updated RESTTful API description (markdown)
enkwolf Jan 12, 2022
83e0e8a
Updated RESTTful API description (markdown)
enkwolf Jan 24, 2022
2193f51
Updated RESTTful API description (markdown)
enkwolf Jan 24, 2022
214f5e3
Updated Database design and implementation (markdown)
enkwolf Jan 24, 2022
8a20da7
Updated _sidebar (markdown)
enkwolf Jan 24, 2022
3a30de6
Updated restful api implementation (markdown)
enkwolf Jan 24, 2022
573c02c
Updated RESTful API design (markdown)
enkwolf Jan 24, 2022
b150ab4
Updated RESTful API documentation and hypermedia (markdown)
enkwolf Jan 24, 2022
9d5c139
Updated RESTful API documentation and hypermedia (markdown)
enkwolf Jan 24, 2022
86f77e3
Updated RESTful API documentation and hypermedia (markdown)
enkwolf Jan 24, 2022
c69a1a6
Updated RESTful API documentation and hypermedia (markdown)
enkwolf Jan 24, 2022
aa358f0
Updated restful api implementation (markdown)
enkwolf Jan 24, 2022
c01880c
Updated restful api implementation (markdown)
enkwolf Jan 24, 2022
94ed18a
Updated Database design and implementation (markdown)
enkwolf Jan 24, 2022
b57ecc1
Updated RESTTful API description (markdown)
enkwolf Jan 24, 2022
e835c3d
Updated RESTful client design and implementation (markdown)
enkwolf Jan 24, 2022
c456688
Updated RESTful client design and implementation (markdown)
enkwolf Jan 24, 2022
8d68258
Updated restful api implementation (markdown)
enkwolf Jan 25, 2022
323b236
Updated _sidebar (markdown)
enkwolf Jan 25, 2022
813f3b6
Updated _sidebar (markdown)
enkwolf Jan 25, 2022
ff4019d
Updated RESTful API documentation and hypermedia (markdown)
enkwolf Jan 25, 2022
7ad26a7
Modified for 2023
Jan 24, 2023
f09ffc5
Removed the connectedness condition for non-hypermedia
Jan 24, 2023
f132f3b
Minor stetic corrections
Jan 24, 2023
e41dd43
Minor styling changes
ivanmilara Jan 24, 2023
ffac220
Add missing evaluation criteria in Project Management
ivanmilara Jan 24, 2023
2c6c37f
Project plan: clarified that they must include client/service
ivanmilara Jan 24, 2023
e587d6d
Updated for 2024
ivanmilara Jan 7, 2024
baa830f
Merge branch 'master' of https://github.com/programmable-web-project-…
khacha329 Jan 25, 2024
972619a
initial commit
khacha329 Jan 25, 2024
2a0d2e9
fixed readme
khacha329 Jan 25, 2024
436c277
added skeleton files
khacha329 Feb 6, 2024
450e21b
Create db.py
talha-zshan Feb 7, 2024
eaf01d0
add gitignore
talha-zshan Feb 7, 2024
760f105
restructure + db initialization and population
talha-zshan Feb 7, 2024
ec7b81c
minor fixes
talha-zshan Feb 7, 2024
98fb4fb
Update README.md
talha-zshan Feb 7, 2024
cf0b1bd
requirements.txt
talha-zshan Feb 8, 2024
8518a9d
Update README.md
talha-zshan Feb 8, 2024
119caa6
Merge branch 'talha-dev#2' of https://github.com/khacha329/PWP_Crusty…
talha-zshan Feb 8, 2024
e5ae522
Merge pull request #1 from khacha329/talha-dev#2
talha-zshan Feb 8, 2024
5a48abf
fixed link in README.md
talha-zshan Feb 8, 2024
7f7c428
Fixed typo in README.md
talha-zshan Feb 8, 2024
4da1123
renamed variables
khacha329 Feb 9, 2024
a46703e
added meeting points
khacha329 Feb 9, 2024
ec704ab
Project Structure Setup
talha-zshan Feb 20, 2024
2184ddf
project structure minor clarifications
talha-zshan Feb 20, 2024
83287e9
added json shema + (de)serialisation + package setup + fixed bugs
ConnorReed246 Feb 23, 2024
86997aa
small bugfixes
ConnorReed246 Feb 23, 2024
0773da0
removed id's from shema and deserialisation
ConnorReed246 Feb 23, 2024
676afaf
tested methods, fixed some bugs
ConnorReed246 Feb 23, 2024
f87c7e3
added converters, cleaned up
ConnorReed246 Feb 23, 2024
12c520b
modified project stuff, added post method without tests
ConnorReed246 Feb 23, 2024
2c2fb8b
added tests infrastructure, api infrastructure, post method and post …
ConnorReed246 Feb 24, 2024
2a5bbbf
check each uri for items
ConnorReed246 Feb 26, 2024
57cf94d
Update location.py
apchamb2 Feb 26, 2024
99e60ee
Update location.py
apchamb2 Feb 27, 2024
47efaa2
Update location.py
apchamb2 Feb 27, 2024
508cf0c
Update location.py
apchamb2 Feb 27, 2024
5e4ed5d
Update location.py
apchamb2 Feb 27, 2024
4524280
Update location.py
apchamb2 Feb 27, 2024
0ccf431
Update location.py
apchamb2 Feb 27, 2024
084d364
Update location.py
apchamb2 Feb 27, 2024
57abcdd
Changed LocationItem POST to PUT
apchamb2 Feb 28, 2024
17532a8
Added LocationConverter
apchamb2 Feb 28, 2024
55f11ea
added add resource to api.py
apchamb2 Feb 28, 2024
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
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# 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/


# var
cache/
*.db
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 45 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
# PWP SPRING 2024
# PROJECT NAME
# Inventory Sytstem for Foodmarket Chain
# Group information
* Student 1. Name and email
* Student 2. Name and email
* Student 3. Name and email
* Student 4. Name and email
* Student 1. Alexis Chambers [email protected]
* Student 2. Zeeshan Talha [email protected]
* Student 3. Reed Connor [email protected]
* Student 4. Chakal Khalil [email protected]


## Project Setup

Clone the repository to your local machine using git clone
```
git clone https://github.com/khacha329/PWP_CrustyCrabs.git
```
To ensure your python packages are protected, set up a virtual environment to keep a clean system

```
python -m venv /path/to/myEnv
```
Activate the virtual environment

```
source /path/to/myEnv/bin/activate
```
Install the required python packages in the virtual environment using the requirements.txt file located in the root directory of this project

```
pip install requirements.txt -r
```

Intall inventory manager package in developer mode:
Navigate to /PWP_CrustyCrabs/

Run:

```
pip install -e .
```


## Initialize and Populate DB

To intialize the database and populate it with dummy data follow the [README file](https://github.com/khacha329/PWP_CrustyCrabs/blob/main/inventorymanager/README.md) under the inventorymanager folder




__Remember to include all required documentation and HOWTOs, including how to create and populate the database, how to run and test the API, the url to the entrypoint and instructions on how to setup and run the client__

Expand Down
21 changes: 21 additions & 0 deletions inventorymanager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
To initialize the database for this application, run the following commands from the root directory of the project

```
flask --app inventorymanager init-db
flask --app inventorymanager populate-db
```
To check the contents of the database, run the flask shell using the following command from the root directory of the project

```
flask --app inventorymanager shell
```

This will open an interactive flask-shell in which we can query the database. For a quick overview of each model, run any of the following commands in the shell:

```
Location.query.all()
Warehouse.query.all()
Item.query.all()
Stock.query.all()
Catalogue.query.all()
```
59 changes: 59 additions & 0 deletions inventorymanager/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
This module is used to start and retrieve a Flask application complete with all the required setups
"""
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import os

from inventorymanager.config import Config

db = SQLAlchemy()

# Structure learned from the following sources:
# https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/quickstart/
# https://www.digitalocean.com/community/tutorials/how-to-structure-a-large-flask-application-with-flask-blueprints-and-flask-sqlalchemy#the-target-application-structure
# https://www.digitalocean.com/community/tutorials/how-to-use-flask-sqlalchemy-to-interact-with-databases-in-a-flask-application#step-2-setting-up-the-database-and-model


def create_app(test_config=None):

app = Flask(__name__, instance_relative_config=True)

app.config.from_mapping(
SECRET_KEY="dev",
SQLALCHEMY_DATABASE_URI="sqlite:///" + os.path.join(app.instance_path, "development.db"),
SQLALCHEMY_TRACK_MODIFICATIONS=False,
# CACHE_TYPE="FileSystemCache",
# CACHE_DIR=os.path.join(app.instance_path, "cache"),
)

if test_config is None:
app.config.from_pyfile("config.py", silent=True)
else:
app.config.from_mapping(test_config)

try:
os.makedirs(app.instance_path)

except OSError:
pass

db.init_app(app)
#cache.init_app(app)

# Import All Models (not sure why yet, its a thing-to-do to make this work)
from inventorymanager.models import Location, Warehouse, Item, Stock, Catalogue

# CLI commands to populate db
from inventorymanager.models import init_db_command, create_dummy_data

app.cli.add_command(init_db_command)
app.cli.add_command(create_dummy_data)

from inventorymanager.api import api_bp
from inventorymanager.utils import WarehouseConverter, ItemConverter
app.url_map.converters["warehouse"] = WarehouseConverter
app.url_map.converters["item"] = ItemConverter
app.register_blueprint(api_bp)

return app
22 changes: 22 additions & 0 deletions inventorymanager/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
This module instantiates the Api object and adds to it all the endpoints for the resources
"""
from flask import Blueprint
from flask_restful import Api

from inventorymanager import create_app
from inventorymanager.resources.item import ItemCollection, ItemItem
from inventorymanager.resources.location import LocationCollection, LocationItem

api_bp = Blueprint("api", __name__, url_prefix="/api")

api = Api(api_bp)

api.add_resource(ItemCollection, "/items/")
api.add_resource(ItemItem, "/items/<item:item>/")
api.add_resource(LocationCollection, "/locations/locations/")
api.add_resource(LocationItem, '/api/locations/<int:location_id>')
# api.add_resource(SensorItem, "/sensors/<sensor:sensor>/")
# api.add_resource(LocationItem, "/locations/<location>/")
# api.add_resource(MeasurementCollection, "/sensors/<sensor:sensor>/measurements/")
# api.add_resource(LocationSensorPairing, "/locations/<location>/<sensor>/")
11 changes: 11 additions & 0 deletions inventorymanager/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
This module contains configuration settings to set up the database
"""
import os

basedir = os.path.abspath(os.path.dirname(__file__))

class Config:
SECRET_KEY = 'dev'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False
11 changes: 11 additions & 0 deletions inventorymanager/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
This module contains constants used by the API
"""
#just copied this stuff, no idea what it does

# MASON = "application/vnd.mason+json"
# LINK_RELATIONS_URL = "/sensorhub/link-relations/"
# ERROR_PROFILE = "/profiles/error/"
# SENSOR_PROFILE = "/profiles/sensor/"

# MEASUREMENT_PAGE_SIZE = 50
Loading