refactor(model): rename Postcard.country -> country_to for clear semantics - country_from: origin country (where postcard was sent from) - country_to: destination country (where postcard was sent to) - Profile.country remains as user's home country - Updated all routes, schemas, templates, and API endpoints
This commit is contained in:
@@ -83,8 +83,8 @@ class Postcard(Base):
|
||||
status = Column(String(16), nullable=False)
|
||||
# sent & delivered
|
||||
recipient_name = Column(String(64))
|
||||
country = Column(String(64))
|
||||
country_from = Column(String(2))
|
||||
country_to = Column(String(2))
|
||||
send_time = Column(DateTime)
|
||||
arrival_time = Column(DateTime)
|
||||
# received
|
||||
@@ -101,14 +101,14 @@ class Postcard(Base):
|
||||
|
||||
profile = relationship("Profile", back_populates="postcards")
|
||||
|
||||
@validates("country")
|
||||
def _upper_country(self, key, value):
|
||||
return value.strip().upper() if value else None
|
||||
|
||||
@validates("country_from")
|
||||
def _upper_country_from(self, key, value):
|
||||
return value.strip().upper() if value else None
|
||||
|
||||
@validates("country_to")
|
||||
def _upper_country_to(self, key, value):
|
||||
return value.strip().upper() if value else None
|
||||
|
||||
|
||||
class ApiKey(Base):
|
||||
__tablename__ = "api_keys"
|
||||
|
||||
Reference in New Issue
Block a user