Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/strr-ui-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ on:
push:
branches:
- main
- feature*
paths:
- "strr-web/**"
- "strr-examiner-web/**"
workflow_dispatch:
inputs:
target:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/strr-ui-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- "strr-web/**"
- "strr-examiner-web/**"
workflow_dispatch:

defaults:
Expand Down
17 changes: 2 additions & 15 deletions strr-api/migrations/versions/20240703_412aa6608c42_.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,8 @@


def upgrade():
connection = op.get_bind()
# create tables
sql_script_path = os.path.join(sql_script_dir, 'gis_ddl.sql')
with open(sql_script_path, 'r') as file:
ddl_script = file.read()

connection.execute(text(ddl_script))

# seed
sql_script_path = os.path.join(sql_script_dir, 'gis_seed.sql')
with open(sql_script_path, 'r') as file:
seed_script = file.read()

connection.execute(text(seed_script))
pass


def downgrade():
op.drop_table('dss_organization')
pass
9 changes: 0 additions & 9 deletions strr-api/migrations/versions/20240727_0656_d8b1f2dab56e_.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ def downgrade():
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='event_records_user_id_fkey'),
sa.PrimaryKeyConstraint('id', name='event_records_pkey')
)
op.create_table('spatial_ref_sys',
sa.Column('srid', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('auth_name', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
sa.Column('auth_srid', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('srtext', sa.VARCHAR(length=2048), autoincrement=False, nullable=True),
sa.Column('proj4text', sa.VARCHAR(length=2048), autoincrement=False, nullable=True),
sa.CheckConstraint('srid > 0 AND srid <= 998999', name='spatial_ref_sys_srid_check'),
sa.PrimaryKeyConstraint('srid', name='spatial_ref_sys_pkey')
)
with op.batch_alter_table('events', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_events_registration_id'))
batch_op.drop_index(batch_op.f('ix_events_event_type'))
Expand Down
46 changes: 46 additions & 0 deletions strr-api/migrations/versions/20241212_0611_0fb49e0b4707_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""empty message

Revision ID: 0fb49e0b4707
Revises: 8912b6965de6
Create Date: 2024-12-12 06:11:20.394557

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0fb49e0b4707'
down_revision = '8912b6965de6'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('contacts', schema=None) as batch_op:
batch_op.alter_column('firstname',
existing_type=sa.VARCHAR(),
nullable=True)

with op.batch_alter_table('contacts_history', schema=None) as batch_op:
batch_op.alter_column('firstname',
existing_type=sa.VARCHAR(length=1000),
nullable=True,
autoincrement=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('contacts_history', schema=None) as batch_op:
batch_op.alter_column('firstname',
existing_type=sa.VARCHAR(length=1000),
nullable=False,
autoincrement=False)

with op.batch_alter_table('contacts', schema=None) as batch_op:
batch_op.alter_column('firstname',
existing_type=sa.VARCHAR(),
nullable=False)
# ### end Alembic commands ###
42 changes: 42 additions & 0 deletions strr-api/migrations/versions/20241213_2034_55b9517ed210_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""empty message

Revision ID: 55b9517ed210
Revises: 0fb49e0b4707
Create Date: 2024-12-13 20:34:29.306635

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '55b9517ed210'
down_revision = '0fb49e0b4707'
branch_labels = None
depends_on = None

old_options = ('BC_DRIVERS_LICENSE', 'PROPERTY_ASSESSMENT_NOTICE', 'SPEC_TAX_CONFIRMATION', 'HOG_DECLARATION', 'ICBC_CERTIFICATE_OF_INSURANCE', 'HOME_INSURANCE_SUMMARY', 'PROPERTY_TAX_NOTICE', 'UTILITY_BILL', 'GOVT_OR_CROWN_CORP_OFFICIAL_NOTICE', 'TENANCY_AGREEMENT', 'RENT_RECEIPT_OR_BANK_STATEMENT', 'LOCAL_GOVT_BUSINESS_LICENSE', 'OTHERS', 'STRATA_HOTEL_DOCUMENTATION', 'FRACTIONAL_OWNERSHIP_AGREEMENT', 'BCSC', 'COMBINED_BCSC_LICENCE')
new_options = ('BC_DRIVERS_LICENSE', 'PROPERTY_ASSESSMENT_NOTICE', 'SPEC_TAX_CONFIRMATION', 'HOG_DECLARATION', 'ICBC_CERTIFICATE_OF_INSURANCE', 'HOME_INSURANCE_SUMMARY', 'PROPERTY_TAX_NOTICE', 'UTILITY_BILL', 'GOVT_OR_CROWN_CORP_OFFICIAL_NOTICE', 'TENANCY_AGREEMENT', 'RENT_RECEIPT_OR_BANK_STATEMENT', 'LOCAL_GOVT_BUSINESS_LICENSE', 'OTHERS', 'STRATA_HOTEL_DOCUMENTATION', 'FRACTIONAL_OWNERSHIP_AGREEMENT', 'BCSC', 'COMBINED_BCSC_LICENSE')

old_type = sa.Enum(*old_options, name='documenttype')
new_type = sa.Enum(*new_options, name='documenttype')


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute('ALTER TYPE documenttype RENAME TO tmp_documenttype')
new_type.create(op.get_bind())
op.execute('ALTER TABLE documents ALTER COLUMN document_type TYPE documenttype USING document_type::text::documenttype')
op.execute('ALTER TABLE documents_history ALTER COLUMN document_type TYPE documenttype USING document_type::text::documenttype')
op.execute('DROP TYPE tmp_documenttype')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute('ALTER TYPE documenttype RENAME TO tmp_documenttype')
old_type.create(op.get_bind())
op.execute('ALTER TABLE documents ALTER COLUMN document_type TYPE documenttype USING document_type::text::documenttype')
op.execute('ALTER TABLE documents_history ALTER COLUMN document_type TYPE documenttype USING document_type::text::documenttype')
op.execute('DROP TYPE tmp_documenttype')
# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion strr-api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "strr-api"
version = "0.0.25"
version = "0.0.28"
description = ""
authors = ["thorwolpert <thor@wolpert.ca>"]
license = "BSD 3-Clause"
Expand Down
10 changes: 3 additions & 7 deletions strr-api/src/strr_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,18 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""The Legal API service.
"""The STRR API.

This module is the API for the Legal Entity system.
This module is the API for the Short Term Rental Registry.
"""
import logging
import logging.config
import os

import coloredlogs
import sentry_sdk
from flask import Flask
from flask_cors import CORS
from flask_migrate import Migrate, upgrade
from flask_migrate import Migrate
from sentry_sdk.integrations.flask import FlaskIntegration

from .common.auth import jwt
Expand Down Expand Up @@ -79,9 +78,6 @@ def create_app(environment: Config = Production, **kwargs) -> Flask:

if not app.config.get("TESTING", False):
Migrate(app, db)
logger.info("Running migration upgrade.")
with app.app_context():
upgrade(directory="migrations", revision="head", sql=False, tag=None)

strr_pay.init_app(app)
babel.init_app(app)
Expand Down
2 changes: 0 additions & 2 deletions strr-api/src/strr_api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from .auto_approval_record import AutoApprovalRecord
from .certificate import Certificate
from .db import db # noqa: I001
from .dss import DSSOrganization
from .events import Events
from .ltsa import LTSARecord
from .platforms import Platform, PlatformBrand, PlatformRegistration, PlatformRepresentative
Expand All @@ -61,7 +60,6 @@
"Contact",
"Document",
"Events",
"DSSOrganization",
"AutoApprovalRecord",
"LTSARecord",
"Certificate",
Expand Down
2 changes: 1 addition & 1 deletion strr-api/src/strr_api/models/rental.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class DocumentType(BaseEnum):
STRATA_HOTEL_DOCUMENTATION = auto() # pylint: disable=invalid-name
FRACTIONAL_OWNERSHIP_AGREEMENT = auto() # pylint: disable=invalid-name
BCSC = auto() # pylint: disable=invalid-name
COMBINED_BCSC_LICENCE = auto() # pylint: disable=invalid-name
COMBINED_BCSC_LICENSE = auto() # pylint: disable=invalid-name

__tablename__ = "documents"

Expand Down
2 changes: 1 addition & 1 deletion strr-api/src/strr_api/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Contact(Versioned, db.Model):
__tablename__ = "contacts"

id = db.Column(db.Integer, primary_key=True, autoincrement=True)
firstname = db.Column(db.String(1000), nullable=False)
firstname = db.Column(db.String(1000), nullable=True)
lastname = db.Column(db.String(1000), nullable=False)
middlename = db.Column(db.String(1000))
address_id = db.Column(db.Integer, db.ForeignKey("addresses.id"), nullable=True)
Expand Down
74 changes: 25 additions & 49 deletions strr-api/src/strr_api/requests/RegistrationRequest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=C0103
# pylint: disable=R0913
# pylint: disable=R0917
# pylint: disable=R0914
"""
Registration request payload objects.
"""
Expand All @@ -22,21 +23,21 @@ def __init__( # pylint: disable=W0102
unitAddress,
unitDetails,
listingDetails,
principalResidence,
secondaryContact=None,
documents=[], # pylint: disable=W0102
registrationType=None,
propertyManager=None,
strRequirements=None,
):
self.primaryContact = Contact(**primaryContact)
self.secondaryContact = Contact(**secondaryContact) if secondaryContact else None
self.unitAddress = UnitAddress(**unitAddress)
self.unitDetails = UnitDetails(**unitDetails)
self.listingDetails = [ListingDetails(**item) for item in listingDetails]
self.principalResidence = PrincipalResidence(**principalResidence)
self.documents = [Document(**document) for document in documents]
self.registrationType = registrationType
self.propertyManager = PropertyManager(**propertyManager) if propertyManager else None
self.strRequirements = strRequirements


class PropertyManager:
Expand Down Expand Up @@ -99,24 +100,6 @@ def __init__(
self.mailingAddress = MailingAddress(**mailingAddress) if mailingAddress else None


class PrincipalResidence:
"""PrincipalResidence payload object."""

def __init__(
self,
isPrincipalResidence,
agreedToRentalAct,
agreedToSubmit,
nonPrincipalOption=None,
specifiedServiceProvider=None,
):
self.isPrincipalResidence = isPrincipalResidence
self.agreedToRentalAct = agreedToRentalAct
self.agreedToSubmit = agreedToSubmit
self.nonPrincipalOption = nonPrincipalOption
self.specifiedServiceProvider = specifiedServiceProvider


class ListingDetails:
"""ListingDetails payload object."""

Expand All @@ -139,6 +122,7 @@ def __init__(
businessLicense=None,
businessLicenseExpiryDate=None,
strataHotelRegistrationNumber=None,
prExemptReason=None,
):
self.propertyType = propertyType
self.ownershipType = ownershipType
Expand All @@ -150,6 +134,7 @@ def __init__(
self.numberOfRoomsForRent = numberOfRoomsForRent
self.businessLicenseExpiryDate = businessLicenseExpiryDate
self.strataHotelRegistrationNumber = strataHotelRegistrationNumber
self.prExemptReason = prExemptReason


class MailingAddress:
Expand Down Expand Up @@ -190,51 +175,42 @@ def __init__(
self.unitNumber = unitNumber


class ContactName:
"""ContactName payload object."""

def __init__(self, firstName, lastName, middleName=None):
self.firstName = firstName
self.lastName = lastName
self.middleName = middleName


class ContactDetails:
"""ContactDetails payload object."""

def __init__(
self, phoneNumber, emailAddress, preferredName=None, extension=None, faxNumber=None, phoneCountryCode=None
):
self.phoneNumber = phoneNumber
self.emailAddress = emailAddress
self.preferredName = preferredName
self.extension = extension
self.faxNumber = faxNumber
self.phoneCountryCode = phoneCountryCode


class Contact:
"""Contact payload object."""

def __init__(
self,
name,
details,
mailingAddress,
firstName=None,
lastName=None,
middleName=None,
mailingAddress=None,
socialInsuranceNumber=None,
businessNumber=None,
businessLegalName=None,
contactType=None,
dateOfBirth=None,
phoneNumber=None,
emailAddress=None,
preferredName=None,
extension=None,
faxNumber=None,
phoneCountryCode=None,
):
self.name = ContactName(**name)
self.firstName = firstName
self.lastName = lastName
self.middleName = middleName
self.dateOfBirth = dateOfBirth
self.socialInsuranceNumber = socialInsuranceNumber
self.businessNumber = businessNumber
self.details = ContactDetails(**details)
self.mailingAddress = MailingAddress(**mailingAddress)
self.businessLegalName = businessLegalName
self.contactType = contactType
self.phoneNumber = phoneNumber
self.emailAddress = emailAddress
self.preferredName = preferredName
self.extension = extension
self.faxNumber = faxNumber
self.phoneCountryCode = phoneCountryCode
self.mailingAddress = MailingAddress(**mailingAddress)


class Document:
Expand Down
Loading
Loading