Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

画像、タイトル、本文、花束作成可否をまとめて取得できる API を作成 #240

Closed
mt-osho-san opened this issue Nov 18, 2024 · 0 comments · Fixed by #261
Assignees

Comments

@mt-osho-san
Copy link
Collaborator

mt-osho-san commented Nov 18, 2024

取得するもの

  • 花瓶に入っている花の画像 : flower_image

  • タイトル : title

  • 本文 : diary

  • 花束作成可否 : create_diary_flag

  • 花を作成できる条件

    • 5 日以上日記を記入したこと (flower_bucket/<user_id>/yyyy-ww に 5つ以上画像が存在すること)
    • その週にまだ花を作成していないこと(bouquet-table のその週の記録があること=> 花束を作成すると <user_id>, が DB に登録される)
@mt-osho-san mt-osho-san changed the title 画像、タイトル、本文をまとめて取得できる API を作成 画像、タイトル、本文、花束作成可否をまとめて取得できる API を作成 Nov 18, 2024
@mt-osho-san mt-osho-san self-assigned this Dec 28, 2024
mt-osho-san added a commit that referenced this issue Jan 1, 2025
 (#261)

### **User description**
## 概要

花の画像、タイトル、本文、花束作成可否を返す API を作成

## 変更点

- CDK Lambda, API GW 追加
- Lambda コード追加

## 影響範囲

- 既存の API は変更せずに新規で作成したため、影響なし。

## テスト

- pytest にてテストを実行可能

## 関連 Issue

- 関連 Issue: #240


___

### **PR Type**
Enhancement


___

### **Description**
- 画像、タイトル、本文を取得するAPIを実装

- 花束作成可否のロジックを追加

- 新しいDynamoDBテーブルを作成

- ユニットテストを追加


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>

<summary><strong>backend-stack.ts</strong><dd><code>BackendStackにbouquetTableを追加</code>&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/backend/lib/backend-stack.ts

- bouquetTableをDiaryから取得
- 新しいプロパティを追加


</details>


  </td>
<td><a
href="https://github.com/Kota8102/diary-app/pull/261/files#diff-06e1c6bd40e02f92caf5b369458b80d4e45af5caa36d7fecd56e41898759a482">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>

<summary><strong>bouquet.ts</strong><dd><code>Bouquetクラスの修正</code>&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/backend/lib/constructs/bouquet.ts

- bouquetTableのプロパティを使用
- Lambda関数の環境変数を修正


</details>


  </td>
<td><a
href="https://github.com/Kota8102/diary-app/pull/261/files#diff-a6fb5c43de5e3b52699104380fdaac619d49f7d3a33f8884a39d0600f98d0cd9">+4/-18</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td>
    <details>

<summary><strong>diary.ts</strong><dd><code>DiaryクラスにbouquetTableを追加</code>&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

src/backend/lib/constructs/diary.ts

- bouquetTableを作成
- getDiaryDataFunctionを追加
- API Gatewayの設定を追加


</details>


  </td>
<td><a
href="https://github.com/Kota8102/diary-app/pull/261/files#diff-7116f23fe864dd19db3c0bdb379edee7244f27426cf611b874cd52ee511339b6">+41/-1</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td>
    <details>

<summary><strong>get_diary_data.py</strong><dd><code>get_diary_data関数の実装</code>&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/backend/lambda/get_diary_data/get_diary_data.py

- 画像、タイトル、本文を取得するロジックを追加
- ブーケ作成可否のチェックを実装


</details>


  </td>
<td><a
href="https://github.com/Kota8102/diary-app/pull/261/files#diff-9f365c088d2b3c27ba98ee698e7c46940d00da6844dc8a2794f04d0c979dd6a2">+278/-0</a>&nbsp;
</td>

</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>

<summary><strong>test_get_diary_data.py</strong><dd><code>get_diary_dataのテスト追加</code>&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/backend/test/pytest/test_get_diary_data.py

- get_diary_data関数のテストを追加
- 各種ユニットテストを実装


</details>


  </td>
<td><a
href="https://github.com/Kota8102/diary-app/pull/261/files#diff-23ba5a2ece52c666c023c7ae03d320f39d767e2f6123b659880e752e507b6c38">+128/-0</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant