Skip to content

Commit

Permalink
Room filtered by owner
Browse files Browse the repository at this point in the history
  • Loading branch information
GBS-Skile committed Jun 19, 2019
1 parent b565d05 commit b68c4a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ matrix:
- pipenv run python src/manage.py test
- language: node_js
node_js: 8
install:
- yarn install
before_install:
- cd frontend
4 changes: 3 additions & 1 deletion backend/src/dutch_broomstick/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class UserDetailView(generics.RetrieveUpdateAPIView):

class RoomListCreateView(generics.ListCreateAPIView):
permission_classes = (CheckUsername,)
queryset = Room.objects.all()
serializer_class = RoomSerializer

def get_queryset(self):
return Room.objects.filter(owner=self.request.user)

def perform_create(self, serializer):
serializer.save(owner=self.request.user)

Expand Down
5 changes: 5 additions & 0 deletions frontend/src/store/room/reducer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { USER_SIGNOUT } from 'store/actions'
import * as actions from './actions';

const initialState = {
Expand Down Expand Up @@ -42,6 +43,10 @@ const initialState = {

const roomReducer = (state = initialState, action) => {
switch(action.type) {
case USER_SIGNOUT:
return {
...initialState,
}
case actions.ROOM_CREATE_REQUEST:
return {
...state,
Expand Down

0 comments on commit b68c4a7

Please sign in to comment.