From 83430d7a3a853632eee880cbdd629f114e977757 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 9 Feb 2023 16:23:03 +0300 Subject: auth: Reject request to join a group. * gn3/auth/authorisation/groups/models.py: Modify function to either accept or reject join requests. * gn3/auth/authorisation/groups/views.py: Provide endpoint to reject join requests. * migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py: Prevent user from applying to join the same group more than once. --- migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py | 1 + 1 file changed, 1 insertion(+) (limited to 'migrations/auth') diff --git a/migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py b/migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py index 6b06a64..ceae5ea 100644 --- a/migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py +++ b/migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py @@ -21,6 +21,7 @@ steps = [ ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (requester_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE, + UNIQUE(group_id, requester_id), CHECK (status IN ('PENDING', 'ACCEPTED', 'REJECTED')) ) WITHOUT ROWID """, -- cgit v1.2.3