Skip to content

Commit

Permalink
rename uuid fn to include str_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulJWright committed Aug 5, 2024
1 parent effeddd commit 955788d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions weird_salads/orders/repository/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
from sqlalchemy import Column, DateTime, Integer, String

from weird_salads.utils.sqlalchemy_base import Base
from weird_salads.utils.utils import generate_uuid
from weird_salads.utils.utils import generate_str_uuid

__all__ = ["OrderModel"]


class OrderModel(Base):
__tablename__ = "order"

id = Column(String, primary_key=True, default=generate_uuid)
id = Column(String, primary_key=True, default=generate_str_uuid)
menu_id = Column(Integer, nullable=False) # this will end up being a ForeignKey
created = Column(DateTime, default=datetime.now(timezone.utc))

Expand Down
5 changes: 4 additions & 1 deletion weird_salads/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import uuid

__all__ = ["generate_str_uuid"]

def generate_uuid():

def generate_str_uuid():
"""str(uuid) for sqlite"""
return str(uuid.uuid4())

0 comments on commit 955788d

Please sign in to comment.