Files
mdb/app/types/collections.ts
Bastien COIGNOUX 360522f30a recherche
2026-05-04 22:11:46 +02:00

262 lines
5.8 KiB
TypeScript

import type { RecordModel } from 'pocketbase';
export type UserRecord = RecordModel & {
email: string;
name?: string;
};
export type BienType =
| 'appartement'
| 'maison'
| 'immeuble'
| 'terrain'
| 'local_commercial'
| 'parking'
| 'cave'
| 'autre';
export type BienSource =
| 'particulier'
| 'agence'
| 'notaire'
| 'tribunal'
| 'succession'
| 'reseau'
| 'autre';
export type TypeBienFiscal = 'ancien' | 'neuf';
export type BienRecord = RecordModel & {
user: string;
etape?: string;
source_contact?: string;
titre?: string;
type_bien?: BienType;
adresse?: string;
code_postal?: string;
ville?: string;
latitude?: number;
longitude?: number;
surface_habitable?: number;
surface_totale?: number;
nb_pieces?: number;
nb_chambres?: number;
annee_construction?: number;
dpe_lettre?: string;
dpe_valeur?: number;
source?: BienSource;
url_annonce?: string;
statut?: string;
priorite?: number;
is_off_market?: boolean;
date_premiere_visite?: string;
date_offre?: string;
date_compromis?: string;
date_acte?: string;
description?: string;
points_forts?: string;
points_faibles?: string;
photo_principale?: string;
};
export type BienCreate = Partial<Omit<BienRecord, 'id' | 'created' | 'updated' | 'collectionId' | 'collectionName'>> & {
user: string;
ville: string;
code_postal: string;
type_bien: BienType;
};
export type BienUpdate = Partial<Omit<BienRecord, 'id' | 'user' | 'created' | 'updated' | 'collectionId' | 'collectionName'>>;
export type EtapePipelineRecord = RecordModel & {
user: string;
nom: string;
ordre: number;
couleur?: string;
is_terminal?: boolean;
};
export type ContactRecord = RecordModel & {
user: string;
nom: string;
prenom?: string;
societe?: string;
categorie: string;
specialite?: string;
email?: string;
telephone?: string;
telephone_2?: string;
ville?: string;
zone_intervention?: string;
note?: number;
recommande?: boolean;
taux_horaire?: number;
notes?: string;
is_favori?: boolean;
};
export type AnalyseFinanciereRecord = RecordModel & {
user: string;
bien: string;
prix_achat?: number;
type_bien_fiscal?: TypeBienFiscal;
frais_notaire?: number;
frais_agence_achat?: number;
budget_travaux?: number;
reserve_imprevus_pct?: number;
duree_portage_mois?: number;
taux_credit?: number;
taxe_fonciere_annuelle?: number;
charges_copropriete_mensuelle?: number;
prix_revente_cible?: number;
frais_agence_vente_pct?: number;
taux_impot?: number;
marge_brute?: number;
marge_brute_pct?: number;
marge_nette?: number;
marge_nette_pct?: number;
notes?: string;
/** Prix de revente estimé au m² (référence marché / grille perso). */
prix_revente_m2?: number;
};
export type AnalyseSecteurRecord = RecordModel & {
user: string;
ville: string;
notes?: string;
};
export type NoteProspectionRecord = RecordModel & {
user: string;
question: string;
reponse?: string;
categorie?: string;
};
export type GrillePrixTypeBien = 'appartement' | 'maison' | 'immeuble';
export type GrillePrixEtat = 'bon_etat' | 'a_renover' | 'travaux_lourds';
export type GrillePrixRecord = RecordModel & {
user: string;
type_bien: GrillePrixTypeBien;
etat: GrillePrixEtat;
prix_achat_m2: number;
prix_revente_m2: number;
marge_estimee_pct?: number;
ville?: string;
};
export type RechercheSauvegardeeRecord = RecordModel & {
user: string;
nom: string;
critere_json?: string;
actif?: boolean;
};
export type AlerteRechercheRecord = RecordModel & {
user: string;
recherche?: string;
nom: string;
canal: 'in_app' | 'email' | 'push';
actif?: boolean;
derniere_verification?: string;
dernier_nb_resultats?: number;
};
export type AnnonceVeilleStatut = 'nouveau' | 'vu' | 'ecarte' | 'raccroche';
export type AnnonceVeilleRecord = RecordModel & {
user: string;
titre: string;
url?: string;
source?: string;
prix?: number;
surface?: number;
code_postal?: string;
ville?: string;
empreinte?: string;
statut: AnnonceVeilleStatut;
};
export type FluxSourceType = 'api' | 'manuel' | 'csv';
export type FluxSourceRecord = RecordModel & {
user: string;
nom: string;
type: FluxSourceType;
notes?: string;
actif?: boolean;
};
export type TransactionSecteurSource = 'manuel' | 'dvf_import' | 'api_tiers';
export type TransactionSecteurRecord = RecordModel & {
user: string;
libelle: string;
code_insee?: string;
annee?: number;
prix_m2_median?: number;
nb_ventes?: number;
source: TransactionSecteurSource;
detail_json?: string;
};
export type CourrierImmobilierKind = 'prospection' | 'annonce_agence' | 'relance';
export type CourrierImmobilierEtat = 'brouillon' | 'pret';
export type CourrierImmobilierRecord = RecordModel & {
user: string;
titre: string;
corps?: string;
kind: CourrierImmobilierKind;
etat: CourrierImmobilierEtat;
};
export type VisiteRecord = RecordModel & {
user: string;
bien: string;
date_visite: string;
duree_minutes?: number;
type_visite?: string;
avis_global?: string;
notes_brutes?: string;
rapport_genere?: string;
checklist_reponses?: Record<string, string>;
estimation_travaux_min?: number;
estimation_travaux_max?: number;
score_opportunite?: number;
photos?: string[];
};
export type TacheRecord = RecordModel & {
user: string;
bien?: string;
contact?: string;
titre: string;
description?: string;
type_tache?: string;
priorite?: number;
statut?: string;
date_echeance?: string;
date_rappel?: string;
is_urgent?: boolean;
};
export type TacheExpanded = TacheRecord & {
expand?: { bien?: BienRecord };
};
export type NoteRecord = RecordModel & {
user: string;
bien: string;
contenu: string;
type_note?: string;
};
export type DocumentRecord = RecordModel & {
user: string;
bien: string;
nom: string;
type_document?: string;
};