Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bug in cancelTrip method from User datasource

Aperta
#116 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@stemmlerjs ci sta già lavorando.

Dal 18/2/2020.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

https://github.com/apollographql/fullstack-tutorial/blob/66431a74abbdfd432157ec36a2fb7cd9f0b80be4/start/server/src/datasources/user.js#L60

Due to this line cancelTrip throws an error.

{
  "errors": [
    {
      "message": "Cannot read property 'flight_number' of undefined",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "cancelTrip"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "TypeError: Cannot read property 'flight_number' of undefined",
      // ....

Following change will fix the error.

async cancelTrip({ launchId }) {
    const userId = this.context.user.id;
    const numberOfDeletedTrips = await this.store.trips.destroy({ where: { userId, launchId } });
    return numberOfDeletedTrips !== 0;
  }

As per the doc of destroy it returns number of deleted resources wrapped in Promise. So it should be resolved to get the count to decide if resources are deleted or not.

Lingua principale
TypeScript
Stelle
1.2k
Fork
808
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apollographql/fullstack-tutorial

Tutte le issue di apollographql/fullstack-tutorial

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.