Skip to content

Commit

Permalink
Merge branch 'main' into bug-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deetz99 authored Dec 13, 2024
2 parents 05ab024 + 68dace9 commit 1daeb0c
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 14 deletions.
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.27"
version = "0.0.28"
description = ""
authors = ["thorwolpert <thor@wolpert.ca>"]
license = "BSD 3-Clause"
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
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
"STRATA_HOTEL_DOCUMENTATION",
"FRACTIONAL_OWNERSHIP_AGREEMENT",
"BCSC",
"COMBINED_BCSC_LICENCE"
"COMBINED_BCSC_LICENSE"
]
}
},
Expand Down
8 changes: 7 additions & 1 deletion strr-base-web/app/composables/useStrrApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ export const useStrrApi = () => {
})
}

const updatePaymentDetails = async <T extends ApiApplicationBaseResp>(applicationNumber: string) => {
return await $strrApi<T>(`/applications/${applicationNumber}/payment-details`,
{ method: 'PUT' })
}

return {
getAccountRegistrations,
getAccountApplications,
getApplicationReceipt,
getRegistrationCert,
postApplication
postApplication,
updatePaymentDetails
}
}
7 changes: 6 additions & 1 deletion strr-base-web/app/composables/useStrrBasePermit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const useStrrBasePermit = <R extends ApiRegistrationResp, A extends ApiAp
getAccountApplications,
getAccountRegistrations,
getApplicationReceipt,
getRegistrationCert
getRegistrationCert,
updatePaymentDetails
} = useStrrApi()

// Typescript not unwrapping the generic ref properly without the 'as ...'
Expand All @@ -34,6 +35,10 @@ export const useStrrBasePermit = <R extends ApiRegistrationResp, A extends ApiAp
if (applicationId) {
// Get specific application
application.value = await getAccountApplications<A>(applicationId) as A
if (application.value.header.status === ApplicationStatus.PAYMENT_DUE) {
// there is a lag in the payment Q, trigger the strr api to grab the most current pay details
application.value = await updatePaymentDetails<A>(applicationId)
}
if (application.value?.header.registrationId) {
// Get linked registration if applicable
registration.value = await getAccountRegistrations<R>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@ defineEmits<{
}>()
const ownerStore = useHostOwnerStore()
const { hostOwners, hasCompParty } = storeToRefs(ownerStore)
const isCompParty = ref(owner.value.isCompParty)
watch(isCompParty, (val) => {
if (val && hasCompParty.value) {
// if a different owner has it set to true as well then set the old one to false
const compPartyIndex = ownerStore.findCompPartyIndex()
// @ts-expect-error - ts doesn't recognize that the value must be defined in this case
hostOwners.value[compPartyIndex].isCompParty = false
}
// set owner isCompParty and update the name with user creds
owner.value.isCompParty = val
ownerStore.SetOwnerNameWithUserCreds(owner)
Expand Down
2 changes: 1 addition & 1 deletion strr-host-pm-web/app/middleware/create-account-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export default defineNuxtRouteMiddleware(() => {
const localePath = useLocalePath()
return navigateTo({ path: localePath('/auth/account/choose-existing') })
}
})
})
4 changes: 3 additions & 1 deletion strr-host-pm-web/app/pages/auth/account/choose-existing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ function handleAccountSwitch (id: string) {
icon="i-mdi-chevron-right"
trailing
:block="isSmallScreen"
:to="$keycloak.tokenParsed.loginSource === LoginSource.BCSC ? localePath('/auth/account/create-new') : useConnectNav().createAccountUrl()"
:to="$keycloak.tokenParsed.loginSource === LoginSource.BCSC
? localePath('/auth/account/create-new')
: useConnectNav().createAccountUrl()"
:external="$keycloak.tokenParsed.loginSource !== LoginSource.BCSC"
:target="$keycloak.tokenParsed.loginSource === LoginSource.BCSC ? '_self' : '_blank'"
/>
Expand Down
11 changes: 11 additions & 0 deletions strr-host-pm-web/app/stores/hostOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ export const useHostOwnerStore = defineStore('host/owner', () => {
const hasPropertyManager = computed(() => !!findByRole(OwnerRole.PROPERTY_MANAGER))
const hasCompParty = computed(() => findCompPartyIndex() !== -1)

const checkCompParty = (owner: HostOwner) => {
const compPartyIndex = findCompPartyIndex()
if (owner.isCompParty && compPartyIndex !== -1) {
// if a different owner has it set to true as well then set the old one to false
// @ts-expect-error - ts doesn't recognize that the value must be defined in this case
hostOwners.value[compPartyIndex].isCompParty = false
}
}

const addHostOwner = (owner: HostOwner) => {
checkCompParty(owner)
hostOwners.value.push(owner)
}

Expand All @@ -78,6 +88,7 @@ export const useHostOwnerStore = defineStore('host/owner', () => {
}

const updateHostOwner = (owner: HostOwner, index: number) => {
checkCompParty(owner)
hostOwners.value.splice(index, 1, owner)
}

Expand Down

0 comments on commit 1daeb0c

Please sign in to comment.