2222
2323@blueprint .route ('' , methods = ['GET' ])
2424@login_required
25- def list_all ():
25+ def list_all_one_on_one ():
2626 return one_on_one_schema .jsonify (OneOnOne .get_by_user (current_user ), many = True )
2727
2828
2929@blueprint .route ('' , methods = ['PUT' ])
3030@login_required
31- def create ():
31+ def create_one_on_one ():
3232 if not request .is_json :
3333 return bad_request ()
3434
@@ -47,7 +47,7 @@ def create():
4747
4848@blueprint .route ('/<_id>' , methods = ['GET' ])
4949@login_required
50- def get (_id : int ):
50+ def get_one_on_one (_id : int ):
5151 one_on_one = OneOnOne .get (_id )
5252
5353 if not one_on_one :
@@ -59,9 +59,26 @@ def get(_id: int):
5959 return get_one_on_one_schema .jsonify (one_on_one )
6060
6161
62+ @login_required
63+ @blueprint .route ('/<_id>' , methods = ['DELETE' ])
64+ def delete_one_on_one (_id : int ):
65+ one_on_one = OneOnOne .get (_id )
66+
67+ if not one_on_one :
68+ return not_found ()
69+
70+ if not acl .can_delete_one_on_one (one_on_one ):
71+ return unauthorized ()
72+
73+ with transaction ():
74+ db .session .remove (one_on_one )
75+
76+ return no_content ()
77+
78+
6279@blueprint .route ('/<one_on_one_id>/action_items' , methods = ['GET' ])
6380@login_required
64- def get_action_items (one_on_one_id : int ):
81+ def list_action_items (one_on_one_id : int ):
6582 one_on_one = OneOnOne .get (one_on_one_id )
6683
6784 if not one_on_one :
@@ -173,20 +190,3 @@ def edit_action_item(one_on_one_id: int, action_item_id: int):
173190 return one_on_one_action_item_schema .jsonify (action_item )
174191 except ValidationError as e :
175192 return validation_error (e .messages )
176-
177-
178- @blueprint .route ('/<_id>' , methods = ['DELETE' ])
179- @login_required
180- def delete_one_on_one (_id : int ):
181- one_on_one = OneOnOne .get (_id )
182-
183- if not one_on_one :
184- return not_found ()
185-
186- if not acl .can_delete_one_on_one (one_on_one ):
187- return unauthorized ()
188-
189- with transaction ():
190- db .session .remove (one_on_one )
191-
192- return no_content ()
0 commit comments