Move validators to seperate thread, other fixes (#253)

* Move validators to seperate thread, other fixes

* Update rust version in Dockerfile

* Fix notifs not working

* Fix pack validator not enforcing files
This commit is contained in:
Geometrically
2021-11-13 15:46:08 -07:00
committed by GitHub
parent 13187de97d
commit 7f791d4919
19 changed files with 257 additions and 196 deletions

View File

@@ -14,6 +14,7 @@ pub struct Loader {
pub supported_project_types: Vec<String>,
}
#[derive(Clone)]
pub struct GameVersion {
pub id: GameVersionId,
pub version: String,

View File

@@ -123,10 +123,8 @@ impl Notification {
let (notifications, actions) = futures::join!(
sqlx::query!(
"
SELECT n.user_id, n.title, n.text, n.link, n.created, n.read, n.type notification_type,
ARRAY_AGG(DISTINCT na.id || ', ' || na.title || ', ' || na.action_route || ', ' || na.action_route_method) actions
SELECT n.user_id, n.title, n.text, n.link, n.created, n.read, n.type notification_type
FROM notifications n
LEFT OUTER JOIN notifications_actions na on n.id = na.notification_id
WHERE n.id = $1
GROUP BY n.id, n.user_id;
",

View File

@@ -662,7 +662,7 @@ impl Version {
for hash in hashes? {
let entry = hashes_map
.entry(FileId(hash.file_id))
.or_insert(HashMap::new());
.or_insert_with(HashMap::new);
if let Some(raw_hash) = hash.hash {
entry.insert(hash.algorithm, raw_hash.into_bytes());
@@ -695,8 +695,8 @@ impl Version {
dependencies: dependencies?
.into_iter()
.map(|x| QueryDependency {
project_id: x.mod_dependency_id.map(|x| ProjectId(x)),
version_id: x.dependency_id.map(|x| VersionId(x)),
project_id: x.mod_dependency_id.map(ProjectId),
version_id: x.dependency_id.map(VersionId),
dependency_type: x.dependency_type,
})
.collect(),