Thomas Fransolet af6b5b76ef Self-service onboarding (Stripe + Resend) + Postgres v3 schema (pgvector, media, visitor questions)
75 fichiers, ~1 mois de travail depuis f222861 (17/07). Contenu :

Onboarding self-service — jamais exécuté de bout en bout
  OnboardingController, StripeWebhookController, StripeService, ResendEmailService
  + IEmailService (10 templates), EmailTemplates/, TrialLifecycleService (Hangfire),
  PasswordTokenHelper, SlugHelper, 5 DTOs. Essai 14 j, Stripe customer/Checkout/Tax,
  mot de passe oublié + invitation user, plafond IA d'essai.

Schéma Postgres v3 — passe pendant que la base est vide
  ContentEmbedding + index HNSW (vector_cosine_ops), IEmbeddingService +
  GoogleEmbeddingService (gemini-embedding-001, 768 dims), Deployment/Dockerfile.postgres
  (postgis 3.4.3 + pgvector 0.8.6, épinglé par digest — un tag mobile rejouerait le
  warning de collation glibc). Colonnes Resource : StoragePath, FileName,
  IncludeInAiKnowledge, AiIndexStatus + nouveaux ResourceType ajoutés EN FIN d'enum.

Guide IA
  Champs Guide* sur Instance + InstanceDTO, AssistantService lit la configuration client
  dans les 4 blocs de prompt (ton codé en dur retiré, règle hors-sujet ajoutée aux deux
  variantes qui n'en avaient pas), IHttpClientFactory à la place des new HttpClient().
  Table VisitorQuestion + ConversationId sur AiChatRequest.

Stats
  Rétention unifiée à 13 mois (instances ET plans), VisitEventPurgeService.

Nettoyage
  IsStepLocked / IsHiddenInitially / FactContent supprimés de GuidedStep — IsStepLocked
  rendait une étape définitivement infranchissable même après réussite.
  SectionMap allégé (-57 lignes).

Tests
  SectionParcoursControllerTests, FakeConfiguration, FakeEmailService.
  ContentEmbedding a cassé 116 tests sur 124 (EF InMemory ne connaît pas Vector) :
  l'entité est exclue quand le provider n'est pas Npgsql. Conséquence assumée —
  le vector store n'est couvert par aucun test. dotnet test 124/124.

10 migrations EF. Base locale à jour, dotnet build 0 erreur.
Rien n'est en prod : la bascule Mongo → Postgres est décrite dans DOCS/STATUS.md §1quinquies.

⚠️ appsettings.json contient les clés Stripe (test) et Resend (prod) en clair — à rotationner.
2026-08-09 22:11:48 +02:00

151 lines
4.9 KiB
C#

using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Helpers;
using NetTopologySuite.Geometries;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace ManagerService.Data.SubSection
{
/// <summary>
/// Section map
/// </summary>
public class SectionMap : Section
{
public int MapZoom { get; set; } // Default = 18
public bool IsListViewEnabled { get; set; } = false;
public MapTypeApp? MapMapType { get; set; } // Default = Hybrid for Google
public MapTypeMapBox? MapTypeMapbox { get; set; } // Default = standard for MapBox
public MapProvider? MapMapProvider { get; set; } // Default = Google
public List<GeoPoint> MapPoints { get; set; }
public string MapResourceId { get; set; }
public Resource MapResource { get; set; } // Icon
[Required]
[Column(TypeName = "jsonb")]
public List<CategorieDTO> MapCategories { get; set; }
public string MapCenterLatitude { get; set; } // Center on
public string MapCenterLongitude { get; set; } // Center on
public MapDTO ToDTO()
{
return new MapDTO()
{
id = Id,
label = Label,
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,
imageSource = ImageSource,
configurationId = ConfigurationId,
isSubSection = IsSubSection,
parentId = ParentId,
dateCreation = DateCreation,
instanceId = InstanceId,
isBeacon = IsBeacon,
beaconId = BeaconId,
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
zoom = MapZoom,
mapType = MapMapType,
mapTypeMapbox = MapTypeMapbox,
mapProvider = MapMapProvider,
iconResourceId = MapResourceId,
categories = MapCategories,
centerLatitude = MapCenterLatitude,
centerLongitude = MapCenterLongitude
};
}
}
public class GeoPoint
{
[Required]
public int? Id { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Title { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Description { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<ContentDTO> Contents { get; set; }
public int? CategorieId { get; set; }
public Geometry Geometry { get; set; }
public string PolyColor { get; set; } // color of the polyline or polygon
public string ImageResourceId { get; set; }
public string ImageUrl { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Schedules { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Prices { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Phone { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Email { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Site { get; set; }
public string? SectionMapId { get; set; }
[ForeignKey(nameof(SectionMapId))]
public SectionMap? SectionMap { get; set; }
public string? SectionEventId { get; set; }
[ForeignKey(nameof(SectionEventId))]
public SectionEvent? SectionEvent { get; set; }
public GeoPointDTO ToDTO()
{
return new GeoPointDTO
{
id = Id,
title = Title,
description = Description,
contents = Contents,
categorieId = CategorieId,
geometry = Geometry != null ? Geometry.ToDto() : null,
polyColor = PolyColor,
imageResourceId = ImageResourceId,
imageUrl = ImageUrl,
schedules = Schedules,
prices = Prices,
phone = Phone,
email = Email,
site = Site,
sectionMapId = SectionMapId,
sectionEventId = SectionEventId
};
}
}
// SectionMap "normal" comme avant => Via geopoints. Si il y a des guidedPath lié à la sectionMap alors il y a un parcours lié à la sectionMap, tu peux aussi avoir des geopoints classique mis là + des parcours. et aussi lier un guidedstep à un geopoint (pour le trigger et aussi pour "afficher plus")
}