Skip to content

Commit fd392ae

Browse files
committed
add product variant model
1 parent b61c3a0 commit fd392ae

5 files changed

Lines changed: 27 additions & 7 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @maplethorpej

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [Packstack-Tech] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: packstack
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ __pycache__/
66
# C extensions
77
*.so
88

9+
# Settings
10+
.vscode/
11+
912
# Distribution / packaging
1013
.Python
1114
build/

.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

models/base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import jwt
21
import datetime
32
import uuid
43

@@ -188,6 +187,16 @@ class Product(Base):
188187
'brand_id', 'name', name='_brand_product_uc'),)
189188

190189

190+
class ProductVariant(Base):
191+
id = Column(Integer, primary_key=True, index=True)
192+
product_id = Column(Integer, ForeignKey("product.id"), nullable=False)
193+
name = Column(String(250), nullable=False)
194+
195+
# Ensure variant is unique per product
196+
__table_args__ = (UniqueConstraint(
197+
'name', 'product_id', name='uc_name_product_id'),)
198+
199+
191200
class PackItem(Base):
192201
pack_id = Column(Integer, ForeignKey("pack.id"), primary_key=True)
193202
item_id = Column(Integer, ForeignKey("item.id"), primary_key=True)

0 commit comments

Comments
 (0)