Coverage for .tox/coverage/lib/python3.11/site-packages/sideshow/db/model/stores.py: 100%
12 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-16 07:16 -0500
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-16 07:16 -0500
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# Sideshow -- Case/Special Order Tracker
5# Copyright © 2024-2025 Lance Edgar
6#
7# This file is part of Sideshow.
8#
9# Sideshow is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# Sideshow is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Sideshow. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Data models for Stores
25"""
27import sqlalchemy as sa
29from wuttjamaican.db import model
32class Store(model.Base):
33 """
34 Represents a physical location for the business.
35 """
36 __tablename__ = 'sideshow_store'
38 uuid = model.uuid_column()
40 store_id = sa.Column(sa.String(length=10), nullable=False, unique=True, doc="""
41 Unique ID for the store.
42 """)
44 name = sa.Column(sa.String(length=100), nullable=False, unique=True, doc="""
45 Display name for the store (must be unique!).
46 """)
48 archived = sa.Column(sa.Boolean(), nullable=False, default=False, doc="""
49 Indicates the store has been "retired" essentially, and mostly
50 hidden from view.
51 """)
53 def __str__(self):
54 return self.get_display()
56 def get_display(self):
57 """
58 Returns the display string for the store, e.g. "001 Acme Goods".
59 """
60 return ' '.join([(self.store_id or '').strip(),
61 (self.name or '').strip()])\
62 .strip()