Skip to content

Commit 5fe98d0

Browse files
committed
refactor(schema)!: rename key_prefix to key in query
1 parent 148d064 commit 5fe98d0

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

netmito/src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl MitoClient {
590590
) -> crate::error::Result<AttachmentsQueryResp> {
591591
let group_name = args.group.unwrap_or_else(|| self.username.clone());
592592
let req = AttachmentsQueryReq {
593-
key_prefix: args.key_prefix,
593+
key: args.key,
594594
count: args.count,
595595
limit: args.limit,
596596
offset: args.offset,

netmito/src/config/client/attachments.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub struct QueryAttachmentsArgs {
105105
pub group: Option<String>,
106106
/// The prefix of the key of the attachments
107107
#[arg(short, long = "key")]
108-
pub key_prefix: Option<String>,
108+
pub key: Option<String>,
109109
/// The limit of the tasks to query
110110
#[arg(long)]
111111
pub limit: Option<u64>,
@@ -137,7 +137,7 @@ pub struct DownloadAttachmentsByFilterArgs {
137137
pub group: Option<String>,
138138
/// The prefix of the key of the attachments
139139
#[arg(short, long = "key")]
140-
pub key_prefix: Option<String>,
140+
pub key: Option<String>,
141141
/// The limit of the attachments to download
142142
#[arg(long)]
143143
pub limit: Option<u64>,
@@ -183,7 +183,7 @@ pub struct DownloadAttachmentsByListArgs {
183183
impl From<QueryAttachmentsArgs> for AttachmentsQueryReq {
184184
fn from(args: QueryAttachmentsArgs) -> Self {
185185
Self {
186-
key_prefix: args.key_prefix,
186+
key: args.key,
187187
limit: args.limit,
188188
offset: args.offset,
189189
count: args.count,
@@ -194,7 +194,7 @@ impl From<QueryAttachmentsArgs> for AttachmentsQueryReq {
194194
impl From<DownloadAttachmentsByFilterArgs> for AttachmentsDownloadByFilterReq {
195195
fn from(args: DownloadAttachmentsByFilterArgs) -> Self {
196196
Self {
197-
key: args.key_prefix,
197+
key: args.key,
198198
limit: args.limit,
199199
offset: args.offset,
200200
}

netmito/src/schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub struct AttachmentMetadata {
340340

341341
#[derive(Debug, Serialize, Deserialize, Clone)]
342342
pub struct AttachmentsQueryReq {
343-
pub key_prefix: Option<String>,
343+
pub key: Option<String>,
344344
pub limit: Option<u64>,
345345
pub offset: Option<u64>,
346346
pub count: bool,

netmito/src/service/s3.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ pub async fn query_attachments_by_filter(
11071107
mut query: AttachmentsQueryReq,
11081108
) -> Result<AttachmentsQueryResp, crate::error::Error> {
11091109
check_task_list_query(user_id, pool, &group_name).await?;
1110-
let key_prefix = query.key_prefix.take().unwrap_or_default();
1110+
let key = query.key.take().unwrap_or_default();
11111111
let mut attachment_stmt = Query::select();
11121112
if query.count {
11131113
attachment_stmt.expr(Expr::col((Attachment::Entity, Attachment::Column::Id)).count());
@@ -1131,7 +1131,7 @@ pub async fn query_attachments_by_filter(
11311131
.and_where(Expr::col((Group::Entity, Group::Column::GroupName)).eq(group_name.clone()))
11321132
.and_where(
11331133
Expr::col((Attachment::Entity, Attachment::Column::Key))
1134-
.like(format!("%{key_prefix}%")),
1134+
.like(format!("%{key}%")),
11351135
);
11361136
if let Some(limit) = query.limit {
11371137
attachment_stmt.limit(limit);
@@ -1173,7 +1173,7 @@ pub async fn batch_download_attachments_by_filter(
11731173
query: AttachmentsDownloadByFilterReq,
11741174
) -> Result<AttachmentsDownloadListResp, crate::error::Error> {
11751175
let req = AttachmentsQueryReq {
1176-
key_prefix: query.key,
1176+
key: query.key,
11771177
limit: query.limit,
11781178
offset: query.offset,
11791179
count: false,

openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ components:
20592059
AttachmentsQueryReq:
20602060
type: object
20612061
properties:
2062-
key_prefix:
2062+
key:
20632063
type: string
20642064
nullable: true
20652065
description: Filter attachments by key prefix

0 commit comments

Comments
 (0)