Skip to content

Commit

Permalink
chore: Rename module from shopdb to shop_db2
Browse files Browse the repository at this point in the history
  • Loading branch information
g3n35i5 committed Jun 9, 2024
1 parent b05a938 commit b8dced7
Show file tree
Hide file tree
Showing 131 changed files with 372 additions and 344 deletions.
6 changes: 3 additions & 3 deletions .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"github_user": "",
"project_name": "shop-db2",
"repo_name": "shop-db2",
"package_name": "shopdb",
"import_name": "shopdb",
"package_name": "shop-db2",
"import_name": "shop_db2",
"project_short_description": "The simple way to manage purchases and user interactions in a small community.",
"url": "https://github.com/g3n35i5/shopdb",
"url": "https://github.com/g3n35i5/shop-db2",
"_debug": "False",
"_extensions": ["extensions.git_extension.GitExtension"],
"_copy_without_render": ["docs/_templates/license_compliance.rst.j2"],
Expand Down
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ configuration.py
coverage.xml
.codacy-coverage
codacy-coverage.json
shopdb/uploads/*
!shopdb/uploads/valid*
!shopdb/uploads/broken*
!shopdb/uploads/non_quadratic.png
src/shop_db2/uploads/*
!src/shop_db2/uploads/valid*
!src/shop_db2/uploads/broken*
!src/shop_db2/uploads/non_quadratic.png
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -128,7 +128,7 @@ reports/
.coverage
.coverage.*
MANIFEST
docs/shopdb*
docs/shop-db2*
docs/modules.rst
docs/ossLicenses.json
docs/license_compliance.rst
Expand All @@ -143,7 +143,7 @@ dist/
*.class
*.py[cod]
*.jar
shopdb-[0-9]*
shop-db2-[0-9]*

# Log files
**/log/**/*
Expand Down
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Jan-Frederik Schmidt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from flask_script import Manager

import configuration as config
from shopdb.api import app, db, set_app
from shop_db2.api import app, db, set_app

set_app(config.ProductiveConfig)
migrate = Migrate(app, db)
Expand Down
4 changes: 2 additions & 2 deletions configuration.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BaseConfig(object):
HOST = "127.0.0.1"
PORT = 5000
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOAD_FOLDER = PATH + "/src/shopdb/uploads/"
UPLOAD_FOLDER = PATH + "/src/shop_db2/uploads/"
MAX_CONTENT_LENGTH = 4 * 1024 * 1024
VALID_EXTENSIONS = ["png"]
MINIMUM_PASSWORD_LENGTH = 6
Expand All @@ -22,7 +22,7 @@ class ProductiveConfig(BaseConfig):
DEBUG = False
TEST = False
ENV = "productive"
DATABASE_PATH = PATH + "/src/shopdb/shop.db"
DATABASE_PATH = PATH + "/src/shop_db2/shop.db"
SQLALCHEMY_DATABASE_URI = "sqlite:///" + DATABASE_PATH


Expand Down
4 changes: 2 additions & 2 deletions dev/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from shopdb.api import bcrypt
from shopdb.models import *
from shop_db2.api import bcrypt
from shop_db2.models import *

