Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Struct: Flask DataBase:Tencent Cloud SQL External API: https://poetrydb.org/author Supported by Github

DataBase: Poetry 3 tables: Users: administrator:admin, other users should be added by admin Roles: admin: add and delete users and common user's root user: can only add or update poetry to database Poetry:user can add queried poetry to database

Model.py def generate_auth_token(self): payload = { "id": self.id, "exp": int(time.time()) + current_app.config['TOKEN_TIME'], } token = jwt.encode(payload, current_app.config['SECRET_KEY'], algorithm='HS256') return token

hash encryption

Main Function:

def check_login(fun): check the users occur in database with token generated by jwt

@main.route('/api/login', methods=['POST']) def login(): users connect to our database

@main.route('/api/add/user', methods=['POST']) def add_user(user): admin can add new users to database

@main.route('/api/could_add', methods=['GET']) def could_add(): users can find authors who occur in poetry.com

@main.route('/api/add', methods=['POST']) def add(user): users can add queried poetry to database

@main.route('/api/delete', methods=['POST']) def delete(user): admin delete users from database

@main.route('/api/update', methods=['POST']) def update(user): Users can update their information in database or operated by admin

@main.route('/api/query/author', methods=['GET']) def query_author(): Users can query poetry by the author texted

@main.route('/api/query', methods=['GET']) def query(): Users get all information from poetry.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages