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:
2026-07-07 13:43:39 +08:00
parent 806c9ba8a0
commit ad6f2b2ff2
10 changed files with 47 additions and 45 deletions

View File

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