Closed marbleyung closed 1 year ago
@marbleyung I updated project structure to python module, could you please update the commit?
Also, I think we don't need Tree-like categories, flat structure should be enough.
@eugapx Fine, it's done. Didn't mean to commit 5 times instead of one, sorry :)
@eugapx
I've did all the changes you noticed.
What's for user-specific categories, I've reconstructed Categories.
Now, going to http://localhost:8000/api/v1/chat/rooms/ you can create room without category
Also you can to go http://localhost:8000/api/v1/chat/categories/ and create a category first
Then when creating a room you can pass Category ID in category_id field, so the room will belong to the category
Categories are specific for each user. They also have unique constraint 'unique_together = ('owner', 'title');
Categories have CRUD functionality (put is not available - use patch instead).
Filters work like http://localhost:8000/api/v1/chat/rooms/?category=
@eugapx done
@eugapx not sure that Category.rooms
will be better than Room.categories
, but I did it. One serializer for both GET
categories and POST
categories on api/v1/chat/rooms/
seems like bad solution because it overloads the output data. I'm not sure about fields which is necessary to display.
Plus there is some troubles with Postman auth so now it is very difficult to test all the methods, but I think they should work stable because nothing of their core has been changed.
first of all, create some categories and rooms via admin _ http://localhost:8000/api/v1/chat/rooms/ to check existing rooms http://localhost:8000/api/v1/chat/categories/ to check existing categories http://localhost:8000/api/v1/chat/categories//rooms/
to check rooms belong to the category