Skip to content

Commit d7085d4

Browse files
codexTheSentinel454
authored andcommitted
refactor(db): move product feedback store ownership
Signed-off-by: OpenAI Codex <codex@openai.com>
1 parent 4a3e1ae commit d7085d4

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

crates/buzz-db/src/lib.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,25 +1335,6 @@ impl Db {
13351335
Ok(result.rows_affected())
13361336
}
13371337

1338-
/// Sidecar an accepted product-feedback event, idempotent by event id.
1339-
#[datastore_span(name = "insert_product_feedback", system = "postgresql")]
1340-
pub async fn insert_product_feedback(
1341-
&self,
1342-
community: CommunityId,
1343-
feedback: product_feedback::NewProductFeedback<'_>,
1344-
) -> Result<Uuid> {
1345-
product_feedback::insert(&self.pool, community, feedback).await
1346-
}
1347-
1348-
/// List product feedback across the deployment, newest first.
1349-
#[datastore_span(name = "list_product_feedback", system = "postgresql")]
1350-
pub async fn list_product_feedback(
1351-
&self,
1352-
limit: i64,
1353-
) -> Result<Vec<product_feedback::ProductFeedbackRecord>> {
1354-
product_feedback::list(&self.pool, limit).await
1355-
}
1356-
13571338
/// Insert a tenant-scoped NIP-56 report row, idempotent by report event id.
13581339
#[datastore_span(name = "insert_moderation_report", system = "postgresql")]
13591340
pub async fn insert_moderation_report(

crates/buzz-db/src/product_feedback.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
//! Feedback retains its source [`CommunityId`] as provenance, but is not a
44
//! community moderation concern and is never inserted into the events table.
55
6+
use buzz_datastore_tracing::datastore_span;
67
use chrono::{DateTime, Utc};
78
use serde::Serialize;
89
use sqlx::{PgPool, Row as _};
910
use uuid::Uuid;
1011

11-
use crate::{error::Result, CommunityId};
12+
use crate::{error::Result, CommunityId, Db};
1213

1314
/// Validated fields from an accepted product-feedback event.
1415
#[derive(Debug, Clone)]
@@ -117,6 +118,24 @@ pub async fn list(pool: &PgPool, limit: i64) -> Result<Vec<ProductFeedbackRecord
117118
.collect()
118119
}
119120

121+
impl Db {
122+
/// Sidecar an accepted product-feedback event, idempotent by event id.
123+
#[datastore_span(name = "insert_product_feedback", system = "postgresql")]
124+
pub async fn insert_product_feedback(
125+
&self,
126+
community: CommunityId,
127+
feedback: NewProductFeedback<'_>,
128+
) -> Result<Uuid> {
129+
insert(&self.pool, community, feedback).await
130+
}
131+
132+
/// List product feedback across the deployment, newest first.
133+
#[datastore_span(name = "list_product_feedback", system = "postgresql")]
134+
pub async fn list_product_feedback(&self, limit: i64) -> Result<Vec<ProductFeedbackRecord>> {
135+
list(&self.pool, limit).await
136+
}
137+
}
138+
120139
#[cfg(test)]
121140
mod tests {
122141
use super::*;

0 commit comments

Comments
 (0)