• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GrottoCenter / grottocenter-api / 15926998058

27 Jun 2025 01:02PM UTC coverage: 42.789% (-2.4%) from 45.194%
15926998058

push

github

YohannSchatt
feat(api): add marc record services and controller

  - add GET /api/v1/bibliographicMetadata/:id/format/:format
    - :format -> marcFormat-country
    - marcFormat can be 'unimarc' or 'marc21'
    - country can be 'it' or 'default' (if not specify, set to'default')
  - add policies in policies.js
  - add services in services/BibliographicMetadataService.js
    - getRecordFormat(id, format, country) -> returns the MARC record
  - add convertors format and country specification
  - marcRecord class to handle MARC records fields and subfields

729 of 2389 branches covered (30.51%)

Branch coverage included in aggregate %.

28 of 312 new or added lines in 10 files covered. (8.97%)

2487 of 5127 relevant lines covered (48.51%)

4.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

18.18
/api/services/BibliographicMetadataService.js
1
const MarcConvertorService = require('./MarcConvertorService');
1✔
2

3
module.exports = {
1✔
4
  /**
5
   * Récupère un enregistrement par ID et format
6
   * @param {string} id - L'ID du document à récupérer
7
   * @param {string} format - Le format MARC à utiliser,
8
   */
9
  async getRecordByFormat(id, format) {
10
    // Exemple basique (en attente du model):
NEW
11
    const record = {
×
12
      idDocument: id,
13
      oaiIdentifiers: ['oai:grottocenter.org:12345'],
14
      timestamp: '2023-10-01T12:00:00Z',
15
      sets: [],
16
      dcTitle: 'Introduction à la spéléologie',
17
      dcCreators: ['DURAND Jean', 'MARTIN Claire'],
18
      dcContibutor: 'LEFEVRE Louis',
19
      dcPublisher: 'Éditions Géosciences',
20
      dcDate: '1985-06-23',
21
      dcLanguages: ['fre'],
22
      dcDescription:
23
        'Ouvrage introductif sur la spéléologie avec études de cas en France et en Italie.',
24
      dcCoverages: ['FR-ARA', 'FR'],
25
      dcSubjects: ['GEOLOGY AND PEDOLOGY', 'Petrography', 'Tectonics'],
26
      dcFormats: ['application/pdf', 'application/xml'],
27
      dcIdentifiers: [
28
        'isbn:978-2-1234-5678-9',
29
        'issn:1234-5678',
30
        'ean:9782123456789',
31
        'url:https://example.org/documents/12345',
32
      ],
33
      dcRelations: ['oai:grottocenter.org:9876'],
34
      dcSource: 'Grottocenter Archive',
35
      dcRights: 'CC-BY-SA',
36
      dcType: 'book',
37
      status: 'registered',
38
    };
39

NEW
40
    if (!record) {
×
NEW
41
      return null;
×
42
    }
43

44
    // Transform by the format selected
NEW
45
    const [marcFormat, country] = format.split('-');
×
46
    const [marcRecord, countrySelected] =
NEW
47
      await MarcConvertorService.documentToMarc(record, marcFormat, country);
×
48

NEW
49
    const response = {
×
50
      metadata: marcRecord,
51
      format: marcFormat,
52
      country: countrySelected,
53
      timestamp: new Date().toISOString(),
54
    };
55

NEW
56
    return response;
×
57
  },
58
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc