Coverage for .tox / coverage / lib / python3.11 / site-packages / sideshow / db / model / stores.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-15 17:10 -0600

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""" 

26 

27import sqlalchemy as sa 

28 

29from wuttjamaican.db import model 

30 

31 

32class Store(model.Base): 

33 """ 

34 Represents a physical location for the business. 

35 """ 

36 

37 __tablename__ = "sideshow_store" 

38 

39 uuid = model.uuid_column() 

40 

41 store_id = sa.Column( 

42 sa.String(length=10), 

43 nullable=False, 

44 unique=True, 

45 doc=""" 

46 Unique ID for the store. 

47 """, 

48 ) 

49 

50 name = sa.Column( 

51 sa.String(length=100), 

52 nullable=False, 

53 unique=True, 

54 doc=""" 

55 Display name for the store (must be unique!). 

56 """, 

57 ) 

58 

59 archived = sa.Column( 

60 sa.Boolean(), 

61 nullable=False, 

62 default=False, 

63 doc=""" 

64 Indicates the store has been "retired" essentially, and mostly 

65 hidden from view. 

66 """, 

67 ) 

68 

69 def __str__(self): 

70 return self.get_display() 

71 

72 def get_display(self): 

73 """ 

74 Returns the display string for the store, e.g. "001 Acme Goods". 

75 """ 

76 return " ".join( 

77 [(self.store_id or "").strip(), (self.name or "").strip()] 

78 ).strip()