rubis/apps/api/database/schema.ts
ordinarthur e5530930b3
Some checks failed
Build & Deploy API / build-and-deploy (push) Failing after 17s
Build & Deploy Web / build-and-deploy (push) Successful in 1m15s
Build & Deploy Landing / build-and-deploy (push) Failing after 3m43s
feat: refactor frontend en stack React unifiée (Astro + packages/ui)
Trois surfaces partagent désormais le même design system, Tailwind v4
et React 19 — au lieu d'avoir landing en HTML vanilla, app en React, et
blog en Adonis SSR :

* packages/ui — design system partagé (tokens Tailwind v4 + composants
  TSX) extrait depuis apps/web : Brand, Gem, Button, Card, Chip, Eyebrow,
  EmptyState. apps/web migre 41 imports vers @rubis/ui.

* apps/landing — nouvelle app Astro 6 SSR (rubis.pro), remplace l'ancienne
  landing nginx vanilla. Embarque :
  - Landing complète portée en sections React (Hero, Stats, Promise,
    HowItWorks, Gamification, Legal, Pricing, FAQ, FinalCTA, Footnotes)
  - Pages légales (mentions, confidentialité, CGV) via LegalLayout.astro
  - Blog SSR (/blog, /blog/:slug) qui consomme /api/v1/posts
  - sitemap.xml, blog/rss.xml, robots.txt en endpoints Astro
  - SEO complet (canonical, hreflang, OG, Twitter Card, JSON-LD
    Article/BreadcrumbList/Blog/SoftwareApplication)

* apps/api — BlogController réduit à 2 endpoints JSON (GET /api/v1/posts
  + GET /api/v1/posts/:slug). Suppression des templates SSR Adonis
  (apps/api/app/blog/), de l'alias #blog/*, des deps react-dom et
  @types/react-dom. PostTransformer + PostSummaryTransformer ajoutés.
  Le service blog_renderer + le seeder + les 3 articles fondateurs
  restent intacts (réutilisés par futurs admin + cron IA).

