loopbackio / loopbackio/loopback-next

Options param in SequelizeRepository create methods issue

Offen
#10,278 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug sequelize
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

### Describe the bug

options = {
fields: {
privateKey: false,
publicKey: false,
},
};

const result = await this.certificatesRepository.create(
certificate,
this.options,
);
when we pass this.option param in create method getting error options.attributes.map is not a function. But working for findById.

### Logs

```shell
[2023-12-28T08:09:29.630Z] error :: App_Log -> Request POST /tenants/f5408ba4-521f-4f96-fe87-bf0e6092ea16/certificates/ errored out. Error :: {} TypeError: options.attributes.map is not a function
Request POST /tenants/f5408ba4-521f-4f96-fe87-bf0e6092ea16/certificates/ failed with status code 500. TypeError: options.attributes.map is not a function
at new Model (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/sequelize/src/model.js:117:47)
at new certificates (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/sequelize/src/sequelize.js:466:19)
at Function.build (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/sequelize/src/model.js:2255:12)
at Function.create (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/sequelize/src/model.js:2305:23)
at CertificatesRepository.create (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/@loopback/sequelize/src/sequelize/sequelize.repository.base.ts:151:44)
at CertificatesRepository.create (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/@sourceloop/core/src/repositories/sequelize/sequelize-user-modify-crud.repository.base.ts:41:18)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at CommonHelperService.createCertificate (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/services/cbi-service/src/services/common-helper.service.ts:112:20)
at ServiceSequence.handle (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/@sourceloop/core/src/service-sequence.ts:113:22)
at HttpHandler._handleRequest (/Users/akanksha.singh/Desktop/telescope/telescope-health-backend-api/node_modules/@loopback/rest/src/http-handler.ts:115:5)
[2023-12-28T08:09:29.652Z] info :: App_Log -> Request POST /tenants/f5408ba4-521f-4f96-fe87-bf0e6092ea16/certificates/ Completed in 1895ms
```

### Additional information

_No response_

### Reproduction

provided information is enough to understand the problem.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei SequelizeRepository.create in @loopback/sequelize/src/sequelize/sequelize.repository.base.ts und verfolge die übergebenen Optionen durch @sourceloop/core/src/repositories/sequelize/sequelize-user-modify-crud.repository.base.ts. Reproduziere den Fehler aus CommonHelperService.createCertificate und vergleiche create mit findById; abgeschlossen ist die Aufgabe, wenn die übergebenen Optionen keinen options.attributes.map-Fehler mehr verursachen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
node.js, typescript
Bereich
backend, database
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.