mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(opensearch): show search results only if user has access permission to the index (#5097)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Abhishek Kanojia <89402434+Abhitator216@users.noreply.github.com>
This commit is contained in:
@ -30,7 +30,9 @@ pub struct GetSearchRequestWithIndex {
|
||||
pub search_req: GetSearchRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, strum::EnumIter, Clone, serde::Deserialize, serde::Serialize, Copy)]
|
||||
#[derive(
|
||||
Debug, strum::EnumIter, Clone, serde::Deserialize, serde::Serialize, Copy, Eq, PartialEq,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SearchIndex {
|
||||
PaymentAttempts,
|
||||
@ -39,17 +41,26 @@ pub enum SearchIndex {
|
||||
Disputes,
|
||||
}
|
||||
|
||||
#[derive(Debug, strum::EnumIter, Clone, serde::Deserialize, serde::Serialize, Copy)]
|
||||
pub enum SearchStatus {
|
||||
Success,
|
||||
Failure,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GetSearchResponse {
|
||||
pub count: u64,
|
||||
pub index: SearchIndex,
|
||||
pub hits: Vec<Value>,
|
||||
pub status: SearchStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub struct OpenMsearchOutput {
|
||||
#[serde(default)]
|
||||
pub responses: Vec<OpensearchOutput>,
|
||||
pub error: Option<OpensearchErrorDetails>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
@ -74,7 +85,6 @@ pub struct OpensearchErrorDetails {
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub struct OpensearchSuccess {
|
||||
pub status: u16,
|
||||
pub hits: OpensearchHits,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user