-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix/issue 400 #461
Fix/issue 400 #461
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,30 @@ func (h *Handlers) HandleGetMeGroupIDs(c echo.Context) error { | |
if err != nil { | ||
return judgeErrorResponse(err) | ||
} | ||
case presentation.RelationBelongsOrAdmins: | ||
belongingGroupIDs, err := h.Repo.GetUserBelongingGroupIDs(userID, getConinfo(c)) | ||
if err != nil { | ||
return judgeErrorResponse(err) | ||
} | ||
adminGroupIDs, err := h.Repo.GetUserAdminGroupIDs(userID) | ||
if err != nil { | ||
return judgeErrorResponse(err) | ||
} | ||
|
||
uniqueIDs := make(map[uuid.UUID]struct{}) | ||
|
||
for _, id := range belongingGroupIDs { | ||
uniqueIDs[id] = struct{}{} | ||
} | ||
|
||
for _, id := range adminGroupIDs { | ||
uniqueIDs[id] = struct{}{} | ||
} | ||
|
||
for id := range uniqueIDs { | ||
groupIDs = append(groupIDs, id) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 最後の空行は消してもらえると助かります:pray: |
||
} | ||
|
||
return c.JSON(http.StatusOK, groupIDs) | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -27,8 +27,9 @@ func GetTiemRange(values url.Values) (start time.Time, end time.Time, err error) | |||||||||||||
type UserRelation int | ||||||||||||||
|
||||||||||||||
const ( | ||||||||||||||
RelationBelongs = iota | ||||||||||||||
RelationAdmins = iota | ||||||||||||||
RelationBelongs = iota | ||||||||||||||
RelationAdmins = iota | ||||||||||||||
RelationBelongsOrAdmins = iota | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
かも?今のままだとuntyped intとかになってそう |
||||||||||||||
) | ||||||||||||||
|
||||||||||||||
func GetUserRelationQuery(values url.Values) UserRelation { | ||||||||||||||
|
@@ -38,6 +39,8 @@ func GetUserRelationQuery(values url.Values) UserRelation { | |||||||||||||
return RelationBelongs | ||||||||||||||
case "admins": | ||||||||||||||
return RelationAdmins | ||||||||||||||
case "belongsoradmins": | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. URLに指定するのでbelongs-or-adminsの方がいいかな |
||||||||||||||
return RelationBelongsOrAdmins | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
return RelationBelongs | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
みたいに書けそうです:eyes: