Prepare for collection board type, refactoring, update dependencies

This commit is contained in:
Maksim Eltyshev
2020-08-04 01:32:46 +05:00
parent 2d92ade8dc
commit c6ee7d54bb
190 changed files with 2144 additions and 1817 deletions

View File

@@ -7,7 +7,7 @@ import { removeAccessToken } from '../../utils/access-token-storage';
import ActionTypes from '../../constants/ActionTypes';
import Paths from '../../constants/Paths';
export default function* () {
export default function* coreSaga() {
yield all(watchers.map((watcher) => fork(watcher)));
yield apply(socket, socket.connect);

View File

@@ -55,13 +55,13 @@ export function* fetchBoardRequest(id) {
try {
const {
item,
included: { lists, labels, cards, cardMemberships, cardLabels, tasks, attachments },
included: { labels, lists, cards, cardMemberships, cardLabels, tasks, attachments },
} = yield call(request, api.getBoard, id);
const action = fetchBoardSucceeded(
item,
lists,
labels,
lists,
cards,
cardMemberships,
cardLabels,

View File

@@ -17,11 +17,11 @@ import {
} from '../../../actions';
import api from '../../../api';
export function* createCardRequest(listId, localId, data) {
export function* createCardRequest(boardId, localId, data) {
yield put(
createCardRequested(localId, {
...data,
listId,
boardId,
}),
);
@@ -29,7 +29,7 @@ export function* createCardRequest(listId, localId, data) {
const {
item,
included: { cardMemberships, cardLabels, tasks, attachments },
} = yield call(request, api.createCard, listId, data);
} = yield call(request, api.createCard, boardId, data);
const action = createCardSucceeded(
localId,

View File

@@ -4,8 +4,8 @@ export * from './projects';
export * from './project';
export * from './project-membership';
export * from './board';
export * from './list';
export * from './label';
export * from './list';
export * from './card';
export * from './card-membership';
export * from './card-label';

View File

@@ -4,7 +4,7 @@ import { accessTokenSelector } from '../../../selectors';
import { logout } from '../../../actions';
import ErrorCodes from '../../../constants/ErrorCodes';
export default function* (method, ...args) {
export default function* request(method, ...args) {
try {
const accessToken = yield select(accessTokenSelector);

View File

@@ -11,6 +11,7 @@ export function* createCardService(listId, data) {
const nextData = {
...data,
listId,
position: yield select(nextCardPositionSelector, listId),
};
@@ -19,13 +20,12 @@ export function* createCardService(listId, data) {
yield put(
createCard({
...nextData,
listId,
boardId,
id: localId,
}),
);
yield call(createCardRequest, listId, localId, nextData);
yield call(createCardRequest, boardId, localId, nextData);
}
export function* updateCardService(id, data) {
@@ -65,8 +65,8 @@ export function* transferCardService(id, boardId, listId, index) {
yield put(deleteCard(id));
yield call(updateCardRequest, id, {
listId,
boardId,
listId,
position,
});
}

View File

@@ -7,8 +7,8 @@ export * from './user';
export * from './project';
export * from './project-membership';
export * from './board';
export * from './list';
export * from './label';
export * from './list';
export * from './card';
export * from './task';
export * from './attachment';

View File

@@ -3,7 +3,7 @@ import { takeLatest } from 'redux-saga/effects';
import { fetchActionsInCurrentCardService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* actionsWatchers() {
yield takeLatest(EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH, () =>
fetchActionsInCurrentCardService(),
);

View File

@@ -7,7 +7,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* attachmentWatchers() {
yield all([
takeLatest(EntryActionTypes.ATTACHMENT_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) =>
createAttachmentInCurrentCardService(data),

View File

@@ -9,7 +9,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* boardWatchers() {
yield all([
takeLatest(EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) =>
createBoardInCurrentProjectService(data),

View File

@@ -13,7 +13,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* cardWatchers() {
yield all([
takeLatest(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data } }) =>
createCardService(listId, data),

View File

@@ -7,7 +7,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* commentActionWatchers() {
yield all([
takeLatest(EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) =>
createCommentActionInCurrentCardService(data),

View File

@@ -6,8 +6,8 @@ import user from './user';
import project from './project';
import projectMembership from './project-membership';
import board from './board';
import list from './list';
import label from './label';
import list from './list';
import card from './card';
import task from './task';
import attachment from './attachment';
@@ -24,8 +24,8 @@ export default [
project,
projectMembership,
board,
list,
label,
list,
card,
task,
attachment,

View File

@@ -13,7 +13,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* labelWatchers() {
yield all([
takeLatest(EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE, ({ payload: { data } }) =>
createLabelInCurrentBoardService(data),

View File

@@ -8,7 +8,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* listWatchers() {
yield all([
takeLatest(EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE, ({ payload: { data } }) =>
createListInCurrentBoardService(data),

View File

@@ -3,6 +3,6 @@ import { takeLatest } from 'redux-saga/effects';
import { logoutService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* loginWatchers() {
yield takeLatest(EntryActionTypes.LOGOUT, () => logoutService());
}

View File

@@ -3,7 +3,7 @@ import { all, takeLatest } from 'redux-saga/effects';
import { closeModalService, openModalService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* modalWatchers() {
yield all([
takeLatest(EntryActionTypes.MODAL_OPEN, ({ payload: { type } }) => openModalService(type)),
takeLatest(EntryActionTypes.MODAL_CLOSE, () => closeModalService()),

View File

@@ -3,7 +3,7 @@ import { takeLatest } from 'redux-saga/effects';
import { deleteNotificationService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* notificationWatchers() {
yield takeLatest(EntryActionTypes.NOTIFICATION_DELETE, ({ payload: { id } }) =>
deleteNotificationService(id),
);

View File

@@ -6,7 +6,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* projectMembershipWatchers() {
yield all([
takeLatest(EntryActionTypes.MEMBERSHIP_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) =>
createMembershipInCurrentProjectService(data),

View File

@@ -8,7 +8,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* projectWatchers() {
yield all([
takeLatest(EntryActionTypes.PROJECT_CREATE, ({ payload: { data } }) =>
createProjectService(data),

View File

@@ -3,6 +3,6 @@ import { LOCATION_CHANGE } from 'connected-react-router';
import { locationChangedService } from '../services';
export default function* () {
export default function* routerWatchers() {
yield takeEvery(LOCATION_CHANGE, () => locationChangedService());
}

View File

@@ -304,7 +304,7 @@ const createSocketEventsChannel = () =>
};
});
export default function* () {
export default function* socketWatchers() {
const socketEventsChannel = yield call(createSocketEventsChannel);
try {

View File

@@ -3,7 +3,7 @@ import { all, takeLatest } from 'redux-saga/effects';
import { createTaskInCurrentCardService, deleteTaskService, updateTaskService } from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* taskWatchers() {
yield all([
takeLatest(EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE, ({ payload: { data } }) =>
createTaskInCurrentCardService(data),

View File

@@ -22,7 +22,7 @@ import {
} from '../services';
import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* () {
export default function* userWatchers() {
yield all([
takeLatest(EntryActionTypes.USER_CREATE, ({ payload: { data } }) => createUserService(data)),
takeLatest(EntryActionTypes.USER_CREATE_ERROR_CLEAR, () => clearUserCreateErrorService()),