@@ -13,11 +13,11 @@ import (
1313func GetGroup (ctx echo.Context , dbClient db.Client , params api.GetGroupParams ) (api.ResGetGroup , * response.Error ) {
1414 res := api.ResGetGroup {}
1515 userId := ctx .Get ("user_id" ).(string )
16- events , err := getGroupList (dbClient , userId , params .Offset )
16+ groups , err := getGroupList (dbClient , userId , params .Offset )
1717 if err != nil {
1818 return api.ResGetGroup {}, err
1919 }
20- rerr := copier .Copy (& res .Groups , & events )
20+ rerr := copier .Copy (& res .Groups , & groups )
2121 if rerr != nil {
2222 return api.ResGetGroup {}, & response.Error {Code : http .StatusInternalServerError , Level : "Error" , Message : "グループ一覧の取得に失敗しました" , Log : rerr .Error ()}
2323 }
@@ -44,10 +44,7 @@ func getGroupList(dbClient db.Client, userId string, offset *int) ([]group, *res
4444 groups := []group {}
4545 err := dbClient .Select (& groups , "sql/group/select_group.sql" , & params )
4646 if err != nil {
47- return nil , & response.Error {Code : http .StatusInternalServerError , Level : "Error" , Message : "グループ一覧の取得に失敗しました" , Log : err .Error ()}
48- }
49- if len (groups ) == 0 {
50- return nil , & response.Error {Code : http .StatusNotFound , Level : "Info" , Message : "グループがありません。" , Log : "no rows in result" }
47+ return []group {}, & response.Error {Code : http .StatusInternalServerError , Level : "Error" , Message : "グループ一覧の取得に失敗しました" , Log : err .Error ()}
5148 }
5249 return groups , nil
5350}
0 commit comments