-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added student/accept-invitation, tutor/profile apis
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/resources/db/migration/V1.8__add_user_api_resources.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
do | ||
$$ | ||
DECLARE | ||
get_tutor_profile integer; | ||
post_tutor_profile integer; | ||
accept_invite integer; | ||
tutor integer; | ||
student integer; | ||
BEGIN | ||
|
||
-- Api Resource | ||
|
||
INSERT INTO qms_auth.api_resource(method, path) | ||
VALUES( 'GET', '/users/tutor/profile'); | ||
|
||
INSERT INTO qms_auth.api_resource(method, path) | ||
VALUES( 'POST', '/users/tutor/profile'); | ||
|
||
INSERT INTO qms_auth.api_resource(method, path) | ||
VALUES( 'POST', '/student/accept-invitation'); | ||
|
||
-- Grants | ||
SELECT id into get_tutor_profile FROM qms_auth.api_resource WHERE path = '/users/tutor/profile' and method = 'GET'; | ||
SELECT id into post_tutor_profile FROM qms_auth.api_resource WHERE path = '/users/tutor/profile' and method = 'POST'; | ||
SELECT id into accept_invite FROM qms_auth.api_resource WHERE path = '/student/accept-invitation' and method = 'POST'; | ||
|
||
select id into tutor FROM qms_auth.role where name = 'tutor'; | ||
select id into student FROM qms_auth.role where name = 'student'; | ||
|
||
/*generate question from ai*/ | ||
INSERT INTO qms_auth.role_api_resource(resource_id, role_id) | ||
VALUES( get_tutor_profile, tutor); | ||
INSERT INTO qms_auth.role_api_resource(resource_id, role_id) | ||
VALUES(post_tutor_profile, tutor); | ||
INSERT INTO qms_auth.role_api_resource(resource_id, role_id) | ||
VALUES(accept_invite, student); | ||
|
||
END; | ||
$$; |