Skip to content

feat: implement Presentation layer for Favorite Heritage API / お気に入りAPIのPresentation層実装 #554

Closed

Description

@zigzagdev

Parent Issue / 親Issue

#550

Motivation / 目的

Implement the Controller and routes for the Favorite Heritage API as part of #550.

お気に入りAPIのPresentation層(#550)として、Controllerとエンドポイントを実装します。

What to do / 実施内容

  • FavoriteController
    • createFavorite(int $heritageId): AddFavoriteUseCase を呼び出す
      • 201 on success
      • 409 when already favorited
      • 404 when heritage not found
    • deleteFavorite(int $heritageId): RemoveFavoriteUseCase を呼び出す
      • 200 on success
      • 404 when not favorited
    • getMyFavorites(): ListMyFavoritesUseCase を呼び出す
      • 200 with the list (empty array when none)

Routes

  • POST /api/v1/users/me/favorites/{heritageId}
  • DELETE /api/v1/users/me/favorites/{heritageId}
  • GET /api/v1/users/me/favorites

全て auth:sanctum ミドルウェア必須、ユーザーIDは認証済みユーザーから取得する。

Tests / テスト

  • test_createFavorite_returns_201_on_success
  • test_createFavorite_returns_409_when_already_favorited
  • test_deleteFavorite_returns_200_on_success
  • test_deleteFavorite_returns_404_when_not_favorited
  • test_getMyFavorites_returns_200_with_list
  • test_getMyFavorites_returns_200_with_empty_list_when_none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions