Skip to content

Commit ca86e25

Browse files
newt239claude
andcommitted
refactor: 未使用フィールドの削除と関数名の改善
- WorkUpdatedAt フィールドを削除(ORDER BYのみで使用、API応答には不要) - aggregateWorkListRows → mapRowsToWorkList に名称変更 - aggregateWorkDetailRows → mapRowsToWorkDetail に名称変更 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c38f1d3 commit ca86e25

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

pkg/db/sql/work/select_work_with_relations.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
SELECT
1+
SELECT
22
BIN_TO_UUID(works.id) AS work_id,
33
works.name AS work_name,
4-
works.updated_at AS work_updated_at,
54
BIN_TO_UUID(work_users.user_id) AS author_user_id,
65
user_profiles.username AS author_username,
76
user_profiles.icon_url AS author_icon_url,

pkg/work/get_user_user_id_work.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ func getWorkListFromAuthorId(dbClient db.Client, userId string) ([]workOverview,
5252
}
5353
}
5454

55-
return aggregateWorkListRows(rows), nil
55+
return mapRowsToWorkList(rows), nil
5656
}

pkg/work/get_work_work.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
type workWithRelationsRow struct {
1414
WorkId string `db:"work_id"`
1515
WorkName string `db:"work_name"`
16-
WorkUpdatedAt string `db:"work_updated_at"`
1716
AuthorUserId *string `db:"author_user_id"`
1817
AuthorUsername *string `db:"author_username"`
1918
AuthorIconUrl *string `db:"author_icon_url"`
@@ -57,10 +56,10 @@ func getWorkList(dbClient db.Client, offset *int, authorId *string) ([]workOverv
5756
if err != nil {
5857
return []workOverview{}, &response.Error{Code: http.StatusInternalServerError, Level: "Error", Message: "不明なエラーが発生しました", Log: err.Error()}
5958
}
60-
return aggregateWorkListRows(rows), nil
59+
return mapRowsToWorkList(rows), nil
6160
}
6261

63-
func aggregateWorkListRows(rows []workWithRelationsRow) []workOverview {
62+
func mapRowsToWorkList(rows []workWithRelationsRow) []workOverview {
6463
workMap := make(map[string]*workOverview)
6564
workOrder := make([]string, 0)
6665
authorMap := make(map[string]map[string]bool)

pkg/work/get_work_work_work_id.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ func getWorkFromTagId(dbClient db.Client, workId string) (work, *response.Error)
8484
if len(rows) == 0 {
8585
return work{}, &response.Error{Code: http.StatusNotFound, Level: "Info", Message: "作品が存在しません", Log: "no rows in result"}
8686
}
87-
return aggregateWorkDetailRows(rows), nil
87+
return mapRowsToWorkDetail(rows), nil
8888
}
8989

90-
func aggregateWorkDetailRows(rows []workDetailWithRelationsRow) work {
90+
func mapRowsToWorkDetail(rows []workDetailWithRelationsRow) work {
9191
firstRow := rows[0]
9292
result := work{
9393
WorkId: firstRow.WorkId,

0 commit comments

Comments
 (0)