forked from bcgov/STRR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,292 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Specify a code owner for the strr-api directory | ||
strr-api/ @kris-daxiom @thorwolpert | ||
/strr-api @kris-daxiom @thorwolpert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
602 changes: 602 additions & 0 deletions
602
strr-api/migrations/versions/20241010_2151_a6abe20bd998_.py
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Registration model. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from sql_versioning import Versioned | ||
from sqlalchemy.orm import relationship | ||
|
||
from strr_api.models.base_model import BaseModel | ||
|
||
from .db import db | ||
|
||
|
||
class Address(Versioned, BaseModel): | ||
"""Address""" | ||
|
||
__tablename__ = "addresses" | ||
|
||
id = db.Column(db.Integer, primary_key=True, autoincrement=True) | ||
country = db.Column(db.String, nullable=False) | ||
street_address = db.Column(db.String, nullable=False) | ||
street_address_additional = db.Column(db.String, nullable=True) | ||
city = db.Column(db.String, nullable=False) | ||
province = db.Column(db.String, nullable=False) | ||
postal_code = db.Column(db.String, nullable=False) | ||
|
||
contact = relationship("Contact", back_populates="address", foreign_keys="Contact.address_id") | ||
rental_properties_address = relationship( | ||
"RentalProperty", back_populates="address", foreign_keys="RentalProperty.address_id" | ||
) | ||
|
||
def to_oneline_address(self): | ||
"""Convert object to one line address.""" | ||
unit = "" | ||
if self.street_address_additional: | ||
unit = f"{self.street_address_additional} " | ||
return f"{unit}{self.street_address}, {self.city}, {self.province}, {self.country}, {self.postal_code}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.