Collection brands
Collection brands
Stocke les marques disponibles dans le catalogue.
Une marque peut être globale (sans company) ou propre à un tenant.
Métadonnées
Service propriétaire |
|
Tenant scope |
Partiel (champ |
Soft delete |
Oui (champ |
Index principaux |
|
Schéma
interface IBrandAsset {
asset_type: "logo" | "banner" | "brochure";
url: string;
language?: string;
is_primary: boolean;
}
interface Brand {
_id: ObjectId;
company: ObjectId; // tenant propriétaire
name: string;
normalized_name: string; // généré automatiquement (sans accents, minuscules)
description?: string;
brand_type?: string;
// Références externes
tecdoc_id?: string;
tecdoc_mfr_id?: string;
country?: ObjectId; // ref: Country
website?: string;
is_active: boolean; // défaut : true
assets?: IBrandAsset[];
warranty_document_url?: string;
created_by?: ObjectId;
updated_by?: ObjectId;
created_at: Date;
updated_at: Date;
// Virtuels populés
aliases?: BrandAlias[];
archetypes?: BrandArchetype[];
rules?: BrandRule[];
metrics?: BrandMetric[];
}
Collection brand_rules
Règles de gestion associées à une marque (priorité fournisseur, visibilité, conditions tarifaires).
Schéma
interface BrandRule {
_id: ObjectId;
company: ObjectId;
brand: ObjectId;
archetype?: ObjectId;
supplier?: ObjectId;
type: "config" | "priority" | "supplier_priority";
is_active: boolean;
price_rule?: {
markup?: number;
rounding?: number;
discount?: number;
is_active: boolean;
};
restricted_archetypes?: ObjectId[];
restricted_companies?: ObjectId[];
restricted_suppliers?: ObjectId[];
visibility: "public" | "private";
priority: number;
score: number;
created_by?: ObjectId;
updated_at: Date;
}
Collection brand_metrics
Indicateurs de performance par marque, archétype et période.
Schéma
interface BrandMetric {
_id: ObjectId;
brand: ObjectId;
company: ObjectId;
archetype?: ObjectId;
period: "daily" | "weekly" | "monthly" | "yearly" | "lifetime";
date: Date;
sales_volume: number;
revenue: number;
avg_basket_value: number;
return_rate: number;
avg_delivery_time: number;
quality_score: number;
created_by?: ObjectId;
updated_by?: ObjectId;
created_at: Date;
updated_at: Date;
}