@horizon-modules/arbo-crm-to-property-v2
Version:
Conversor de dados do Arbo CRM para o formato Property Model V2
169 lines (140 loc) • 3.66 kB
Markdown
# @horizon-modules/arbo-crm-to-property-v2
Conversor de dados do Arbo CRM para Property Model V2.
## Instalação
```bash
pnpm add @horizon-modules/arbo-crm-to-property-v2
```
## Uso
```typescript
import { convertArboToPropertyV2, convertMultipleArboToPropertyV2 } from '@horizon-modules/arbo-crm-to-property-v2'
// Converter um imóvel
const propertyV2 = convertArboToPropertyV2(arboData, {
agentId: "agent-123",
clientId: "client-456"
})
// Converter múltiplos
const propertiesV2 = convertMultipleArboToPropertyV2(arboArray, options)
```
## Opções
```typescript
interface ConversionOptions {
agentId?: string
clientId?: string
defaultThumbnail?: string
generateKeywords?: boolean // padrão: true
generateTags?: boolean // padrão: true
}
```
## Entrada (Arbo CRM)
```typescript
interface ArboProperty {
ref_id: number
codigo: string
titulo: string
descricao: string
finalidade: string // "Venda", "Aluguel"
categoria: string // "Sobrado", "Terreno", etc.
tipo_imovel: string // "Residencial", "Comercial"
valor_venda?: number
valor_aluguel?: number
qtd_quartos?: number
qtd_banheiro?: number
qtd_suites?: number
qtd_vagas?: number
area_total?: number
area_privativa?: number
end_cidade?: string
end_bairro?: string
end_estado?: string
end_logradouro?: string
end_numero?: number
end_cep?: string
latitude?: number
longitude?: number
fotos?: ArboPhoto[]
caracteristicas?: string[]
corretor?: ArboCorretor
imobiliaria?: ArboImobiliaria
mobiliado?: boolean
permuta?: boolean
financiamento?: boolean
}
```
## Saída (Property V2)
```typescript
interface PropertyV2 {
id: number
reference: string
title: string
description: string
type: string // "Casa", "Apartamento", "Terreno/Lote"
subtype: string // "Sobrado", "Duplex", "Terreno"
operation: string // "sale", "rent", "season"
attributes: PropertyV2Attribute[]
media: PropertyV2Media
tags: string
keywords: string
thumbnails: string
provider: string // "arbo-crm"
property_search: PropertyV2Search[]
}
```
## Tipos Suportados
| Categoria Arbo | Type V2 | Subtype V2 |
|---|---|---|
| Sobrado | Casa | Sobrado |
| Casa | Casa | Casa padrão |
| Apartamento | Apartamento | Apartamento |
| Duplex | Apartamento | Duplex |
| Terreno | Terreno/Lote | Terreno |
| Lote | Terreno/Lote | Lote |
## Atributos Gerados
**Seção rooms:**
- bedrooms, bathrooms, suites
- kitchen, living-room, dining-room
- service-area, balcony, closet
**Seção feature:**
- total-area, private-area
- garage, sale-value, rent-value
**Seção improvement:**
- pool, bbq, security, recreation
**Seção location:**
- address, city, district, state
- zipcode, latitude, longitude
## Tags Automáticas
- **Operação:** sale, rent, season
- **Características:** pool, bbq, security, furnished
- **Especiais:** financing, exchange, in-condominium
## Testes
```bash
pnpm test # 22 testes
pnpm typecheck # verificação TypeScript
pnpm build # build ESM + CJS
```
## Exemplo Real
```typescript
// Dados do Arbo CRM
const arboData = {
ref_id: 3015393,
codigo: "SO0001_TB",
titulo: "Sobrado à venda 2 Quadras do lago",
categoria: "Sobrado",
tipo_imovel: "Residencial",
finalidade: "Venda",
valor_venda: 510000,
qtd_quartos: 3,
qtd_banheiro: 2,
area_total: 100
}
// Resultado
const result = convertArboToPropertyV2(arboData)
// {
// type: "Casa",
// subtype: "Sobrado",
// operation: "sale",
// attributes: [34 itens],
// tags: "sale has-suite financing"
// }
```
## Licença
MIT