Skip to content

Commit 1f00fc8

Browse files
authored
(BEDS-94) add search query param to dashboard notification detail (#924)
1 parent 7e7996c commit 1f00fc8

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

backend/pkg/api/data_access/dummy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,11 @@ func (d *DummyService) GetDashboardNotifications(ctx context.Context, userId uin
531531
return getDummyWithPaging[t.NotificationDashboardsTableRow]()
532532
}
533533

534-
func (d *DummyService) GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64) (*t.NotificationValidatorDashboardDetail, error) {
534+
func (d *DummyService) GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64, search string) (*t.NotificationValidatorDashboardDetail, error) {
535535
return getDummyStruct[t.NotificationValidatorDashboardDetail]()
536536
}
537537

538-
func (d *DummyService) GetAccountDashboardNotificationDetails(ctx context.Context, dashboardId uint64, groupId uint64, epoch uint64) (*t.NotificationAccountDashboardDetail, error) {
538+
func (d *DummyService) GetAccountDashboardNotificationDetails(ctx context.Context, dashboardId uint64, groupId uint64, epoch uint64, search string) (*t.NotificationAccountDashboardDetail, error) {
539539
return getDummyStruct[t.NotificationAccountDashboardDetail]()
540540
}
541541

backend/pkg/api/data_access/notifications.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ type NotificationsRepository interface {
2525

2626
GetDashboardNotifications(ctx context.Context, userId uint64, chainIds []uint64, cursor string, colSort t.Sort[enums.NotificationDashboardsColumn], search string, limit uint64) ([]t.NotificationDashboardsTableRow, *t.Paging, error)
2727
// depending on how notifications are implemented, we may need to use something other than `notificationId` for identifying the notification
28-
GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64) (*t.NotificationValidatorDashboardDetail, error)
29-
GetAccountDashboardNotificationDetails(ctx context.Context, dashboardId uint64, groupId uint64, epoch uint64) (*t.NotificationAccountDashboardDetail, error)
28+
GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64, search string) (*t.NotificationValidatorDashboardDetail, error)
29+
GetAccountDashboardNotificationDetails(ctx context.Context, dashboardId uint64, groupId uint64, epoch uint64, search string) (*t.NotificationAccountDashboardDetail, error)
3030

3131
GetMachineNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationMachinesColumn], search string, limit uint64) ([]t.NotificationMachinesTableRow, *t.Paging, error)
3232
GetClientNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationClientsColumn], search string, limit uint64) ([]t.NotificationClientsTableRow, *t.Paging, error)
@@ -61,12 +61,12 @@ func (d *DataAccessService) GetDashboardNotifications(ctx context.Context, userI
6161
return d.dummy.GetDashboardNotifications(ctx, userId, chainIds, cursor, colSort, search, limit)
6262
}
6363

64-
func (d *DataAccessService) GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64) (*t.NotificationValidatorDashboardDetail, error) {
65-
return d.dummy.GetValidatorDashboardNotificationDetails(ctx, dashboardId, groupId, epoch)
64+
func (d *DataAccessService) GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64, search string) (*t.NotificationValidatorDashboardDetail, error) {
65+
return d.dummy.GetValidatorDashboardNotificationDetails(ctx, dashboardId, groupId, epoch, search)
6666
}
6767

