All files / src/schemas apiKey-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                2x                                                                                      
import type { SystemField } from '@/types/systemField'
 
/**
 * Field schema for the API Key list. See src/types/systemField.ts.
 * fieldId values are read directly off `ApiKey` (stores/apiKeys.ts), except
 * `idShort` and `roleNames` which are derived — see
 * utils/systemListViewModels.ts:toApiKeyViewModel.
 */
export const API_KEY_SCHEMA: SystemField[] = [
  {
    fieldId: 'name',
    name: { en: 'Name', fr: 'Nom' },
    type: 'text',
    width: 3,
    secondaryFieldId: 'idShort'
  },
  {
    fieldId: 'status',
    name: { en: 'Status', fr: 'Statut' },
    type: 'badge',
    width: 1,
    badgeOptions: [
      { value: 'active', label: { en: 'Active', fr: 'Active' }, color: 'success' },
      { value: 'expired', label: { en: 'Expired', fr: 'Expirée' }, color: 'warning' },
      { value: 'revoked', label: { en: 'Revoked', fr: 'Révoquée' }, color: 'danger' }
    ],
    badgeDefaultColor: 'secondary'
  },
  {
    fieldId: 'roleNames',
    name: { en: 'Roles', fr: 'Rôles' },
    type: 'chips',
    width: 4,
    chipsMaxVisible: 2,
    chipsOverflowLabel: { en: '+{n}', fr: '+{n}' },
    chipsDefaultColor: 'secondary'
  },
  {
    fieldId: 'createdAt',
    name: { en: 'Created', fr: 'Créée' },
    type: 'date',
    width: 1
  },
  {
    fieldId: 'expiresAt',
    name: { en: 'Expires', fr: 'Expire' },
    type: 'date',
    width: 1,
    emptyLabel: { en: 'Never', fr: 'Jamais' }
  }
]