-
Notifications
You must be signed in to change notification settings - Fork 2
各棟ごとの合計募金額を取得するAPIの作成 #986
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
base: feat/hikahana/get-rooms-by-building
Are you sure you want to change the base?
各棟ごとの合計募金額を取得するAPIの作成 #986
Conversation
…nsに紐づくデータを取得する機能を実装
Kubosaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
フロントで収支管理が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 |
|
@Kubosaka |
|
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
とりあえずコメ
| - 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こっちも年度かな!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これ違うprの方だと思う!
からこれは一旦考慮しない
|
|
||
| func (fir *campusDonationRepository) AllBuildingsByPeriod(c context.Context, year string) (*sql.Rows, error) { | ||
|
|
||
| db := goqu.Dialect("mysql") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dialectはどっかで定義してると思う
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file名タイポってる
cmapus_donation_controller.go
| 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, | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[imo] nest深いからcontinueとか使ってあさくできたりする?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
296d728
一次対応
| goqu.I("buildings.id"), | ||
| goqu.I("buildings.name"), | ||
| goqu.I("campus_donations.price"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sumとか集計関数つかったらusecaseの処理楽になるのかな、まあどっちでも
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
棟ごとに分けるの実装するのめんどみがあるからusecaseで処理させます
対応Issue
resolve #0
なし
概要
このデザインに沿って作成しました。
おそらく年度ごとの取得になるため、年度ごとで取得できるようにしてます。
sqlクエリ自体は以下の通りです。
画面スクリーンショット等
URLスクリーンショット
テスト項目
備考
APIどこに生やせばいいか迷ってとりあえずでfund_informationsに生やしました。
ここら辺話してから作成に取り掛かればよかったです。