Skip to content

feat(api/v2): ✨ Implement socials routes - #135

Merged
Nudelsuppe42 merged 1 commit into
api/v2from
api-v2/socials
Aug 28, 2026
Merged

Nudelsuppe42 merged 1 commit into
api/v2from
api-v2/socials

Conversation

@kyanvde

@kyanvde kyanvde commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Closes #60.

Adds the /socials section to api-v2, covering every route the issue lists.

Route Auth Notes
GET /socials authenticated team Returns the token holder's own links
GET /:teamId/socials public ?slug=true resolves the team by slug
POST /socials team
PUT /socials team Bulk upsert
PUT /socials/:id team
DELETE /socials/:id team

Every route is registered both bare and behind a :teamId prefix, and the prefix is only ever allowed to name the team the token already belongs to (@TeamScope).

Notes

  • The section mirrors applications/questions, which has the same shape — a team-owned resource with a bulk upsert — so the service, DTOs and tests follow it deliberately closely.
  • Read auth matches v1: GET /buildteams/:id/socials was public there, and the links are rendered on the public team page, so the prefixed form is public (@OptionalAuth) while the bare form falls back to the authenticated team and answers 401 without a token.
  • The bulk upsert leaves links that are not in the payload alone, rather than treating the payload as the team's full set. Deleting is what DELETE /socials/:id is for, and a silent delete-on-omit is easy to trigger by accident.
  • An ID that belongs to another team answers 404, not 403 — a 403 would confirm the ID exists. Same reasoning as the questions section.
  • url is validated as a non-empty string rather than with @IsUrl(). Existing rows written by v1 hold arbitrary strings (mailto: addresses, app-specific schemes), so a stricter rule would reject data the API already serves.
  • Bulk payloads are capped at 100 entries, since the whole batch runs in one transaction.
  • sortBy allows id, name, icon, url; filtering allows name, icon, url.

Testing

yarn ws api-v2 test — 27 suites, 155 tests, all passing. 38 of those are new:

  • socials.service.spec.ts — pagination/sorting/filtering, slug resolution, team scoping on update and delete, and the upsert paths (update existing, create new, create with a caller-supplied ID, cross-team refusal, bulk limit).
  • socials.controller.spec.ts — team resolution, the slug flag not leaking into the filter, and the 401 on the unprefixed listing.
  • socials.routes.spec.ts — end to end through the real router, including that PUT /socials reaches the bulk upsert while PUT /socials/:id reaches the single update.

yarn ws api-v2 build passes. lint reports the 6 pre-existing unbound-method errors documented in CLAUDE.md and nothing new.

🤖 Generated with Claude Code

Adds the /socials section: a public per-team listing, plus create,
bulk upsert, update and delete scoped to the authenticated team.

Every route is registered bare and behind a :teamId prefix, matching
the application questions section, which socials mirror closely. The
bulk PUT leaves links that are not part of the payload untouched and
answers 404 rather than 403 for an ID owned by another team.

Closes #60

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this from Backlog to In Progress in @BuildTheEarth/web Tracker Aug 28, 2026
@Nudelsuppe42
Nudelsuppe42 merged commit 81ce51a into api/v2 Aug 28, 2026
1 check passed
@Nudelsuppe42
Nudelsuppe42 deleted the api-v2/socials branch August 28, 2026 19:28
@github-project-automation github-project-automation Bot moved this from In Progress to Done in @BuildTheEarth/web Tracker Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants