Skip to content

DeepProgram/artetoreAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Artetore ImageHub API

Backend Of Artetore Frontend

Frontend

Setup the frontend to visualize data properly

Artetore

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

db_username = demo_username
db_password = demo_password
host = demo_mysql_database_host
port = demo_mysql_database_port
folder_arts_id = demo_ondedrive_root_folder_id
client_secret = demo_onedrive_client_secret
client_id = demo_onedrive_client_id

Features

  • Router [ /login ]

    • Takes username and password as query and validate with database and returns JWT token if successful
  • Router [ /image ]

    • get_whole_page_image function takes page number as query input and returns that page image list if available in database
    • get_group_image function takes group number as input and returns image list of that group
    • get_single_image function takes group, image_id as query input and returns a sigle high resolution image
    • total-page functon returns total page number taht can be generated by counting all image group from database
  • Router [ /admin ]

    • onedrive_connection accepts JWT token as input and returns if onedrive connection is successful or not
    • onedrive_folders accepts JWT token as input and returns folder list of onedrive folder_arts_id [ Added on .env ] folder list
    • rename_operation taskes input of item_id, new_name, JWT and returrn result of operation
    • add_folder_operation taskes input of folder_name, JWT and returrn result of operation
    • folder_delete_operation taskes input of folder_id, JWT and returrn result of operation
    • file_upload_session taskes input of folder_id, file_name, JWT and returns onedrive session url to upload on that specific folder
    • groups returns only group list from database
    • add_image_in_database_operation takes image_list, JWT token as input and return operation status
      {
      "image_list":{
          "01TX4ZA735SY5SYKPEY5HJ7XW6CC2FUBRY": {
              "all_image_id": [
                  {
                      "file_name": "steps-in-instruction-execution-by-cpu.png",
                      "file_id": "01TX4ZA77HMAJQR72NJZC2ZNJEZEK22ILO"
                      }
                  ]
                  ,
                  "group": -1,
                  "folder_name": "System"
              }
          }
      }
    • delete_image_in_database_operation takes image_list, JWT token as input and return operation status
      {
          "image_list":{
              "17": [
                  {
                      "folder_name": "System",
                      "image_id": 1,
                      "image_name":"steps-in-instruction-execution-by-cpu.png"
                  }
              ]
          }
      }
      
    • get_single_image_from_group takes group_id, image_id, JWT token and returns low resolution image
    • get_groups_with_images takes JWt token as input and returns all group lsit with images
  • Logic [ cryptography ]

    • create_jwt_access_token tkaes user_id, timedelta as input and generate a JWT andd returns it
    • get_current_user_from_jwt_token takes token as input and validate it. If validation successful returns user_id else raise HTTP Error
    • get_password_hash takes password as input and returns a encrypted password
    • verify_password takes normal password and hashed password as input and validate it if both are same or not
  • Logic [ admin ]

    • generate_onedrive_auth_url generates onedrive authentication url using client id and client secret
    • process_token_from_response_data_and_add_in_db takes response data that has refresh token and current token, user_id and add it to database
    • get_tokens_from_auth_code takes auth_code, user_id as input and generate current_token and refresh token
    • verify_login takes username and password as input and validate
    • get_new_token_from_refresh_token takes refresh_token as input and genrate new current_token and refresh_token
    • get_token_from_db takes user_id as input and get current_token and refresh_token from database and add it to local_token_dict
    • connect_onedrive connects with onedrive and returns operation result
    • get_files_from_folder takes onedrive folder_id as input and gets file_list of that folder
    • get_folders scan arts_folder_id [ From .env ] and returns all folders and file list of all children folders
    • rename_onedrive_item takes item_id, new_name as input and rename the file/folder name
    • create_folder_in_onedrive takes folder_name as input and create new folder in ondedrive arts_folder_id
    • delete_folder_from_onedrive takes folder_name as input and delete folder from ondedrive arts_folder_id
    • get_onedrive_uploading_session takes folder_id, file_name as input and generate onedrive session url and returns it
    • download_image_content takes file_id as input and download image on the server from onedrive
    • add_image_in_database takes image_list as input and generate image_info_dict and add it to database
    • generate_image_dict_for_database generate image_dict for database from byte image
    • change_image_resolution takes image_data as input and returns custom resoution image
    • convert_image_into_base64 convert byte image to base64 image
    • get_one_low_res_image_from_group takes group_id, image_id as input and get low resolution image from database
    • get_group_list_with_images get image_list from databse for each group and returns data
    • delete_image takes image_list as input and delete images from database

Screenshots

One Page Image List

App Screenshot

One Group Image List

App Screenshot

High Resolution Image

App Screenshot

Total Page

App Screenshot

Download Full Resolution Image

App Screenshot

Admin Login

App Screenshot

Connect Onedrive

App Screenshot

Onedrive Folders

App Screenshot

Rename Item

App Screenshot

Create New Folder

App Screenshot

Delete Folder

App Screenshot

Database Group List

App Screenshot

Add Image In Database

App Screenshot

Database Groups With Images

App Screenshot

Delete Image From Database

App Screenshot

Low Resolution Image

App Screenshot

Database ImageDB Schema

App Screenshot

Database ImageDB Data

App Screenshot

Database Onedrive Schema

App Screenshot

Database UserDB Schema

App Screenshot

Database UserDB Data

App Screenshot

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages