Skip to content

Commit

Permalink
Add delete all route for 'send items', 'inbox' and 'outbox'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizcko committed Oct 23, 2024
1 parent 27eae66 commit 8951fa9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ build:
- docker buildx version
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD
- echo $IMAGE_NAME:$CI_COMMIT_TAG
- sed -i "s/version='[^']*'/version='$CI_COMMIT_TAG'/" "$CI_PROJECT_DIR/src/server/instance.py"
script:
- |-
docker buildx create --use
Expand Down
13 changes: 13 additions & 0 deletions src/resources/v1/inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,16 @@ def delete(self, id: int):
session.delete(sms)

return {'results': 'ok'}, 204

@ns.route('/v1/inbox/all')
class InboxALL(Resource):
@ns.doc(description='Delete all SMS located in the inbox')
@ns.response(204, 'Success')
@required_bearerAuth(environment_config["require_bearer"])
@required_basicAuth(environment_config["require_basic"])
def delete(self):
''' Delete all SMS located in the inbox'''
with get_session() as session:
sms = session.query(inbox).delete()

return {'results': 'ok'}, 204
13 changes: 13 additions & 0 deletions src/resources/v1/outbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,16 @@ def delete(self, id: int):
session.delete(sms)

return {'results': 'ok'}, 204

@ns.route('/v1/outbox/all')
class OutboxALL(Resource):
@ns.doc(description='Delete all SMS located in the outbox')
@ns.response(204, 'Success')
@required_bearerAuth(environment_config["require_bearer"])
@required_basicAuth(environment_config["require_basic"])
def delete(self):
''' Delete all SMS located in the outbox'''
with get_session() as session:
sms = session.query(outbox).delete()

return {'results': 'ok'}, 204
13 changes: 13 additions & 0 deletions src/resources/v1/sentitems.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,16 @@ def delete(self, id: int):
session.delete(sms)

return {'results': 'ok'}, 204

@ns.route('/v1/sentitems/all')
class SendItemsALL(Resource):
@ns.doc(description='Delete all SMS located in the send items')
@ns.response(204, 'Success')
@required_bearerAuth(environment_config["require_bearer"])
@required_basicAuth(environment_config["require_basic"])
def delete(self):
''' Delete all SMS located in the send items'''
with get_session() as session:
sms = session.query(sentitems).delete()

return {'results': 'ok'}, 204

0 comments on commit 8951fa9

Please sign in to comment.