backend: correspondents

This commit is contained in:
2025-10-14 23:20:42 +02:00
parent 32432026db
commit 4c36ea2e9a
10 changed files with 671 additions and 8 deletions
+40
View File
@@ -188,6 +188,46 @@ pub struct NewDocumentTag {
pub assigned_by: Option<Uuid>,
}
#[derive(Debug, Clone, Queryable, Identifiable)]
#[diesel(table_name = correspondents)]
pub struct Correspondent {
pub id: Uuid,
pub name: String,
pub metadata: serde_json::Value,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
}
#[derive(Debug, Insertable)]
#[diesel(table_name = correspondents)]
pub struct NewCorrespondent {
pub id: Uuid,
pub name: String,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Queryable, Associations)]
#[diesel(table_name = document_correspondents)]
#[diesel(belongs_to(Document))]
#[diesel(belongs_to(Correspondent))]
#[diesel(primary_key(document_id, correspondent_id, role))]
pub struct DocumentCorrespondent {
pub document_id: Uuid,
pub correspondent_id: Uuid,
pub role: String,
pub assigned_at: NaiveDateTime,
pub assigned_by: Option<Uuid>,
}
#[derive(Debug, Insertable)]
#[diesel(table_name = document_correspondents)]
pub struct NewDocumentCorrespondent {
pub document_id: Uuid,
pub correspondent_id: Uuid,
pub role: String,
pub assigned_by: Option<Uuid>,
}
#[derive(Debug, Clone, Queryable, Identifiable, Associations)]
#[diesel(table_name = refresh_tokens)]
#[diesel(belongs_to(User))]