This commit is contained in:
rustmailer
2026-05-02 23:53:04 +08:00
parent 2d29a8111b
commit e2fb0ee39e
7 changed files with 17 additions and 11 deletions
+2 -3
View File
@@ -29,12 +29,12 @@ use bichon_core::message::tags::TagsRequest;
use bichon_core::raise_error;
use bichon_core::store::tantivy::attachment::ATTACHMENT_MANAGER;
use bichon_core::store::tantivy::model::AttachmentModel;
use bichon_core::store::tantivy::validate_facet;
use bichon_core::users::permissions::Permission;
use poem_openapi::param::Path;
use poem_openapi::payload::Json;
use poem_openapi::OpenApi;
use std::collections::HashSet;
use tantivy::schema::Facet;
pub struct AttachmentApi;
@@ -133,8 +133,7 @@ impl AttachmentApi {
) -> ApiResult<()> {
let req = req.0;
for tag in &req.tags {
Facet::from_text(tag)
.map_err(|e| raise_error!(format!("{:#?}", e), ErrorCode::InvalidParameter))?;
validate_facet(tag)?;
}
for account_id in req.updates.keys() {
+2 -3
View File
@@ -38,6 +38,7 @@ use bichon_core::raise_error;
use bichon_core::store::envelope::Envelope;
use bichon_core::store::storage::get_reader;
use bichon_core::store::tantivy::envelope::ENVELOPE_MANAGER;
use bichon_core::store::tantivy::validate_facet;
use bichon_core::users::permissions::Permission;
use poem::Body;
use poem_openapi::param::{Path, Query};
@@ -45,7 +46,6 @@ use poem_openapi::payload::{Attachment, AttachmentType, Json};
use poem_openapi::OpenApi;
use std::collections::HashMap;
use std::collections::HashSet;
use tantivy::schema::Facet;
pub struct MessageApi;
@@ -350,8 +350,7 @@ impl MessageApi {
) -> ApiResult<()> {
let req = req.0;
for tag in &req.tags {
Facet::from_text(tag)
.map_err(|e| raise_error!(format!("{:#?}", e), ErrorCode::InvalidParameter))?;
validate_facet(tag)?;
}
for account_id in req.updates.keys() {