You've already forked AstralRinth
forked from didirus/AstralRinth
Misc v3 linear tasks (#767)
* v3_reroute 404 error * hash change * fixed issue with error conversion * added new model confirmation tests + title name change * renaming, fields * owner; test changes * clippy prepare * fmt * merge fixes * clippy * working merge * revs * merge fixes
This commit is contained in:
@@ -16,7 +16,7 @@ pub struct Organization {
|
||||
pub id: OrganizationId,
|
||||
|
||||
/// The title (and slug) of the organization
|
||||
pub title: String,
|
||||
pub name: String,
|
||||
|
||||
/// The associated team of the organization
|
||||
pub team_id: TeamId,
|
||||
@@ -36,11 +36,11 @@ impl Organization {
|
||||
) -> Result<(), super::DatabaseError> {
|
||||
sqlx::query!(
|
||||
"
|
||||
INSERT INTO organizations (id, title, team_id, description, icon_url, color)
|
||||
INSERT INTO organizations (id, name, team_id, description, icon_url, color)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
",
|
||||
self.id.0,
|
||||
self.title,
|
||||
self.name,
|
||||
self.team_id as TeamId,
|
||||
self.description,
|
||||
self.icon_url,
|
||||
@@ -149,7 +149,7 @@ impl Organization {
|
||||
{
|
||||
remaining_strings.retain(|x| {
|
||||
&to_base62(organization.id.0 as u64) != x
|
||||
&& organization.title.to_lowercase() != x.to_lowercase()
|
||||
&& organization.name.to_lowercase() != x.to_lowercase()
|
||||
});
|
||||
found_organizations.push(organization);
|
||||
continue;
|
||||
@@ -166,9 +166,9 @@ impl Organization {
|
||||
|
||||
let organizations: Vec<Organization> = sqlx::query!(
|
||||
"
|
||||
SELECT o.id, o.title, o.team_id, o.description, o.icon_url, o.color
|
||||
SELECT o.id, o.name, o.team_id, o.description, o.icon_url, o.color
|
||||
FROM organizations o
|
||||
WHERE o.id = ANY($1) OR LOWER(o.title) = ANY($2)
|
||||
WHERE o.id = ANY($1) OR LOWER(o.name) = ANY($2)
|
||||
GROUP BY o.id;
|
||||
",
|
||||
&organization_ids_parsed,
|
||||
@@ -181,7 +181,7 @@ impl Organization {
|
||||
.try_filter_map(|e| async {
|
||||
Ok(e.right().map(|m| Organization {
|
||||
id: OrganizationId(m.id),
|
||||
title: m.title,
|
||||
name: m.name,
|
||||
team_id: TeamId(m.team_id),
|
||||
description: m.description,
|
||||
icon_url: m.icon_url,
|
||||
@@ -203,7 +203,7 @@ impl Organization {
|
||||
redis
|
||||
.set(
|
||||
ORGANIZATIONS_TITLES_NAMESPACE,
|
||||
&organization.title.to_lowercase(),
|
||||
&organization.name.to_lowercase(),
|
||||
&organization.id.0.to_string(),
|
||||
None,
|
||||
)
|
||||
@@ -226,7 +226,7 @@ impl Organization {
|
||||
{
|
||||
let result = sqlx::query!(
|
||||
"
|
||||
SELECT o.id, o.title, o.team_id, o.description, o.icon_url, o.color
|
||||
SELECT o.id, o.name, o.team_id, o.description, o.icon_url, o.color
|
||||
FROM organizations o
|
||||
LEFT JOIN mods m ON m.organization_id = o.id
|
||||
WHERE m.id = $1
|
||||
@@ -240,7 +240,7 @@ impl Organization {
|
||||
if let Some(result) = result {
|
||||
Ok(Some(Organization {
|
||||
id: OrganizationId(result.id),
|
||||
title: result.title,
|
||||
name: result.name,
|
||||
team_id: TeamId(result.team_id),
|
||||
description: result.description,
|
||||
icon_url: result.icon_url,
|
||||
@@ -279,7 +279,7 @@ impl Organization {
|
||||
super::project_item::Project::remove(project_id, transaction, redis).await?;
|
||||
}
|
||||
|
||||
Organization::clear_cache(id, Some(organization.title), redis).await?;
|
||||
Organization::clear_cache(id, Some(organization.name), redis).await?;
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user