-
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.
feat: new api with real estate properties
- Loading branch information
Showing
20 changed files
with
174 additions
and
116 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RealEstate } from '../data/real_estate'; | ||
import deferredDataRequest from './api'; | ||
import { mockRealEstate } from './mock'; | ||
|
||
/** | ||
* @description Get real estte by ID. | ||
* @param id property ID | ||
* @returns Real estate data | ||
*/ | ||
const getRealEstate = async (id: bigint): Promise<RealEstate> => { | ||
const url = `/real-estate/${id}`; | ||
|
||
return await deferredDataRequest('GET', url, mockRealEstate(id)); | ||
}; | ||
|
||
export default getRealEstate; |
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,28 @@ | ||
import deferredDataRequest, { makeQueryArgs } from './api'; | ||
import { mockContractIds } from './mock'; | ||
|
||
interface Filters { | ||
agent?: string; | ||
name?: string; | ||
description?: string; | ||
address?: string; | ||
country?: string; | ||
continent?: string; | ||
region?: string; | ||
zipCode?: string; | ||
latitude?: string; | ||
longitude?: string; | ||
radius?: string; | ||
zone?: string; | ||
city?: string; | ||
squareMeters?: number; | ||
rooms?: number; | ||
} | ||
|
||
const getRealEstates = async (filters?: Filters): Promise<bigint[]> => { | ||
const url = `/real-estate?${makeQueryArgs(filters ?? {})}`; | ||
|
||
return await deferredDataRequest('GET', url, mockContractIds()); | ||
}; | ||
|
||
export default getRealEstates; |
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,6 +1,7 @@ | ||
import { ContractData } from './getContractById'; | ||
import villaLondon from '../../assets/images/case/villa_london.webp'; | ||
import { Agency } from '../data/contract'; | ||
import { Agency } from '../data/agency'; | ||
import { RealEstate } from '../data/real_estate'; | ||
|
||
const FIRST_CONTRACT_ID = 1; | ||
|
||
|
@@ -14,6 +15,55 @@ export const mockContractIds = (): bigint[] => { | |
return ids; | ||
}; | ||
|
||
export const mockAgency = (owner: string): Agency => { | ||
return { | ||
address: 'Via Roma 1', | ||
name: 'Agency', | ||
agent: 'Miriam', | ||
city: 'Milano', | ||
continent: 'Europe', | ||
country: 'Italy', | ||
email: '[email protected]', | ||
logo: villaLondon, | ||
mobile: '+39 333 1234567', | ||
owner, | ||
region: 'Lombardia', | ||
vat: 'IT12345678901', | ||
website: 'https://www.agency.com', | ||
zip_code: '20121', | ||
}; | ||
}; | ||
|
||
export const mockRealEstate = (id: bigint): RealEstate => { | ||
return { | ||
id, | ||
name: 'Villa in the heart of London', | ||
description: 'A beautiful villa in the heart of London', | ||
image: villaLondon, | ||
address: 'Via Roma 1', | ||
country: 'Italy', | ||
continent: 'Europe', | ||
region: 'Lombardia', | ||
zipCode: '20121', | ||
latitude: 45.464664, | ||
longitude: 9.18854, | ||
zone: 'City Center', | ||
squareMeters: 200, | ||
rooms: 4, | ||
bathrooms: 2, | ||
bedrooms: 2, | ||
floors: 2, | ||
balconies: 1, | ||
garden: true, | ||
garage: true, | ||
pool: false, | ||
parking: false, | ||
yearOfConstruction: 2017, | ||
energyClass: 'A', | ||
youtubeUrl: 'https://www.youtube.com/watch?v=DHaeadPJoJY', | ||
}; | ||
}; | ||
|
||
export const mockContract = (id: bigint): ContractData => { | ||
return { | ||
id, | ||
|
@@ -29,24 +79,10 @@ export const mockContract = (id: bigint): ContractData => { | |
value: 400_000, | ||
deposit: 50_000, | ||
currency: 'USD', | ||
agency: { | ||
address: 'Via Roma 1', | ||
name: 'Agency', | ||
agent: 'Miriam', | ||
city: 'Milano', | ||
continent: 'Europe', | ||
country: 'Italy', | ||
email: '[email protected]', | ||
logo: villaLondon, | ||
mobile: '+39 333 1234567', | ||
owner: 'v5vof-zqaaa-aaaal-ai5cq', | ||
region: 'Lombardia', | ||
vat: 'IT12345678901', | ||
website: 'https://www.agency.com', | ||
zip_code: '20121', | ||
}, | ||
agency: 'v5vof-zqaaa-aaaal-ai5cq', | ||
expiration: '2050-01-01', | ||
restricted_properties: [], | ||
real_estate: BigInt(1), | ||
documents: [ | ||
[ | ||
1, | ||
|
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
2 changes: 1 addition & 1 deletion
2
src/js/components/App/pages/Agencies/pages/Agency/AgencyCard.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Continent } from './contract'; | ||
|
||
export interface Agency { | ||
address: string; | ||
agent: string; | ||
city: string; | ||
continent: Continent; | ||
country: string; | ||
email: string; | ||
lat?: string; | ||
lng?: string; | ||
logo?: string; | ||
mobile: string; | ||
name: string; | ||
owner: string; | ||
region: string; | ||
vat: string; | ||
website: string; | ||
zip_code: string; | ||
} |
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.