Business-trip attendee mutations throw TypeError instead of a clear error when no row is affected

Open Beginner friendly
#4,917 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
graphql, typescript

Research direction

Read packages/server/src/modules/business-trips/resolvers/business-trip-attendees.resolver.ts and the provider query at providers/business-trips-attendees.provider.ts:48-52 to see the empty-result cases. Find the tests for these three mutations and add coverage for duplicate insertion and missing attendees on update and delete. Done means each empty result produces a clear GraphQLError and all three cases are tested.

Written by the indexing model from the issue text.

Description

In packages/server/src/modules/business-trips/resolvers/business-trip-attendees.resolver.ts, all three mutations end in .then(res => res[0].attendee_business_id):

  • insertBusinessTripAttendee: the SQL is INSERT … ON CONFLICT DO NOTHING RETURNING * (providers/business-trips-attendees.provider.ts:48-52). Adding an attendee who is already on the trip returns no rows, so res[0] is undefined and the client gets TypeError: Cannot read properties of undefined.
  • updateBusinessTripAttendee / deleteBusinessTripAttendee: these crash the same way when the attendee isn't on the trip.

Done when: each mutation checks for an empty result and throws a GraphQLError with a clear message (e.g. "Attendee is already part of this business trip" / "Attendee not found on this business trip"), with tests for each.


Generated by Claude Code

Dominant language
TypeScript
Stars
30
Forks
10
Avg merge
2d 12h
Merged PRs (30d)
276

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Urigo/accounter-fullstack

All issues in Urigo/accounter-fullstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.