From 4b58e72607a1f7f3533cad35bb14b3ccf8d712d6 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Fri, 6 Mar 2026 15:27:49 +0100 Subject: [PATCH] Use API error handler depending on error code --- .aiassistant/rules/guidelines.md | 85 ++++++++++++------- .github/copilot-instructions.md | 6 +- .windsurf/rules/compass.md | 55 ++++++++---- backend/api/src/auth-google.ts | 2 +- backend/api/src/ban-user.ts | 4 +- backend/api/src/block-user.ts | 4 +- backend/api/src/cancel-event.ts | 10 +-- backend/api/src/cancel-rsvp.ts | 6 +- backend/api/src/contact.ts | 4 +- backend/api/src/create-comment.ts | 15 ++-- .../api/src/create-compatibility-question.ts | 6 +- backend/api/src/create-event.ts | 12 +-- .../create-private-user-message-channel.ts | 15 ++-- .../api/src/create-private-user-message.ts | 8 +- backend/api/src/create-profile.ts | 8 +- backend/api/src/create-user.ts | 6 +- backend/api/src/create-vote.ts | 6 +- .../api/src/delete-compatibility-answer.ts | 5 +- backend/api/src/delete-me.ts | 6 +- backend/api/src/delete-message.ts | 4 +- backend/api/src/edit-message.ts | 4 +- backend/api/src/get-current-private-user.ts | 6 +- backend/api/src/get-options.ts | 6 +- backend/api/src/get-private-messages.ts | 7 +- backend/api/src/get-supabase-token.ts | 6 +- backend/api/src/get-user.ts | 6 +- backend/api/src/helpers/endpoint.ts | 28 +++--- backend/api/src/helpers/private-messages.ts | 4 +- backend/api/src/hide-comment.ts | 6 +- backend/api/src/hide-profile.ts | 4 +- .../src/leave-private-user-message-channel.ts | 6 +- backend/api/src/like-profile.ts | 8 +- backend/api/src/react-to-message.ts | 4 +- backend/api/src/remove-pinned-photo.ts | 6 +- backend/api/src/report.ts | 4 +- backend/api/src/rsvp-event.ts | 12 +-- backend/api/src/save-subscription-mobile.ts | 6 +- backend/api/src/save-subscription.ts | 6 +- backend/api/src/ship-profiles.ts | 9 +- backend/api/src/star-profile.ts | 6 +- backend/api/src/update-event.ts | 10 +-- backend/api/src/update-me.ts | 10 +-- backend/api/src/update-options.ts | 10 +-- .../update-private-user-message-channel.ts | 6 +- backend/api/src/update-profile.ts | 6 +- backend/api/src/update-user-locale.ts | 4 +- backend/api/src/vote.ts | 8 +- backend/shared/src/helpers/auth.ts | 4 +- docs/CONNECTION_POOL_FIXES.md | 5 +- docs/DATABASE_CONNECTION_POOLING.md | 8 +- docs/PERFORMANCE_OPTIMIZATION.md | 68 ++++++++------- web/lib/api.ts | 8 +- 52 files changed, 309 insertions(+), 249 deletions(-) diff --git a/.aiassistant/rules/guidelines.md b/.aiassistant/rules/guidelines.md index 6527f29b..c80037fb 100644 --- a/.aiassistant/rules/guidelines.md +++ b/.aiassistant/rules/guidelines.md @@ -67,7 +67,8 @@ export function ProfileCard({user, profile}: ProfileCardProps) { We prefer many smaller components that each represent one logical unit, rather than one large component. -Export the main component at the top of the file. Name the component the same as the file (e.g., `profile-card.tsx` → `ProfileCard`). +Export the main component at the top of the file. Name the component the same as the file (e.g., `profile-card.tsx` → +`ProfileCard`). ### API Calls @@ -91,18 +92,21 @@ export async function getStaticProps() { import {useAPIGetter} from 'web/hooks/use-api-getter' function ProfileList() { - const {data, refresh} = useAPIGetter('get-profiles', {}) + const {data, refresh} = useAPIGetter('get-profiles', {}) - if (!data) return + if (!data) return - return ( -
- {data.profiles.map((profile) => ( - - ))} - -
- ) + return ( +
+ { + data.profiles.map((profile) => ( + +)) +} +