Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve TodoList Tutorial instructions and completed tutorial 'lb4 example todo-list' #4161

Closed
5 tasks
emonddr opened this issue Nov 19, 2019 · 2 comments · Fixed by #4412
Closed
5 tasks
Assignees
Milestone

Comments

@emonddr
Copy link
Contributor

emonddr commented Nov 19, 2019

Right now, the artifacts of the completed 'lb4 example todo-list' don't completely match
the artifacts created by hand when user follows the Todo Tutorial and then the TodoList tutorial.

Differences

  • There is a TodoListImageController in finished tutorial that is not part of the tutorial instructions
  • The Todo and TodoList models don't seem to have navigational properties. See TodoRelations and TodoListRelations ; they are empty.
  • there is a difference in whether the id field is required and generated in the Todo and TodoList models.
  • there is an additional question Is the id omitted when creating a new instance? that is asked by the CLI when creating the TodoRepository. It is not clear what the answer should be.
  • Create TodoList’s Todo controller section is no longer necessary since todo-list-todo.controller.ts is already generated (there may be 1 or 2 controllers auto-generated, just double-check).
  • the data/db.json of the Todo Tutorial and TodoList Tutorial are different; the todo items in the former do not have the todoListID property. When following the instructions by hand, is it necessary to have instructions to tell the user to change the content in this file before proceeding with the TodoList tutorial? If so, we need to tell them.

Expected and Unexpected Behaviour

So with the completed 'lb4 example todo-list', all todo items in the data/db.json have a todoListID that they belong to, and those todoLists exist. (no problem)

In the api explorer :

  • I can post a todo with an id of a todolist that doesn't exist (e.g. 0) {unexpected}.
  • calling GET /todolist/0 returns 404 {expected},
  • calling GET /todolist/0/todos returns data {that's unexpected if todoList id=0 doesn't exist}
  • calling GET /todos/6/todo-list (todo id=6 belongs to todoList id=0 which doesn't exist) returns 404 {expected}
  • I can POST a todo (e.g. id=99) without a todoListID (unlike the others which all have this field) and when i perform GET /todos/99/todo-list it, will return the 1st todoList in the todoList table {unexpected}
  • whether created by hand via the instructions, or downloading the completed example, both approaches currently suffer from bug TodoList tutorial - GET ​/todos​/{id}​/todo-list gives unexpected response #4147 .

Related Issues

#4147

Acceptance Criteria

  • The artifacts created as a result of following the todo and todolist tutorials match the artifacts that the user can download using lb4 example todo-list
  • The todo and todoList tutorials contain updated instructions, prompts from cli, and code excerpts
  • The TodoList tutorial instructions make it clear if data/db.json JSON data needs to be replaced with a new default JSON data in order to begin the ToDoList tutorial.
  • Interacting with all the endpoints list in the API explorer returns expected results
  • It is possible to specify inclusion resolvers via the API Explorer or via a browser http url

Regarding the inclusion resolvers mention in the point above

http://localhost:3000/todo-lists/1?filter[include][][relation]=todos

This should return the todoList #1 AND its todo items.

{"id":1,"title":"grocery","color":"green","todos":[{"id":5,"title":"carrots","desc":"White Carrots for soup","isComplete":false,"todoListId":1},{"id":6,"title":"bananas","desc":"Yellow bananas for banana bread","isComplete":false,"todoListId":1}]}

http://localhost:3000/todos/5?filter[include][][relation]=todoList

This should return a todo item by itself IF it is not part of a list
This should return a todo item AND the todoList it is part of .

{"id":5,"title":"carrots","desc":"White Carrots for soup","isComplete":false,"todoListId":1,"todoList":{"id":1,"title":"grocery","color":"green"}}

See Reporting Issues for more tips on writing good issues

@emonddr emonddr added the bug label Nov 19, 2019
@dhmlau
Copy link
Member

dhmlau commented Nov 19, 2019

@emonddr, could you please add acceptance criteria so that the team can estimate? Thanks.

@bajtos
Copy link
Member

bajtos commented Nov 29, 2019

I can post a todo with an id of a todolist that doesn't exist (e.g. 0) {unexpected}.

This is a known problem, see #1718 and #2333

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants