feat(role): Update RoleResponse to include detailed menu information with IconUrl and Url
Deploy Application / deploy (push) Successful in 22s Details

This commit is contained in:
Habib Fatkhul Rohman 2025-11-04 11:43:41 +07:00
parent 8ff66d3775
commit e83a114390
2 changed files with 14 additions and 5 deletions

View File

@ -96,7 +96,14 @@ type RoleResponse struct {
// ClientID string `json:"client_id"` // ClientID string `json:"client_id"`
Client pkgdto.IdNameResponse `json:"client"` Client pkgdto.IdNameResponse `json:"client"`
Permissions []RolePermissionsResponse `json:"permissions,omitempty"` Permissions []RolePermissionsResponse `json:"permissions,omitempty"`
Menus []pkgdto.IdNameResponse `json:"menus,omitempty"` Menus []RoleMenuResponse `json:"menus,omitempty"`
}
type RoleMenuResponse struct {
ID string `json:"id"`
Name string `json:"name"`
IconUrl string `json:"icon_url"`
Url string `json:"url"`
} }
type RolePermissionsResponse struct { type RolePermissionsResponse struct {

View File

@ -479,11 +479,13 @@ func ToRoleResponse(role entities.M_Role) dto.RoleResponse {
} }
} }
var menus []pkgdto.IdNameResponse var menus []dto.RoleMenuResponse
for _, m := range role.Menus { for _, m := range role.Menus {
menus = append(menus, pkgdto.IdNameResponse{ menus = append(menus, dto.RoleMenuResponse{
ID: m.ID.String(), ID: m.ID.String(),
Name: m.Name, Name: m.Name,
IconUrl: m.IconUrl,
Url: m.Url,
}) })
} }