Skip to content

Commit

Permalink
use leasing endpoint return type
Browse files Browse the repository at this point in the history
  • Loading branch information
momentiris committed Nov 6, 2024
1 parent dba6b96 commit 311f442
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/adapters/leasing-adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import {
DetailedApplicant,
Tenant,
ApplicationProfile,
leasing,
} from 'onecore-types'
import { z } from 'zod'

import { AdapterResult } from './../types'
import config from '../../common/config'
Expand Down Expand Up @@ -511,13 +513,19 @@ const validatePropertyRentalRules = async (
}
}

type GetApplicationProfileResponseData = z.infer<
typeof leasing.GetApplicationProfileResponseDataSchema
>

async function getApplicationProfileByContactCode(
contactCode: string
): Promise<AdapterResult<ApplicationProfile, 'unknown' | 'not-found'>> {
): Promise<
AdapterResult<GetApplicationProfileResponseData, 'unknown' | 'not-found'>
> {
try {
const response = await axios.get<{ content: ApplicationProfile }>(
`${tenantsLeasesServiceUrl}/contacts/${contactCode}/application-profile`
)
const response = await axios.get<{
content: GetApplicationProfileResponseData
}>(`${tenantsLeasesServiceUrl}/contacts/${contactCode}/application-profile`)

if (response.status === 200) {
return { ok: true, data: response.data.content }
Expand Down

0 comments on commit 311f442

Please sign in to comment.