Install python packages.
pip install - requirements.txtset the following setting data in ticket_manager/settings.py
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "tickets",
"USER": "",
"PASSWORD": "",
"HOST": "",
"PORT": "5432",
}
}
CELERY_BROKER_URL = ""
CLOUDINARY_NAME = ""
CLOUDINARY_API_KEY = ""
CLOUDINARY_API_SECRET = ""
Create the Database tickets and run the command python manage.py migrate
celery -A ticket_manager worker -l INFO
`python maange.py runserver
- Create a user
curl --location 'http://localhost:8000/api/manage/user/' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "test@email.co",
"password": "TestPassowrd2024*"
}'
- Login with your
usernameandpasswordyou will received andaccessToken andrefreshToken. UseBearer <access_tokenasAuthorizationHeader.
curl --location 'http://localhost:8000/api/token/' \
--header 'Content-Type: application/json' \
--data '{
"username": "test",
"password": "TestPassowrd2024*"
}'
- Create a ticket
curl --location 'http://localhost:8000/api/manage/ticket/' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"name": "My Ticket Name",
"num_of_images": 3
}'
- Query Tickets
curl --location 'http://localhost:8000/api/manage/ticket?ticket_id=edf765b3-ea9f-4eb9-891c-691619f36ead' \
--header 'Authorization: ••••••'
Available filters:
-
ticket_id -
from_date(isoformat) -
to_date(isoformat) -
status[CREATED, IN_PROGRESS, DONE] -
Upload an image
curl --location --request PUT 'http://localhost:8000/api/manage/ticket/edf765b3-ea9f-4eb9-891c-691619f36ead/upload/' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"b64_image": "<b64_image>",
"image_name": "test.png"
}'