UNPKG

@horizon-domains/property-model

Version:

Modelo de propriedades imobiliárias v3 - Sistema de atributos dinâmicos

698 lines (691 loc) 11.2 kB
import type { EntitySchema } from "./types"; export const horizonPropertySchemaBase: EntitySchema = { entity: "property", version: "2.3.0", description: "Schema base canônico do modelo de propriedade Horizon v3", fields: [ // ======================================== // SISTEMA // ======================================== { key: "source_published_at", type: "String", categories: ["sistema"], format: "datetime", ui: { label: "Data da publicação original", }, audit: { origin: "hb:property", }, }, { key: "source_updated_at", type: "String", categories: ["sistema"], format: "datetime", validation: { required: true, }, ui: { label: "Data da última republicação", }, audit: { origin: "hb:property", }, }, { key: "currency", type: "String", categories: ["sistema"], validation: { required: true, }, db: { default: "BRL", }, ui: { label: "Moeda", }, audit: { origin: "hb:property", }, }, { key: "unit_area", type: "String", categories: ["sistema"], validation: { required: true, }, db: { default: "m2", }, ui: { label: "Unidade de área", }, audit: { origin: "hb:property", }, }, { key: "unit_distance", type: "String", categories: ["sistema"], enum: { meters: "Metros", km: "Quilômetros", }, validation: { required: true, }, db: { default: "meters", }, ui: { label: "Unidade de distância", }, audit: { origin: "hb:property", }, }, // ======================================== // CABEÇALHO // ======================================== { key: "reference", type: "String", categories: ["cabecalho"], validation: { required: true, }, ui: { label: "Referência", }, audit: { origin: "hb:property", }, }, { key: "title", type: "String", categories: ["cabecalho"], validation: { required: true, maxLength: 200, }, ui: { label: "Título", }, audit: { origin: "hb:property", }, }, { key: "description", type: "String", categories: ["cabecalho"], validation: { required: true, }, db: { type: "text", index: "fulltext", }, ui: { label: "Descrição", }, audit: { origin: "hb:property", }, }, // ======================================== // SEO // ======================================== { key: "seo_slug", type: "String", categories: ["seo"], validation: { maxLength: 255, }, db: { type: "varchar(255)", unique: true, index: true, }, ui: { label: "Slug SEO", }, audit: { origin: "hb:property", }, }, { key: "seo_title", type: "String", categories: ["seo"], validation: { maxLength: 60, }, ui: { label: "Título SEO", }, audit: { origin: "hb:property", }, }, { key: "seo_description", type: "String", categories: ["seo"], validation: { maxLength: 160, }, ui: { label: "Descrição SEO", }, audit: { origin: "hb:property", }, }, { key: "seo_keywords", type: "String", categories: ["seo"], validation: { maxLength: 200, }, ui: { label: "Palavras-chave SEO", }, audit: { origin: "hb:property", }, }, // ======================================== // MÍDIAS // ======================================== { key: "main_image", type: "Json", categories: ["media"], ui: { label: "Imagem principal", }, audit: { origin: "hb:property", }, }, { key: "images", type: "Json[]", categories: ["media"], validation: { required: true, }, ui: { label: "Imagens", }, audit: { origin: "hb:property", }, }, { key: "videos", type: "Json[]", categories: ["media"], validation: { required: true, }, ui: { label: "Vídeos", }, audit: { origin: "hb:property", }, }, { key: "virtual_tours", type: "Json[]", categories: ["media"], validation: { required: true, }, ui: { label: "Tours virtuais", }, audit: { origin: "hb:property", }, }, // ======================================== // FICHA TÉCNICA // ======================================== { key: "operacao", type: "String[]", categories: ["ficha-tecnica"], enum: { venda: "Venda", locacao: "Locação", temporada: "Temporada", }, validation: { required: true, }, ui: { label: "Operação", }, audit: { origin: "hb:property", }, }, { key: "tipo", type: "String", categories: ["ficha-tecnica"], validation: { required: true, }, ui: { label: "Tipo do imóvel", }, audit: { origin: "hb:property", }, }, { key: "dormitorios", type: "Number", categories: ["ficha-tecnica"], format: "count", validation: { min: 0, }, ui: { label: "Dormitórios", }, audit: { origin: "hb:property", }, }, { key: "suites", type: "Number", categories: ["ficha-tecnica"], format: "count", validation: { min: 0, }, ui: { label: "Suítes", }, audit: { origin: "hb:property", }, }, { key: "banheiros", type: "Number", categories: ["ficha-tecnica"], format: "count", validation: { min: 0, }, ui: { label: "Banheiros", }, audit: { origin: "hb:property", }, }, { key: "vagas_garagem", type: "Number", categories: ["ficha-tecnica"], format: "count", validation: { min: 0, }, ui: { label: "Vagas de garagem", }, audit: { origin: "hb:property", }, }, { key: "area_total", type: "Number", categories: ["ficha-tecnica"], format: "area", unit: "m2", validation: { min: 0, }, ui: { label: "Área total", }, audit: { origin: "hb:property", }, }, { key: "area_privativa", type: "Number", categories: ["ficha-tecnica"], format: "area", unit: "m2", validation: { min: 0, }, ui: { label: "Área privativa", }, audit: { origin: "hb:property", }, }, { key: "area_util", type: "Number", categories: ["ficha-tecnica"], format: "area", unit: "m2", validation: { min: 0, }, ui: { label: "Área útil", }, audit: { origin: "hb:property", }, }, { key: "destaque", type: "Boolean", categories: ["ficha-tecnica"], ui: { label: "Imóvel em destaque", }, audit: { origin: "hb:property", }, }, // ======================================== // VALORES // ======================================== { key: "valor_venda", type: "Number", categories: ["valores"], format: "currency", unit: "BRL", validation: { precision: 2, }, rules: { conditions: ["operacao:venda"], }, ui: { label: "Valor de venda", }, audit: { origin: "hb:property", }, }, { key: "valor_locacao", type: "Number", categories: ["valores"], format: "currency", unit: "BRL", validation: { precision: 2, }, rules: { conditions: ["operacao:locacao"], }, ui: { label: "Valor de locação", }, audit: { origin: "hb:property", }, }, { key: "valor_condominio", type: "Number", categories: ["valores"], format: "currency", unit: "BRL", validation: { precision: 2, }, ui: { label: "Valor do condomínio", }, audit: { origin: "hb:property", }, }, { key: "valor_iptu", type: "Number", categories: ["valores"], format: "currency", unit: "BRL", validation: { precision: 2, }, ui: { label: "Valor do IPTU", }, audit: { origin: "hb:property", }, }, // ======================================== // LOCALIZAÇÃO // ======================================== { key: "endereco_cep", type: "String", categories: ["localizacao"], validation: { maxLength: 9, }, mask: "cep", ui: { label: "CEP", }, audit: { origin: "hb:property", }, }, { key: "endereco_estado", type: "String", categories: ["localizacao"], ui: { label: "Estado", }, audit: { origin: "hb:property", }, }, { key: "endereco_cidade", type: "String", categories: ["localizacao"], rules: { parent: "endereco_estado", }, ui: { label: "Cidade", }, audit: { origin: "hb:property", }, }, { key: "endereco_bairro", type: "String", categories: ["localizacao"], rules: { parent: "endereco_cidade", }, ui: { label: "Bairro", }, audit: { origin: "hb:property", }, }, { key: "endereco_logradouro", type: "String", categories: ["localizacao"], ui: { label: "Logradouro", }, audit: { origin: "hb:property", }, }, { key: "endereco_numero", type: "String", categories: ["localizacao"], ui: { label: "Número", }, audit: { origin: "hb:property", }, }, { key: "endereco_complemento", type: "String", categories: ["localizacao"], ui: { label: "Complemento", }, audit: { origin: "hb:property", }, }, { key: "endereco_referencia", type: "String", categories: ["localizacao"], ui: { label: "Referência", }, audit: { origin: "hb:property", }, }, { key: "endereco_zona", type: "String", categories: ["localizacao"], ui: { label: "Zona", }, audit: { origin: "hb:property", }, }, { key: "lat", type: "Number", categories: ["localizacao"], validation: { min: -90, max: 90, precision: 8, }, db: { type: "decimal(10,8)", index: "geo", }, ui: { label: "Latitude", }, audit: { origin: "hb:property", }, }, { key: "lng", type: "Number", categories: ["localizacao"], validation: { min: -180, max: 180, precision: 8, }, db: { type: "decimal(11,8)", index: "geo", }, ui: { label: "Longitude", }, audit: { origin: "hb:property", }, }, // ======================================== // Relações // ======================================== { key: "corretor_key", type: "String", categories: ["relations"], ui: { label: "ID do corretor", }, audit: { origin: "hb:property", }, }, { key: "corretor_nome", type: "String", categories: ["relations"], ui: { label: "Nome do corretor", }, audit: { origin: "hb:property", }, }, { key: "condominio_key", type: "String", categories: ["relations"], ui: { label: "ID do condomínio", }, audit: { origin: "hb:property", }, }, { key: "condominio_nome", type: "String", categories: ["relations"], ui: { label: "Nome do condomínio", }, audit: { origin: "hb:property", }, }, ], }; export default horizonPropertySchemaBase;