68-
func (d *DataAccessService) GetAccountDashboardNotificationDetails(ctx context.Context, dashboardId uint64, groupId uint64, epoch uint64) (*t.NotificationAccountDashboardDetail, error) {
69-
return d.dummy.GetAccountDashboardNotificationDetails(ctx, dashboardId, groupId, epoch)
68+
func (d *DataAccessService) GetAccountDashboardNotificationDetails(ctx context.Context, dashboardId uint64, groupId uint64, epoch uint64, search string) (*t.NotificationAccountDashboardDetail, error) {
69+
return d.dummy.GetAccountDashboardNotificationDetails(ctx, dashboardId, groupId, epoch, search)
7070
}
7171

7272
func (d *DataAccessService) GetMachineNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationMachinesColumn], search string, limit uint64) ([]t.NotificationMachinesTableRow, *t.Paging, error) {

backend/pkg/api/handlers/common.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,9 @@ const maxBodySize = 10 * 1024
852852
func logApiError(r *http.Request, err error, callerSkip int, additionalInfos ...log.Fields) {
853853
body, _ := io.ReadAll(io.LimitReader(r.Body, maxBodySize))
854854
requestFields := log.Fields{
855-
"endpoint": r.Method + " " + r.URL.Path,
856-
"query": r.URL.RawQuery,
857-
"body": string(body),
855+
"request_endpoint": r.Method + " " + r.URL.Path,
856+
"request_query": r.URL.RawQuery,
857+
"request_body": string(body),
858858
}
859859
log.Error(err, "error handling request", callerSkip+1, append(additionalInfos, requestFields)...)
860860
}

backend/pkg/api/handlers/public.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,7 @@ func (h *HandlerService) PublicGetUserNotificationDashboards(w http.ResponseWrit
19551955
// @Param dashboard_id path string true "The ID of the dashboard."
19561956
// @Param group_id path integer true "The ID of the group."
19571957
// @Param epoch path integer true "The epoch of the notification."
1958+
// @Param search query string false "Search for Index"
19581959
// @Success 200 {object} types.InternalGetUserNotificationsValidatorDashboardResponse
19591960
// @Failure 400 {object} types.ApiErrorResponse
19601961
// @Router /users/me/notifications/validator-dashboards/{dashboard_id}/groups/{group_id}/epochs/{epoch} [get]
@@ -1964,11 +1965,12 @@ func (h *HandlerService) PublicGetUserNotificationsValidatorDashboard(w http.Res
19641965
dashboardId := v.checkPrimaryDashboardId(vars["dashboard_id"])
19651966
groupId := v.checkExistingGroupId(vars["group_id"])
19661967
epoch := v.checkUint(vars["epoch"], "epoch")
1968+
search := r.URL.Query().Get("search")
19671969
if v.hasErrors() {
19681970
handleErr(w, r, v)
19691971
return
19701972
}
1971-
data, err := h.dai.GetValidatorDashboardNotificationDetails(r.Context(), dashboardId, groupId, epoch)
1973+
data, err := h.dai.GetValidatorDashboardNotificationDetails(r.Context(), dashboardId, groupId, epoch, search)
19721974
if err != nil {
19731975
handleErr(w, r, err)
19741976
return
@@ -1988,6 +1990,7 @@ func (h *HandlerService) PublicGetUserNotificationsValidatorDashboard(w http.Res
19881990
// @Param dashboard_id path string true "The ID of the dashboard."
19891991
// @Param group_id path integer true "The ID of the group."
19901992
// @Param epoch path integer true "The epoch of the notification."
1993+
// @Param search query string false "Search for Address, ENS"
19911994
// @Success 200 {object} types.InternalGetUserNotificationsAccountDashboardResponse
19921995
// @Failure 400 {object} types.ApiErrorResponse
19931996
// @Router /users/me/notifications/account-dashboards/{dashboard_id}/groups/{group_id}/epochs/{epoch} [get]
@@ -1997,11 +2000,12 @@ func (h *HandlerService) PublicGetUserNotificationsAccountDashboard(w http.Respo
19972000
dashboardId := v.checkUint(vars["dashboard_id"], "dashboard_id")
19982001
groupId := v.checkExistingGroupId(vars["group_id"])
19992002
epoch := v.checkUint(vars["epoch"], "epoch")
2003+
search := r.URL.Query().Get("search")
20002004
if v.hasErrors() {
20012005
handleErr(w, r, v)
20022006
return
20032007
}
2004-
data, err := h.dai.GetAccountDashboardNotificationDetails(r.Context(), dashboardId, groupId, epoch)
2008+
data, err := h.dai.GetAccountDashboardNotificationDetails(r.Context(), dashboardId, groupId, epoch, search)
20052009
if err != nil {
20062010
handleErr(w, r, err)
20072011
return

0 commit comments

Comments
 (0)