All files / src/schemas credits-schema.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69                            1x                                                                                                            
import type { SystemField } from '@/types/systemField'
 
/**
 * Field schema for the credits history list. See src/types/systemField.ts.
 * A row is a CreditsHistoryEntry (utils/creditsHistory.ts), not a raw ledger
 * row: the rows of one write or one usage day are grouped, so the columns
 * say what happened (category, label and its context) rather than which
 * pool was charged. Every fieldId is derived in CreditsPage.vue.
 *
 * Category labels are inline (rather than looked up via the `t()`
 * composable + src/locales/*.ts, like the rest of the credits UI) because
 * this generic list system speaks `getTranslation()` + inline objects — same
 * reasoning as API_KEY_SCHEMA's status badges.
 */
export const CREDITS_TRANSACTION_SCHEMA: SystemField[] = [
  {
    fieldId: 'category',
    name: { en: 'Category', fr: 'Catégorie', es: 'Categoría' },
    type: 'badge',
    width: 2,
    badgeOptions: [
      {
        value: 'usage',
        label: { en: 'Platform usage', fr: 'Usage de la plateforme', es: 'Uso de la plataforma' },
        color: 'info'
      },
      {
        value: 'data',
        label: { en: 'Data', fr: 'Données', es: 'Datos' },
        color: 'primary'
      },
      {
        value: 'files',
        label: { en: 'Files', fr: 'Fichiers', es: 'Archivos' },
        color: 'primary'
      },
      {
        value: 'automation',
        label: { en: 'Automation', fr: 'Automatisation', es: 'Automatización' },
        color: 'secondary'
      },
      {
        value: 'adjustment',
        label: { en: 'Manual adjustment', fr: 'Ajustement manuel', es: 'Ajuste manual' },
        color: 'warning'
      }
    ]
  },
  {
    fieldId: 'label',
    name: { en: 'Description', fr: 'Description', es: 'Descripción' },
    type: 'text',
    width: 5,
    secondaryFieldId: 'context'
  },
  {
    fieldId: 'dateDisplay',
    name: { en: 'Date', fr: 'Date', es: 'Fecha' },
    type: 'text',
    width: 2
  },
  {
    fieldId: 'amount',
    name: { en: 'Amount', fr: 'Montant', es: 'Importe' },
    type: 'amount',
    width: 1
  }
]