* Infra :
  - Dockerfile.landing (multi-stage Node 22 + tini, Astro standalone)
  - k3s/app/landing.yml (Deployment + Service rubis-landing:4321 +
    ConfigMap avec API_URL=http://rubis-api.rubis.svc.cluster.local:3333)
  - .gitea/workflows/deploy.yml mis à jour pour build rubis-landing
  - .gitea/workflows/deploy-web.yml + Dockerfile.web : prennent en
    compte packages/ui/ comme dépendance
  - Suppression du Dockerfile nginx legacy + k3s/{deployment,service}.yml
  - Suppression de landing/ (assets favicons migrés vers
    apps/landing/public/)

* Docs : architecture.md (vue d'ensemble + §4bis apps/landing complet,
  §3 endpoints JSON blog, layout monorepo), CLAUDE.md (stack technique,
  documents associés, déploiement).

Note infra : l'ancien Deployment "rubis" (nginx) et son Service ne sont
PAS supprimés par la CI — à nettoyer manuellement après validation que
Traefik a été repointé sur rubis-landing:4321 dans le repo proxmox.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 15:09:13 +02:00

430 lines
14 KiB
TypeScript

/**
* This file is automatically generated
* DO NOT EDIT manually
* Run "node ace migration:run" command to re-generate this file
*/
import { BaseModel, column } from '@adonisjs/lucid/orm'
import { DateTime } from 'luxon'
export class ActivityEventSchema extends BaseModel {
static $columns = ['at', 'createdAt', 'id', 'kind', 'label', 'meta', 'organizationId', 'updatedAt'] as const
$columns = ActivityEventSchema.$columns
@column.dateTime()
declare at: DateTime
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column({ isPrimary: true })
declare id: string
@column()
declare kind: 'relance_sent' | 'invoice_paid' | 'invoice_imported' | 'warning_drafted'
@column()
declare label: string
@column()
declare meta: { invoiceId?: string; clientId?: string; planStepOrder?: number; [k: string]: unknown }
@column()
declare organizationId: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class AuthAccessTokenSchema extends BaseModel {
static $columns = ['abilities', 'createdAt', 'expiresAt', 'hash', 'id', 'lastUsedAt', 'name', 'tokenableId', 'type', 'updatedAt'] as const
$columns = AuthAccessTokenSchema.$columns
@column()
declare abilities: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column.dateTime()
declare expiresAt: DateTime | null
@column()
declare hash: string
@column({ isPrimary: true })
declare id: string
@column.dateTime()
declare lastUsedAt: DateTime | null
@column()
declare name: string | null
@column()
declare tokenableId: string
@column()
declare type: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class CheckinTaskSchema extends BaseModel {
static $columns = ['answer', 'answeredAt', 'createdAt', 'id', 'invoiceId', 'organizationId', 'sendAt', 'sentAt', 'status', 'tokenHash', 'updatedAt'] as const
$columns = CheckinTaskSchema.$columns
@column()
declare answer: 'paid' | 'still_pending' | null | null
@column.dateTime()
declare answeredAt: DateTime | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column({ isPrimary: true })
declare id: string
@column()
declare invoiceId: string
@column()
declare organizationId: string
@column.dateTime()
declare sendAt: DateTime
@column.dateTime()
declare sentAt: DateTime | null
@column()
declare status: 'scheduled' | 'sent' | 'answered' | 'expired'
@column()
declare tokenHash: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class ClientSchema extends BaseModel {
static $columns = ['address', 'contactFirstName', 'contactLastName', 'createdAt', 'email', 'id', 'name', 'notes', 'organizationId', 'phone', 'siret', 'updatedAt'] as const
$columns = ClientSchema.$columns
@column()
declare address: string | null
@column()
declare contactFirstName: string | null
@column()
declare contactLastName: string | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare email: string
@column({ isPrimary: true })
declare id: string
@column()
declare name: string
@column()
declare notes: string | null
@column()
declare organizationId: string
@column()
declare phone: string | null
@column()
declare siret: string | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class DemoCapturedEmailSchema extends BaseModel {
static $columns = ['body', 'createdAt', 'fromEmail', 'fromName', 'id', 'kind', 'meta', 'organizationId', 'replyTo', 'sentAt', 'subject', 'toEmail', 'toName', 'updatedAt'] as const
$columns = DemoCapturedEmailSchema.$columns
@column()
declare body: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare fromEmail: string
@column()
declare fromName: string | null
@column({ isPrimary: true })
declare id: string
@column()
declare kind: string
@column()
declare meta: any
@column()
declare organizationId: string
@column()
declare replyTo: string | null
@column.dateTime()
declare sentAt: DateTime
@column()
declare subject: string
@column()
declare toEmail: string
@column()
declare toName: string | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class ImportBatchSchema extends BaseModel {
static $columns = ['createdAt', 'id', 'organizationId', 'updatedAt'] as const
$columns = ImportBatchSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column({ isPrimary: true })
declare id: string
@column()
declare organizationId: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class ImportDraftSchema extends BaseModel {
static $columns = ['batchId', 'confidence', 'createdAt', 'edited', 'extracted', 'filename', 'id', 'invoiceId', 'pdfStorageKey', 'status', 'updatedAt'] as const
$columns = ImportDraftSchema.$columns
@column()
declare batchId: string
@column()
declare confidence: Partial<{ clientId: number; clientName: number; clientEmail: number; numero: number; amountTtcCents: number; issueDate: number; dueDate: number; planId: number }>
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare edited: { clientId: string | null; clientName: string; clientEmail: string | null; numero: string; amountTtcCents: number; issueDate: string; dueDate: string; planId: string | null }
@column()
declare extracted: { clientId: string | null; clientName: string; clientEmail: string | null; numero: string; amountTtcCents: number; issueDate: string; dueDate: string; planId: string | null }
@column()
declare filename: string
@column({ isPrimary: true })
declare id: string
@column()
declare invoiceId: string | null
@column()
declare pdfStorageKey: string | null
@column()
declare status: 'pending' | 'validated' | 'skipped'
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class InvoiceSchema extends BaseModel {
static $columns = ['amountTtcCents', 'clientId', 'createdAt', 'dueDate', 'id', 'issueDate', 'notes', 'numero', 'organizationId', 'paidAt', 'pdfStorageKey', 'planId', 'rubisEarned', 'status', 'updatedAt'] as const
$columns = InvoiceSchema.$columns
@column()
declare amountTtcCents: number
@column()
declare clientId: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime()
declare dueDate: DateTime
@column({ isPrimary: true })
declare id: string
@column.dateTime()
declare issueDate: DateTime
@column()
declare notes: string | null
@column()
declare numero: string
@column()
declare organizationId: string
@column.dateTime()
declare paidAt: DateTime | null
@column()
declare pdfStorageKey: string | null
@column()
declare planId: string | null
@column()
declare rubisEarned: number
@column()
declare status: 'pending' | 'awaiting_user_confirmation' | 'in_relance' | 'paid' | 'litigation' | 'cancelled'
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class OrganizationSchema extends BaseModel {
static $columns = ['billingCycle', 'cancelAtPeriodEnd', 'createdAt', 'currentPeriodEnd', 'demoMode', 'demoSpeedFactor', 'gracePeriodEndsAt', 'id', 'monthlyVolumeBucket', 'name', 'onboardingCompletedAt', 'plan', 'rubisCount', 'siret', 'stripeCustomerId', 'stripeSubscriptionId', 'subscriptionStatus', 'updatedAt', 'virtualNow'] as const
$columns = OrganizationSchema.$columns
@column()
declare billingCycle: string | null
@column()
declare cancelAtPeriodEnd: boolean
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime()
declare currentPeriodEnd: DateTime | null
@column()
declare demoMode: boolean
@column()
declare demoSpeedFactor: number
@column.dateTime()
declare gracePeriodEndsAt: DateTime | null
@column({ isPrimary: true })
declare id: string
@column()
declare monthlyVolumeBucket: string | null
@column()
declare name: string
@column.dateTime()
declare onboardingCompletedAt: DateTime | null
@column()
declare plan: string
@column()
declare rubisCount: number
@column()
declare siret: string | null
@column()
declare stripeCustomerId: string | null
@column()
declare stripeSubscriptionId: string | null
@column()
declare subscriptionStatus: string | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
@column.dateTime()
declare virtualNow: DateTime | null
}
export class PlanStepSchema extends BaseModel {
static $columns = ['body', 'createdAt', 'id', 'offsetDays', 'order', 'planId', 'requiresManualValidation', 'subject', 'tone', 'updatedAt'] as const
$columns = PlanStepSchema.$columns
@column()
declare body: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column({ isPrimary: true })
declare id: string
@column()
declare offsetDays: number
@column()
declare order: number
@column()
declare planId: string
@column()
declare requiresManualValidation: boolean
@column()
declare subject: string
@column()
declare tone: 'amical' | 'courtois' | 'ferme' | 'mise_en_demeure'
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class PlanSchema extends BaseModel {
static $columns = ['createdAt', 'description', 'id', 'isDefault', 'name', 'organizationId', 'slug', 'updatedAt'] as const
$columns = PlanSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare description: string
@column({ isPrimary: true })
declare id: string
@column()
declare isDefault: boolean
@column()
declare name: string
@column()
declare organizationId: string
@column()
declare slug: string | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class PostSchema extends BaseModel {
static $columns = ['aiGenerated', 'aiTopicId', 'authorName', 'canonicalUrl', 'contentHtml', 'contentMd', 'createdAt', 'excerpt', 'heroImageAlt', 'heroImageUrl', 'id', 'noindex', 'ogImageUrl', 'publishedAt', 'readingTimeMinutes', 'slug', 'status', 'tags', 'title', 'updatedAt', 'wordCount'] as const
$columns = PostSchema.$columns
@column()
declare aiGenerated: boolean
@column()
declare aiTopicId: string | null
@column()
declare authorName: string
@column()
declare canonicalUrl: string | null
@column()
declare contentHtml: string
@column()
declare contentMd: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare excerpt: string
@column()
declare heroImageAlt: string | null
@column()
declare heroImageUrl: string | null
@column({ isPrimary: true })
declare id: string
@column()
declare noindex: boolean
@column()
declare ogImageUrl: string | null
@column.dateTime()
declare publishedAt: DateTime | null
@column()
declare readingTimeMinutes: number
@column()
declare slug: string
@column()
declare status: any
@column()
declare tags: any
@column()
declare title: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
@column()
declare wordCount: number
}
export class RefreshTokenSchema extends BaseModel {
static $columns = ['createdAt', 'expiresAt', 'hashedToken', 'id', 'ipAddress', 'lastUsedAt', 'revokedAt', 'updatedAt', 'userAgent', 'userId'] as const
$columns = RefreshTokenSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime()
declare expiresAt: DateTime
@column()
declare hashedToken: string
@column({ isPrimary: true })
declare id: string
@column()
declare ipAddress: string | null
@column.dateTime()
declare lastUsedAt: DateTime | null
@column.dateTime()
declare revokedAt: DateTime | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
@column()
declare userAgent: string | null
@column()
declare userId: string
}
export class RelanceTaskSchema extends BaseModel {
static $columns = ['createdAt', 'id', 'invoiceId', 'organizationId', 'planStepId', 'queueJobId', 'sendAt', 'sentAt', 'status', 'updatedAt'] as const
$columns = RelanceTaskSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column({ isPrimary: true })
declare id: string
@column()
declare invoiceId: string
@column()
declare organizationId: string
@column()
declare planStepId: string
@column()
declare queueJobId: string | null
@column.dateTime()
declare sendAt: DateTime
@column.dateTime()
declare sentAt: DateTime | null
@column()
declare status: 'scheduled' | 'sent' | 'cancelled' | 'failed'
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class UserSchema extends BaseModel {
static $columns = ['createdAt', 'email', 'fullName', 'googleId', 'id', 'microsoftId', 'organizationId', 'password', 'signature', 'updatedAt'] as const
$columns = UserSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare email: string
@column()
declare fullName: string | null
@column()
declare googleId: string | null
@column({ isPrimary: true })
declare id: string
@column()
declare microsoftId: string | null
@column()
declare organizationId: string | null
@column({ serializeAs: null })
declare password: string | null
@column()
declare signature: string | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}