Tag fetching and caching (#59)

* basic framework. still has errors

* added functionality for main endpoints + some structuring

* formatting

* unused code

* mimicked CLI function with wait_for process

* added basic auth bindings

* made PR changes, added playground

* cargo fmt

* removed missed println

* misc tests fixes

* cargo fmt

* added windows support

* cargo fmt

* all OS use dunce

* restructured profile slightly; fixed mac bug

* profile changes, new main.rs

* fixed requested pr + canonicaliation bug

* fixed regressed bug in ui

* fixed regressed bugs

* fixed git error

* typo

* ran prettier

* clippy

* playground clippy

* ported profile loading fix

* profile change for real, url println and clippy

* PR changes

* auth bindings + semisynch flow

* fixed dropping task error

* prettier, eslint, clippy

* removed debugging modifications

* removed unused function that eslinter missed :(

* initial errored push

* working draft

* added tag system!

* fixed merge issue

---------

Co-authored-by: Wyatt <wyatt@modrinth.com>
This commit is contained in:
Wyatt Verchere
2023-04-03 16:08:53 -07:00
committed by GitHub
parent a13b7a2566
commit b0c830119b
9 changed files with 436 additions and 2 deletions

View File

@@ -3,9 +3,9 @@ use serde::{Serialize, Serializer};
use thiserror::Error;
pub mod auth;
pub mod profile;
pub mod profile_create;
pub mod tags;
pub mod settings;
pub type Result<T> = std::result::Result<T, TheseusGuiError>;

View File

@@ -0,0 +1,47 @@
use crate::api::Result;
use theseus::tags::{
Category, DonationPlatform, GameVersion, License, Loader, TagBundle,
};
/// Gets cached category tags from the database
#[tauri::command]
pub async fn tags_get_category_tags() -> Result<Vec<Category>> {
Ok(theseus::tags::get_category_tags().await?)
}
/// Gets cached report type tags from the database
#[tauri::command]
pub async fn tags_get_report_type_tags() -> Result<Vec<String>> {
Ok(theseus::tags::get_report_type_tags().await?)
}
/// Gets cached loader tags from the database
#[tauri::command]
pub async fn tags_get_loader_tags() -> Result<Vec<Loader>> {
Ok(theseus::tags::get_loader_tags().await?)
}
/// Gets cached game version tags from the database
#[tauri::command]
pub async fn tags_get_game_version_tags() -> Result<Vec<GameVersion>> {
Ok(theseus::tags::get_game_version_tags().await?)
}
/// Gets cached license tags from the database
#[tauri::command]
pub async fn tags_get_license_tags() -> Result<Vec<License>> {
Ok(theseus::tags::get_license_tags().await?)
}
/// Gets cached donation platform tags from the database
#[tauri::command]
pub async fn tags_get_donation_platform_tags() -> Result<Vec<DonationPlatform>>
{
Ok(theseus::tags::get_donation_platform_tags().await?)
}
/// Gets cached tag bundle from the database
#[tauri::command]
pub async fn tags_get_tag_bundle() -> Result<TagBundle> {
Ok(theseus::tags::get_tag_bundle().await?)
}