PASSWORD = bcrypt.generate_password_hash("1234")

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ignore-signatures = "yes"
disallow_untyped_defs = true
warn_unused_ignores = true
exclude = [
"shopdb-\\d+", # Ignore temporary folder created by setuptools when building an sdist
"shop-db2-\\d+", # Ignore temporary folder created by setuptools when building an sdist
"venv.*/",
"log/",
"build/",
Expand All @@ -91,11 +91,11 @@ addopts = """
-vv
--doctest-modules
--import-mode=append
--ignore-glob=shopdb-[0-9]*
--ignore-glob=shop-db2-[0-9]*
--ignore="migrations"
--ignore="configuration.example.py"
--ignore="docs/_scripts"
--cov=shopdb
--cov=shop-db2
--cov-config=pyproject.toml
--cov-report=
"""
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = shopdb
name = shop-db2
author = Jan-Frederik Schmidt
author_email = [email protected]
description = The simple way to manage purchases and user interactions in a small community.
Expand Down Expand Up @@ -46,7 +46,7 @@ where = src
[options.package_data]
* = py.typed

shopdb =
shop_db2 =
uploads/**
templates/**

Expand Down
8 changes: 4 additions & 4 deletions setupdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from sqlalchemy.exc import IntegrityError

import configuration as config
import shopdb.exceptions as exc
from shopdb.api import app, db, set_app
from shopdb.helpers.users import insert_user
from shopdb.models import Rank, User
import shop_db2.exceptions as exc
from shop_db2.api import app, db, set_app
from shop_db2.helpers.users import insert_user
from shop_db2.models import Rank, User


def _get_password():
Expand Down
2 changes: 1 addition & 1 deletion shopdb_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from flask_cors import CORS

from dev import insert_dev_data
from shopdb.api import app, db, set_app
from shop_db2.api import app, db, set_app

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Starting script shop.db")
Expand Down
2 changes: 1 addition & 1 deletion src/shopdb/__init__.py → src/shop_db2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from importlib_metadata import PackageNotFoundError as _PackageNotFoundError
from importlib_metadata import version as _version

__module_name__ = "shopdb"
__module_name__ = "shop_db2"

try: # pragma: no cover
__version__ = _version(__module_name__)
Expand Down
34 changes: 17 additions & 17 deletions src/shopdb/api.py → src/shop_db2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from flask_bcrypt import Bcrypt

import configuration as config
from shopdb.shared import db
from shop_db2.shared import db

app = Flask(__name__)

Expand Down Expand Up @@ -45,64 +45,64 @@ def index():

# Error handler
# noinspection PyUnresolvedReferences
import shopdb.helpers.errors # noqa: E402
import shop_db2.helpers.errors # noqa: E402

# App hooks
# noinspection PyUnresolvedReferences
import shopdb.helpers.hooks # noqa: E402
import shop_db2.helpers.hooks # noqa: E402

# Backup routes
# noinspection PyUnresolvedReferences
import shopdb.routes.backups # noqa: E402
import shop_db2.routes.backups # noqa: E402

# Deposit routes
# noinspection PyUnresolvedReferences
import shopdb.routes.deposits # noqa: E402
import shop_db2.routes.deposits # noqa: E402

# Financial overview route
# noinspection PyUnresolvedReferences
import shopdb.routes.financial_overview # noqa: E402
import shop_db2.routes.financial_overview # noqa: E402

# Image routes
# noinspection PyUnresolvedReferences
import shopdb.routes.images # noqa: E402
import shop_db2.routes.images # noqa: E402

# Login route
# noinspection PyUnresolvedReferences
import shopdb.routes.login # noqa: E402
import shop_db2.routes.login # noqa: E402

# Maintenance routes
# noinspection PyUnresolvedReferences
import shopdb.routes.maintenance # noqa: E402
import shop_db2.routes.maintenance # noqa: E402

# Product routes
# noinspection PyUnresolvedReferences
import shopdb.routes.products # noqa: E402
import shop_db2.routes.products # noqa: E402

# Purchase routes
# noinspection PyUnresolvedReferences
import shopdb.routes.purchases # noqa: E402
import shop_db2.routes.purchases # noqa: E402

# Rank routes
# noinspection PyUnresolvedReferences
import shopdb.routes.ranks # noqa: E402
import shop_db2.routes.ranks # noqa: E402

# ReplenishmentCollection routes
# noinspection PyUnresolvedReferences
import shopdb.routes.replenishmentcollections # noqa: E402
import shop_db2.routes.replenishmentcollections # noqa: E402

# StocktakingCollection routes
# noinspection PyUnresolvedReferences
import shopdb.routes.stocktakingcollections # noqa: E402
import shop_db2.routes.stocktakingcollections # noqa: E402

# Tag assignment routes
# noinspection PyUnresolvedReferences
import shopdb.routes.tagassignments # noqa: E402
import shop_db2.routes.tagassignments # noqa: E402

# Tag routes
# noinspection PyUnresolvedReferences
import shopdb.routes.tags # noqa: E402
import shop_db2.routes.tags # noqa: E402

# User routes
# noinspection PyUnresolvedReferences
import shopdb.routes.users # noqa: E402
import shop_db2.routes.users # noqa: E402
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import jwt
from flask import Response, request

import shopdb.exceptions as exc
from shopdb.api import app
from shopdb.models import User
import shop_db2.exceptions as exc
from shop_db2.api import app
from shop_db2.models import User


def checkIfUserIsValid(f):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from sqlalchemy.exc import IntegrityError

import shopdb.exceptions as exc
from shopdb.api import db
from shopdb.helpers.validators import check_fields_and_types
from shopdb.models import Deposit, User
import shop_db2.exceptions as exc
from shop_db2.api import db
from shop_db2.helpers.validators import check_fields_and_types
from shop_db2.models import Deposit, User


def insert_deposit(data, admin):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import werkzeug.exceptions as werkzeug_exceptions
from flask import jsonify

import shopdb.exceptions as exc
from shopdb.api import app, db
import shop_db2.exceptions as exc
from shop_db2.api import app, db


@app.errorhandler(Exception)
Expand Down
6 changes: 3 additions & 3 deletions src/shopdb/helpers/hooks.py → src/shop_db2/helpers/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from flask import g, request

import shopdb.exceptions as exc
from shopdb.api import app
from shopdb.helpers.decorators import adminOptional
import shop_db2.exceptions as exc
from shop_db2.api import app
from shop_db2.helpers.decorators import adminOptional


@app.before_request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

from sqlalchemy import and_

import shopdb.exceptions as exc
import shopdb.helpers.purchases as purchase_helpers
import shopdb.helpers.replenishments as replenishment_helpers
import shopdb.helpers.stocktakings as stocktaking_helpers
from shopdb.models import Product, ProductPrice
import shop_db2.exceptions as exc
import shop_db2.helpers.purchases as purchase_helpers
import shop_db2.helpers.replenishments as replenishment_helpers
import shop_db2.helpers.stocktakings as stocktaking_helpers
from shop_db2.models import Product, ProductPrice


def _shift_date_to_begin_of_day(date):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql import func

import shopdb.exceptions as exc
from shopdb.api import db
from shopdb.helpers.utils import parse_timestamp
from shopdb.helpers.validators import check_fields_and_types
from shopdb.models import Product, Purchase, Rank, User
import shop_db2.exceptions as exc
from shop_db2.api import db
from shop_db2.helpers.utils import parse_timestamp
from shop_db2.helpers.validators import check_fields_and_types
from shop_db2.models import Product, Purchase, Rank, User


def get_purchase_amount_in_interval(product_id: int, start: datetime.datetime, end: datetime.datetime) -> int:
Expand Down
4 changes: 2 additions & 2 deletions src/shopdb/helpers/query.py → src/shop_db2/helpers/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from sqlalchemy.sql.expression import BinaryExpression
from werkzeug import ImmutableMultiDict

import shopdb.exceptions as exc
from shopdb.api import db
import shop_db2.exceptions as exc
from shop_db2.api import db


class QueryFromRequestParameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from sqlalchemy.sql import func

from shopdb.api import db
from shopdb.models import Replenishment, ReplenishmentCollection
from shop_db2.api import db
from shop_db2.models import Replenishment, ReplenishmentCollection


def get_replenishment_amount_in_interval(product_id: int, start: datetime.datetime, end: datetime.datetime) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@

from sqlalchemy import and_, func

from shopdb.api import db
from shopdb.helpers.products import _get_product_mean_price_in_time_range
from shopdb.models import Product, Purchase, Replenishment, ReplenishmentCollection, Stocktaking, StocktakingCollection
from shop_db2.api import db
from shop_db2.helpers.products import _get_product_mean_price_in_time_range
from shop_db2.models import (
Product,
Purchase,
Replenishment,
ReplenishmentCollection,
Stocktaking,
StocktakingCollection,
)


def _get_balance_between_stocktakings(start, end):
Expand Down
Loading

0 comments on commit b8dced7

Please sign in to comment.