{"size": 888, "ext": "js", "max_stars_repo_path": "example/src/store/components/projects/projects.reducer.js", "max_stars_repo_name": "arbershabani97/axios-r", "max_stars_repo_stars_event_min_datetime": "2020-07-14T11:05:15.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-17T11:52:59.000Z", "max_issues_repo_path": "example/src/store/components/projects/projects.reducer.js", "max_issues_repo_name": "arbershabani97/axios-r", "max_issues_repo_issues_event_min_datetime": "2022-02-19T04:59:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T08:16:36.000Z", "max_forks_repo_path": "example/src/store/components/projects/projects.reducer.js", "max_forks_repo_name": "arbershabani97/axios-r", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 28.6451612903, "max_line_length": 111, "alphanum_fraction": 0.7477477477}
import _keys from "lodash/keys";
import _pick from "lodash/pick";

import {DELETE_PROJECT, GET_PROJECTS, GET_UPDATE_PROJECTS, POST_PROJECT, PUT_PROJECT} from "../../actionTypes";
import {RestfulReducerAOT, RestfulStateAOT} from "../../helpers/RestfulReducerAOT";
import {reducerModel} from "./projects.model";

const modelFn = (item) => _pick(item, _keys(reducerModel));

export default (state = RestfulStateAOT, action) => {
	switch (action.type) {
		case GET_PROJECTS:
			return RestfulReducerAOT.get(state, action, modelFn);

		case GET_UPDATE_PROJECTS:
			return RestfulReducerAOT.get(state, action, modelFn, true);

		case POST_PROJECT:
			return RestfulReducerAOT.post(state, action, modelFn);

		case PUT_PROJECT:
			return RestfulReducerAOT.put(state, action, modelFn);

		case DELETE_PROJECT:
			return RestfulReducerAOT.delete(state, action);

		default:
			return state;
	}
};
