codestates / codestates/Reciper-server

[✍️ Dev Log] 신승길 / 2021-05-25

Open
#153 0 comments 0 reactions 1 assignee Claimed by @gatsukichi View on GitHub
@katsukichi/불꽃코딩🔥 Dev Log
Dominant language
TypeScript
Stars
9
Forks
3
PR merge metrics
No merged PRs in 30d

Description

### 오늘은 어떻게 프로젝트에 기여했나요?

- 칸반보드의 소켓통신화 진행중인데 아직 마무리가 덜됬다.

### 오늘의 프로젝트에서 힘든 점은 무엇인가요?

- await이 많이들어가니까 엄청 느려졌다. 로직이 잘못됬음을 깨닷고 join 메서드를 이용해서, 연속으로 chain을 계속 쭉쭉 걸어서 하나의 await으로 처리해야겠다.

```ts

const structuringData = async (part: string, projectId: number) => {
const foundProject = await Projects.findOne({ where: { id: projectId } });

const foundParts = await Parts.findOne({
where: {
title: part,
doingProject: foundProject,
},
});
if (foundParts) {
const foundTaskBox = await Task_boxes.find({
where: {
groupingPart: foundParts,
},
order: {
index: 'ASC',
},
});
const taskBox = [];
const taskItem: {
[index: number]: any;
} = {};
for (let i = 0; i < foundTaskBox.length; i++) {
const foundTasks = await Tasks.find({
where: {
groupingBox: foundTaskBox[i],
},
order: {
index: 'ASC',
},
});
let taskBoxOne: {
taskBoxTitle: string;
tasks: Array;
} = Object.assign({}, { taskBoxTitle: foundTaskBox[i].title, tasks: [] });
taskBoxOne.tasks = foundTasks.map(el => String(el.id));
//taskBox하나에 tasks를 집어넣는다.
taskBox.push(taskBoxOne);
// 여기까지 taskBox하나만드는것 완료

for (let j = 0; j < foundTasks.length; j++) {
const foundChecklist = await Checklists.find({ where: { nowTask: foundTasks[j] } });
taskItem[foundTasks[j].id] = {
taskTitle: foundTasks[j].title,
desc: foundTasks[j].desc,
taskColor: foundTasks[j].taskColor,
startDate: foundTasks[j].startDate,
endDate: foundTasks[j].endDate,
assigness: JSON.parse(foundTasks[j].assignees),
checkList: foundChecklist
? foundChecklist.map(el => {
return { desc: el.desc, isChecked: el.isChecked };
})
: [],
};
}
}
console.log(taskBox, taskItem);
return { taskBox, taskItem };
} else {
const taskBox: {
taskBoxTitle: string;
tasks: Array;
}[] = [];
const taskItem: {
[index: number]: any;
} = {};
return { taskBox, taskItem };
}
};
```

진짜 코드가 너무 지저분하다 ;;

얼른 join chain으로 해결해야겠다.

### 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?

- [ ] 오늘중으로 칸반보드 50프로이상 구현

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.