Skip to content

Commit

Permalink
feature: refactoring after review [WTEL-4354]
Browse files Browse the repository at this point in the history
  • Loading branch information
lizacoma committed Apr 19, 2024
1 parent db22a29 commit 63af419
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ const preRequestHandler = (parentId) => (item) => ({
teamId: parentId,
});

const getTeamFlowsList = async (params) => {
console.log();
const getTeamFlowSchemasList = async (params) => {
const defaultObject = {
enabled: false,
};
Expand Down Expand Up @@ -70,7 +69,7 @@ const getTeamFlowsList = async (params) => {
}
};

const getTeamFlow = async ({ parentId, itemId: id }) => {
const getTeamFlowSchema = async ({ parentId, itemId: id }) => {
const defaultObject = {
name: '',
description: '',
Expand All @@ -91,7 +90,7 @@ const getTeamFlow = async ({ parentId, itemId: id }) => {
}
};

const addTeamFlow = async ({ parentId, itemInstance }) => {
const addTeamFlowSchema = async ({ parentId, itemInstance }) => {
const item = applyTransform(itemInstance, [
preRequestHandler(parentId),
sanitize(fieldsToSend),
Expand All @@ -109,7 +108,7 @@ const addTeamFlow = async ({ parentId, itemInstance }) => {
}
};

const patchTeamFlow = async ({ changes, id, parentId }) => {
const patchTeamFlowSchema = async ({ changes, id, parentId }) => {
const body = applyTransform(changes, [
sanitize(fieldsToSend),
camelToSnake(),
Expand All @@ -127,7 +126,7 @@ const patchTeamFlow = async ({ changes, id, parentId }) => {
}
};

const updateTeamFlow = async ({ itemInstance, itemId: id, parentId }) => {
const updateTeamFlowSchema = async ({ itemInstance, itemId: id, parentId }) => {
const item = applyTransform(itemInstance, [
preRequestHandler(parentId),
sanitize(fieldsToSend),
Expand All @@ -145,7 +144,7 @@ const updateTeamFlow = async ({ itemInstance, itemId: id, parentId }) => {
}
};

const deleteTeamFlow = async ({ parentId, id }) => {
const deleteTeamFlowSchema = async ({ parentId, id }) => {
try {
const response = await flowSchemaService.deleteTeamTrigger(parentId, id);
return applyTransform(response.data, []);
Expand All @@ -157,12 +156,12 @@ const deleteTeamFlow = async ({ parentId, id }) => {
};

const TeamFlowsAPI = {
getList: getTeamFlowsList,
get: getTeamFlow,
add: addTeamFlow,
update: updateTeamFlow,
patch: patchTeamFlow,
delete: deleteTeamFlow,
getList: getTeamFlowSchemasList,
get: getTeamFlowSchema,
add: addTeamFlowSchema,
update: updateTeamFlowSchema,
patch: patchTeamFlowSchema,
delete: deleteTeamFlowSchema,
};

export default TeamFlowsAPI;
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
v$: useVuelidate(),
}),
data: () => ({
namespace: 'ccenter/teams/flowSchemas',
namespace: 'ccenter/teams/flow',
}),
validations: {
itemInstance: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ import openedObjectTableTabMixin
import FlowPopup from './opened-team-flow-popup.vue';
const namespace = 'ccenter/teams';
const subNamespace = 'flowSchemas';
const subNamespace = 'flow';
export default {
name: 'OpenedTeamFlows',
Expand Down
4 changes: 2 additions & 2 deletions src/modules/contact-center/modules/teams/store/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TeamsAPI from '../api/teams';
import agents from '../modules/agents/store/team-agents';
import supervisors from '../modules/supervisors/store/team-supervisors';
import hooks from '../modules/hooks/store/team-hooks';
import flowSchemas from '../modules/flow/store/team-flows';
import flow from '../modules/flow/store/team-flows';
import headers from './_internals/headers';

const resettableState = {
Expand Down Expand Up @@ -42,7 +42,7 @@ const permissions = new PermissionsStoreModule()
const teams = new ObjectStoreModule({ resettableState, headers })
.attachAPIModule(TeamsAPI)
.generateAPIActions()
.setChildModules({ supervisors, agents, hooks, flowSchemas, permissions })
.setChildModules({ supervisors, agents, hooks, flow, permissions })
.getModule({ actions });

export default teams;

0 comments on commit 63af419

Please sign in to comment.