Skip to main content

systemprompt_content/models/
search.rs

1//! Content search parameter and result types.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use serde::{Deserialize, Serialize};
7use systemprompt_identifiers::{CategoryId, ContentId, SourceId};
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct SearchRequest {
11    pub query: String,
12    pub filters: Option<SearchFilters>,
13    pub limit: Option<i64>,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct SearchFilters {
18    pub category_id: Option<CategoryId>,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
22pub struct SearchResult {
23    pub id: ContentId,
24    pub slug: String,
25    pub title: String,
26    pub description: String,
27    pub image: Option<String>,
28    pub view_count: i64,
29    pub source_id: SourceId,
30    pub category_id: Option<CategoryId>,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct SearchResponse {
35    pub results: Vec<SearchResult>,
36    pub total: usize,
37}