This is a ticketing service using tornado framework.
Tornado version : 5.1.1
Torndb version : 0.3
Author : Mohammad Ali Poorafsahi
- python
- mysql
$ apt install python mysql
$ git clone https://github.com/MohammadAliAfsahi/TicketingService.git $ cd ticketing_project
check if mysql service is running using following command:
$ service mysql status
if mysql is running you're free to skip, if not use following command in order to start mysql service:
$ service mysql start
run following command as a user that has root privillege or a user that can create database(you can change root to desired user):
$ mysql -u root
mysql> CREATE DATABASE ticket;
Allow the "ticket" user to connect with the password "ticket":
mysql> GRANT ALL PRIVILEGES ON ticket.* TO 'ticket'@'localhost' IDENTIFIED BY 'ticket';
mysql> use ticket;
mysql> CREATE TABLE user ( id smallint unsigned not null auto_increment, username varchar(20) not null, password varchar(20) not null,firstname varchar(20),lastname varchar(20),apitoken varchar(100), admin BOOLEAN NOT NULL,constraint pk_example primary key (id));
mysql> CREATE TABLE tickets ( id smallint unsigned not null auto_increment, subject varchar(50) not null,body varchar(500) NOT NULL, status VARCHAR(20) NOT NULL, userid INT NOT NULL, date DATETIME DEFAULT CURRENT_TIMESTAMP, response VARCHAR(500),constraint pk_example primary key (id) );
if you want to give a specific user admin privilege you need to do it manully in mysql database using following command:
mysql> update user set admin=1 where id = userid
you need to replace userid in where clause with id of user you want to become admin.
$ python server/server.py
There is a .mp4 file in this page which you can see how to use this project. For both POST and GET method running codes are the same(the difference is in implementation).
The main features are:
- login
- signup
- logout
- Sending ticket
- Get tickets (user privilege)
- Close ticket(user privilege)
- Change status of ticket (admin privilege)
- Response to ticket (admin privilege)
- Get tickets (admin privilege)
This project supports both POST and GET methods.
In order to run client code you need request module which is pre-installed in python but if not use following command:
$ pip install requests
$ python client/client-get.py
or
$ python client/client-post.py
- Telegram : @MohammadAliAfsahi
- gmail : [email protected]