File tree Expand file tree Collapse file tree 3 files changed +51
-4
lines changed
Expand file tree Collapse file tree 3 files changed +51
-4
lines changed Original file line number Diff line number Diff line change 4242```
4343 async mounted () {
4444
45- let response = await fetch("http://localhost:3000/api/users/spooky /tasks");
45+ let response = await fetch("http://localhost:3000/api/users/hellojs /tasks");
4646 let result = await response.json();
4747
4848 result.tasks.forEach((task) => {
9696 completed: false
9797 }
9898
99- let response = await fetch('http://localhost:3000/api/users/spooky /tasks/create', {
99+ let response = await fetch('http://localhost:3000/api/users/hellojs /tasks/create', {
100100 method: 'post',
101101 headers: {"Content-Type": "application/json"},
102102 body: JSON.stringify(data)
Original file line number Diff line number Diff line change 22
33## Story
44
5- 為了提供使用者可以記錄各自的待做項目,需要提供後台可以新增使用者,必且讓使用者可以自行新增待做事項 。
5+ 為了提供使用者可以記錄各自的待做項目,需要提供後台可以新增使用者,並且讓使用者可以自行新增待做事項 。
66
77## 測試方式
88
Original file line number Diff line number Diff line change 66
77## 步驟
88
9+ ### 後端調整
10+
911* model Task 新增 completed 欄位紀錄 Task 是否被完成
12+
13+ * migration 程序新增 model Task 欄位 completed
14+
15+ 新增 migration 檔案指令
16+
17+ ` node_modules/.bin/sequelize migration:create --name task-add-completed `
18+
19+
20+ ```
21+ module.exports = {
22+ up: (queryInterface, Sequelize) => {
23+ queryInterface.addColumn(
24+ 'Todo',
25+ 'completed',
26+ Sequelize.BOOLEAN
27+ );
28+ },
29+
30+ down: (queryInterface, Sequelize) => {
31+ queryInterface.removeColumn(
32+ 'Todo',
33+ 'completed'
34+ );
35+ }
36+ };
37+
38+ ```
39+
40+ 執行下列指令更新 database
41+
42+ ` node_modules/.bin/sequelize db:migrate `
43+
44+
1045* 撰寫 test case 確認更新 model Task completed 成功
1146* 新增 test 定義 task 更新 completed 之 API spec
1247* 實作 Task completed 更新 API 並且透過 test 驗證 API
1348* 調整後端頁面顯示 completed 的值
49+
50+ ### 前端調整
51+
1452* 調整前端針對 completed 的變動,呼叫完成的 API
15- * 確認在前端調整的 completed 之變動,在後端看到的是相同的變動
53+
1654
1755
1856## 測試方式
22603 . 假設新增 task 成功,進入後台,可以看到該使用者的特定 Task 狀態為已完成
23614 . 若再次在前台變更完成狀態為未完成,則可以在後台看到顯示該 Task 顯示為未完成
2462
63+ ## 解答
64+
65+ ### 後端
66+
67+ https://github.com/agileworks-tw/express-example/pull/1
68+
69+ ### 前端
70+
71+ https://github.com/agileworks-tw/express-example-vue/pull/1
You can’t perform that action at this time.
0 commit comments