各棟ごとの合計募金額を取得するAPIの作成#986
Open
hikahana wants to merge 22 commits intofeat/hikahana/get-rooms-by-buildingfrom
Open
各棟ごとの合計募金額を取得するAPIの作成#986hikahana wants to merge 22 commits intofeat/hikahana/get-rooms-by-buildingfrom
hikahana wants to merge 22 commits intofeat/hikahana/get-rooms-by-buildingfrom
Conversation
…nsに紐づくデータを取得する機能を実装
Kubosaka
reviewed
May 2, 2025
Collaborator
Kubosaka
left a comment
There was a problem hiding this comment.
フロントで収支管理がfund_informationsになってたからどうしよ
…ahana/add-get-department-by-donation
Deploying finansu with
|
| Latest commit: |
a0cccf1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d032a9db.finansu.pages.dev |
| Branch Preview URL: | https://feat-hikahana-add-get-depart.finansu.pages.dev |
Collaborator
Author
|
@Kubosaka |
Collaborator
Author
|
APIのパスをcampus_donationに変更するためいったんdraftにします。 |
…inanSu into feat/hikahana/add-get-department-by-donation
…hub:NUTFes/FinanSu into feat/hikahana/add-get-department-by-donation
Kubosaka
reviewed
May 19, 2025
Comment on lines
+825
to
+836
| - name: building_id | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: integer | ||
| description: ID of the building | ||
| - name: floor_id | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: integer | ||
| description: ID of the floor |
Collaborator
Author
There was a problem hiding this comment.
これ違うprの方だと思う!
からこれは一旦考慮しない
|
|
||
| func (fir *campusDonationRepository) AllBuildingsByPeriod(c context.Context, year string) (*sql.Rows, error) { | ||
|
|
||
| db := goqu.Dialect("mysql") |
Collaborator
There was a problem hiding this comment.
file名タイポってる
cmapus_donation_controller.go
Kubosaka
reviewed
Jun 4, 2025
Comment on lines
125
to
145
| for rows.Next() { | ||
| var buildingTotal domain.CampusDonationBuilding | ||
| if err := rows.Scan(&buildingTotal.Id, &buildingTotal.Name, &buildingTotal.Price); err != nil { | ||
| return nil, err | ||
| } | ||
| if b, exists := aggregated[buildingTotal.Id]; exists { | ||
| if b.TotalPrice == nil { | ||
| b.TotalPrice = new(int) | ||
| } | ||
| *b.TotalPrice += buildingTotal.Price | ||
| } else { | ||
| id := buildingTotal.Id | ||
| name := buildingTotal.Name | ||
| price := buildingTotal.Price | ||
| aggregated[buildingTotal.Id] = &BuildingTotal{ | ||
| Id: &id, | ||
| Name: &name, | ||
| TotalPrice: &price, | ||
| } | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
[imo] nest深いからcontinueとか使ってあさくできたりする?
Comment on lines
+86
to
+88
| goqu.I("buildings.id"), | ||
| goqu.I("buildings.name"), | ||
| goqu.I("campus_donations.price"), |
Collaborator
There was a problem hiding this comment.
sumとか集計関数つかったらusecaseの処理楽になるのかな、まあどっちでも
Collaborator
Author
There was a problem hiding this comment.
棟ごとに分けるの実装するのめんどみがあるからusecaseで処理させます
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
対応Issue
resolve #0
なし
概要
このデザインに沿って作成しました。
おそらく年度ごとの取得になるため、年度ごとで取得できるようにしてます。
sqlクエリ自体は以下の通りです。
画面スクリーンショット等
URLスクリーンショット
テスト項目
備考
APIどこに生やせばいいか迷ってとりあえずでfund_informationsに生やしました。
ここら辺話してから作成に取り掛かればよかったです。