Compare commits
5 Commits
e6e7c20479
...
0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| cff6d9cc50 | |||
| 2c4f98d567 | |||
| 386341f977 | |||
| eb1d1e1dd3 | |||
| 21ffc736bc |
30
.pre-commit-config.yaml
Normal file
30
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.7.4
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: [--py37-plus]
|
||||||
|
|
||||||
|
- repo: https://github.com/codespell-project/codespell
|
||||||
|
rev: v2.0.0
|
||||||
|
hooks:
|
||||||
|
- id: codespell
|
||||||
|
args:
|
||||||
|
- --ignore-words-list=sigl
|
||||||
|
- --skip="./.*,*.csv,*.json"
|
||||||
|
- --quiet-level=2
|
||||||
|
exclude_types: [csv, json]
|
||||||
|
|
||||||
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
|
rev: 3.8.4
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
additional_dependencies:
|
||||||
|
- flake8-docstrings==1.5.0
|
||||||
|
- pydocstyle==5.1.1
|
||||||
|
files: ^(sigl|tests)/.+\.py$
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.5.3
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
@@ -41,5 +41,8 @@ RUN mkdir -p /var/lib/sigl \
|
|||||||
|
|
||||||
USER sigl
|
USER sigl
|
||||||
EXPOSE 5151
|
EXPOSE 5151
|
||||||
ENTRYPOINT [ "/home/sigl/docker-entry.sh" ]
|
VOLUME [ "/var/lib/sigl" ]
|
||||||
|
|
||||||
CMD [ "sigl" ]
|
CMD [ "sigl" ]
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/home/sigl/docker-entry.sh" ]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sigl",
|
"name": "sigl",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Simple Grocery List",
|
"description": "Simple Grocery List",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tailwindcss": "^3.1.6"
|
"tailwindcss": "^3.1.6"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "sigl"
|
name = "sigl"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Simple Grocery List"
|
description = "Simple Grocery List"
|
||||||
authors = ["Jonathan Krauss <jkrauss@asymworks.com>"]
|
authors = ["Jonathan Krauss <jkrauss@asymworks.com>"]
|
||||||
license = "BSD-3-Clause"
|
license = "BSD-3-Clause"
|
||||||
|
|||||||
@@ -8,15 +8,11 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
def init_shell(): # pragma: no cover
|
def init_shell(): # pragma: no cover
|
||||||
"""Initialize the Flask Shell Context."""
|
"""Initialize the Flask Shell Context."""
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from sigl.database import db
|
from sigl.database import db
|
||||||
from sigl.domain.models import (
|
from sigl.domain.models import ListEntry, Product, ProductLocation, ShoppingList
|
||||||
ListEntry,
|
|
||||||
Product,
|
|
||||||
ProductLocation,
|
|
||||||
ShoppingList,
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
# Imports
|
# Imports
|
||||||
|
|||||||
@@ -4,27 +4,18 @@ Simple Grocery List (Sigl) | sigl.app
|
|||||||
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from sigl.domain.models import (
|
from sigl.domain.models import Product, ProductLocation
|
||||||
Product,
|
|
||||||
ProductLocation,
|
|
||||||
)
|
|
||||||
from sigl.domain.models.list import ListEntry, ShoppingList
|
from sigl.domain.models.list import ListEntry, ShoppingList
|
||||||
|
|
||||||
from .globals import db
|
from .globals import db
|
||||||
from .tables import (
|
from .tables import list_entries, lists, product_locations, products
|
||||||
list_entries,
|
|
||||||
lists,
|
|
||||||
product_locations,
|
|
||||||
products,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = ('init_orm', )
|
__all__ = ('init_orm', )
|
||||||
|
|
||||||
|
|
||||||
def init_orm():
|
def init_orm():
|
||||||
"""Initialize the Sigl ORM."""
|
"""Initialize the Sigl ORM."""
|
||||||
|
# List Entries
|
||||||
# # List Entries
|
|
||||||
db.mapper(ListEntry, list_entries, properties={
|
db.mapper(ListEntry, list_entries, properties={
|
||||||
'product': db.relationship(
|
'product': db.relationship(
|
||||||
Product,
|
Product,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import List, TYPE_CHECKING
|
from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .mixins import NotesMixin, TimestampMixin
|
from .mixins import NotesMixin, TimestampMixin
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from typing import List, Optional, Union
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from sigl.exc import DomainError, NotFoundError
|
from sigl.exc import DomainError, NotFoundError
|
||||||
|
|
||||||
from .models import ListEntry, Product, ProductLocation, ShoppingList
|
from .models import ListEntry, Product, ProductLocation, ShoppingList
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ def list_stores(session: Session, id: Optional[int]) -> List[str]:
|
|||||||
Product has locations are returned.
|
Product has locations are returned.
|
||||||
"""
|
"""
|
||||||
if id is None:
|
if id is None:
|
||||||
return list(set([loc.store for loc in session.query(ProductLocation).all()]))
|
return list({loc.store for loc in session.query(ProductLocation).all()})
|
||||||
|
|
||||||
sList = list_by_id(session, id)
|
sList = list_by_id(session, id)
|
||||||
if not sList:
|
if not sList:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<main class="max-w-3xl mx-auto bg-white md:border-l md:border-r border-b md:rounded-b border-gray-300">
|
<main class="max-w-3xl mx-auto bg-white md:border-l md:border-r border-b md:rounded-b border-gray-300">
|
||||||
{% block main %}{% endblock %}
|
{% block main %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
<footer class="max-w-3xl mx-auto flex flex-col mt-1 px-2 text-xs text-gray-600">
|
<footer class="max-w-3xl mx-auto flex flex-col mt-1 mb-24 px-2 text-xs text-gray-600">
|
||||||
<p>Sigl | Simple Grocery List | Version {{ config['APP_VERSION'] }}</p>
|
<p>Sigl | Simple Grocery List | Version {{ config['APP_VERSION'] }}</p>
|
||||||
<p>Copyright ©2022 Asymworks, LLC. All Rights Reserved.</p>
|
<p>Copyright ©2022 Asymworks, LLC. All Rights Reserved.</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -6,17 +6,32 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
|
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint,
|
Blueprint,
|
||||||
flash, jsonify, make_response, redirect, render_template, request, url_for
|
flash,
|
||||||
|
jsonify,
|
||||||
|
make_response,
|
||||||
|
redirect,
|
||||||
|
render_template,
|
||||||
|
request,
|
||||||
|
url_for,
|
||||||
)
|
)
|
||||||
|
|
||||||
from sigl.exc import DomainError, Error, NotFoundError
|
|
||||||
from sigl.database import db
|
from sigl.database import db
|
||||||
from sigl.domain.service import (
|
from sigl.domain.service import (
|
||||||
list_entry_by_id, lists_all, list_by_id, list_create, list_delete,
|
list_addItem,
|
||||||
list_update, list_addItem, list_deleteItem, list_editItem, list_stores,
|
list_by_id,
|
||||||
list_deleteCrossedOff, list_entry_set_crossedOff,
|
list_create,
|
||||||
|
list_delete,
|
||||||
|
list_deleteCrossedOff,
|
||||||
|
list_deleteItem,
|
||||||
|
list_editItem,
|
||||||
|
list_entry_by_id,
|
||||||
|
list_entry_set_crossedOff,
|
||||||
|
list_stores,
|
||||||
|
list_update,
|
||||||
|
lists_all,
|
||||||
products_all,
|
products_all,
|
||||||
)
|
)
|
||||||
|
from sigl.exc import DomainError, Error, NotFoundError
|
||||||
|
|
||||||
__all__ = ('bp', )
|
__all__ = ('bp', )
|
||||||
|
|
||||||
|
|||||||
@@ -4,23 +4,20 @@ Simple Grocery List (Sigl) | sigl.app
|
|||||||
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from flask import (
|
from flask import Blueprint, flash, redirect, render_template, request, url_for
|
||||||
Blueprint,
|
|
||||||
flash, redirect, render_template, request, url_for
|
|
||||||
)
|
|
||||||
|
|
||||||
from sigl.exc import Error, NotFoundError
|
|
||||||
from sigl.database import db
|
from sigl.database import db
|
||||||
from sigl.domain.service import (
|
from sigl.domain.service import (
|
||||||
list_stores,
|
list_stores,
|
||||||
products_all,
|
product_addLocation,
|
||||||
product_by_id,
|
product_by_id,
|
||||||
product_create,
|
product_create,
|
||||||
product_delete,
|
product_delete,
|
||||||
product_update,
|
|
||||||
product_addLocation,
|
|
||||||
product_removeLocation,
|
product_removeLocation,
|
||||||
|
product_update,
|
||||||
|
products_all,
|
||||||
)
|
)
|
||||||
|
from sigl.exc import Error, NotFoundError
|
||||||
|
|
||||||
__all__ = ('bp', )
|
__all__ = ('bp', )
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,4 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
|
|
||||||
from .factory import create_app
|
from .factory import create_app
|
||||||
|
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|||||||
Reference in New Issue
Block a user