Skip to content

Commit

Permalink
EPMRPP-91556 || Code Review fix - 4
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazarQSO committed Dec 10, 2024
1 parent 7965213 commit 372a8a7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/src/components/filterEntities/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const getFormattedDate = (value) => {
return `${getMinutesFromTimestamp(start)};${getMinutesFromTimestamp(endOfToday)};${utcString}`;
};

export const updateFormatDate = (filtersParams) => {
export const prepareQueryFilters = (filtersParams) => {
const { limit, sort, offset, order, ...rest } = filtersParams;

const searchCriteria = getAppliedFilters(rest)?.search_criterias;
Expand Down
8 changes: 4 additions & 4 deletions app/src/controllers/instance/organizations/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { takeEvery, all, put, select } from 'redux-saga/effects';
import { URLS } from 'common/urls';
import { showDefaultErrorNotification } from 'controllers/notification';
import { fetchDataAction } from 'controllers/fetch';
import { updateFormatDate } from 'components/filterEntities/utils';
import { filterQuerySelector, querySelector } from './selectors';
import { prepareQueryFilters } from 'components/filterEntities/utils';
import { querySelector } from './selectors';
import { FETCH_ORGANIZATIONS, FETCH_FILTERED_ORGANIZATIONS, NAMESPACE } from './constants';

function* fetchOrganizations() {
Expand All @@ -37,8 +37,8 @@ function* watchFetchOrganizations() {
}

function* fetchFilteredOrganizations() {
const filtersParams = yield select(filterQuerySelector);
const data = updateFormatDate(filtersParams);
const filtersParams = yield select(querySelector);
const data = prepareQueryFilters(filtersParams);

yield put(
fetchDataAction(NAMESPACE)(URLS.organizationSearches(), {
Expand Down
7 changes: 0 additions & 7 deletions app/src/controllers/instance/organizations/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,3 @@ export const querySelector = createAlternativeQueryParametersSelector({
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
});

export const filterQuerySelector = createAlternativeQueryParametersSelector({
defaultPagination: DEFAULT_PAGINATION,
defaultSorting: SORTING_ASC,
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
});
8 changes: 4 additions & 4 deletions app/src/controllers/organization/projects/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { URLS } from 'common/urls';
import { fetch } from 'common/utils';
import { hideModalAction } from 'controllers/modal';
import { NOTIFICATION_TYPES, showNotification } from 'controllers/notification';
import { updateFormatDate } from 'components/filterEntities/utils';
import { prepareQueryFilters } from 'components/filterEntities/utils';
import {
CREATE_PROJECT,
FETCH_ORGANIZATION_PROJECTS,
Expand All @@ -30,7 +30,7 @@ import {
FETCH_FILTERED_PROJECTS,
} from './constants';
import { fetchOrganizationBySlugAction } from '..';
import { filterQuerySelector, querySelector } from './selectors';
import { querySelector } from './selectors';
import { activeOrganizationIdSelector, activeOrganizationSelector } from '../selectors';
import { fetchOrganizationProjectsAction } from './actionCreators';

Expand Down Expand Up @@ -121,8 +121,8 @@ function* watchDeleteProject() {

function* fetchFilteredProjects() {
const activeOrganizationId = yield select(activeOrganizationIdSelector);
const filtersParams = yield select(filterQuerySelector);
const data = updateFormatDate(filtersParams);
const filtersParams = yield select(querySelector);
const data = prepareQueryFilters(filtersParams);

yield put(
fetchDataAction(NAMESPACE)(URLS.organizationProjectsSearches(activeOrganizationId), {
Expand Down
7 changes: 0 additions & 7 deletions app/src/controllers/organization/projects/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,3 @@ export const querySelector = createAlternativeQueryParametersSelector({
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
});

export const filterQuerySelector = createAlternativeQueryParametersSelector({
defaultPagination: DEFAULT_PAGINATION,
defaultSorting: SORTING_ASC,
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
});

0 comments on commit 372a8a7

Please sign in to comment.