Can't create a task still
Closed this issue · 3 comments
Describe the bug
I tried to create a task with the JSON below
{ "deadline": "2020-09-2", "title": "Learn how the internet works", "description": "Topic: The Internet<br> <br> Video Resources<br> <br> https://www.youtube.com/watch?v=Dxcc6ycZ73M&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=2&t=0s<br> <br> https://www.youtube.com/watch?v=ZhEf7e4kopM&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=3&t=0s<br> <br> https://www.youtube.com/watch?v=5o8CwafCxnU&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=4&t=0s<br> <br> https://www.youtube.com/watch?v=AYdF7b3nMto&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=5&t=0s<br> <br> https://www.youtube.com/watch?v=kBXQZMmiA4s&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=6&t=0s<br> <br> https://www.youtube.com/watch?v=ZghMPWGXexs&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=7&t=0s<br> <br> https://www.youtube.com/watch?v=AuYNXgO_f3Y&list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&index=8&t=0s<br> <br> <br> <br> Task:<br> <br> Write an Article on What you have learnt so far. Does the Internet fascinate or intrigue you. One of the best ways to learn about a thing is to write about it.<br> <br> Submission Guideline<br> <br> Create a blog on hashnode.com then post your article on it. Submit with a link to the article.", "track": "5f4594faf58e03001790cfb4", "stage": "5f459564f58e03001790cfb7", "course": "string" }
To Reproduce
Try the JSON on swagger
Expected behavior
I should be able to pass in HTML codes and store to the server. We want to display formatted text to the user.
Hi @tayormi
Try to escape the string first.
Please close this issue if that resolves it
@ofuochi, after escpaing the HTML string, I get the error below.
{ "message": [ "description must be shorter than or equal to 1024 characters", "course must be a mongodb id" ], "error": "Bad Request", "stack": null, "errors": null, "path": "/tasks", "timestamp": "2020-08-26T15:28:47.556Z", "statusCode": 400, "status": "BAD_REQUEST" }
1024 characters is too small. Take the task as a blog post.
Also, a task may not have a course. It's optional.
Here is a sample of the JSON I am trying to pass.
{ "deadline": "2020-09-2", "title": "Learn how the internet works", "description": "<p><strong>Topic</strong>:<span>The Internet</span></p><br/><p><strong>Video Resources</strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=Dxcc6ycZ73M&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=2&amp;t=0s">https://www.youtube.com/watch?v=Dxcc6ycZ73M&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=2&amp;t=0s</a></strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=ZhEf7e4kopM&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=3&amp;t=0s">https://www.youtube.com/watch?v=ZhEf7e4kopM&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=3&amp;t=0s</a></strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=5o8CwafCxnU&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=4&amp;t=0s">https://www.youtube.com/watch?v=5o8CwafCxnU&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=4&amp;t=0s</a></strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=AYdF7b3nMto&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=5&amp;t=0s">https://www.youtube.com/watch?v=AYdF7b3nMto&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=5&amp;t=0s</a></strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=kBXQZMmiA4s&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=6&amp;t=0s">https://www.youtube.com/watch?v=kBXQZMmiA4s&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=6&amp;t=0s</a></strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=ZghMPWGXexs&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=7&amp;t=0s">https://www.youtube.com/watch?v=ZghMPWGXexs&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=7&amp;t=0s</a></strong></p><br/><p><strong><a href="https://www.youtube.com/watch?v=AuYNXgO_f3Y&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=8&amp;t=0s">https://www.youtube.com/watch?v=AuYNXgO_f3Y&amp;list=PLkZYeFmDuaN21nQjzE4RLLNccK_YP0P0_&amp;index=8&amp;t=0s</a></strong></p><br/><p><strong>Task:</strong></p><br/><p><span>Write an Article on What you have learnt so far. Does the Internet fascinate or intrigue you. One of the best ways to learn about a thing is to write about it.</span><br /><br /><span><strong>Submission Guideline</strong></span></p><br/><p>Create a blog on<a href="https://hashnode.com/">hashnode.com</a>then post your article on it. Submit with a link to the article.</p><br/><p>The <a target="_blank" href="https://html-cleaner.com/css/" rel="noopener">online HTML and CSS cleaner</a> will take care of your dirty markup. They are free online tools.</p>", "track": "5f4594faf58e03001790cfb4", "stage": "5f459564f58e03001790cfb7", "course": "string" }