diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30ce2b1..db2c850 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/src/resources/v1/inbox.py b/src/resources/v1/inbox.py index 4efcd76..b8db579 100644 --- a/src/resources/v1/inbox.py +++ b/src/resources/v1/inbox.py @@ -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 \ No newline at end of file diff --git a/src/resources/v1/outbox.py b/src/resources/v1/outbox.py index 1591c37..61387d0 100644 --- a/src/resources/v1/outbox.py +++ b/src/resources/v1/outbox.py @@ -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 \ No newline at end of file diff --git a/src/resources/v1/sentitems.py b/src/resources/v1/sentitems.py index 8cdd4a8..3a6e124 100644 --- a/src/resources/v1/sentitems.py +++ b/src/resources/v1/sentitems.py @@ -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 \ No newline at end of file