Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve update history payload schema #18618

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12397,6 +12397,26 @@ export interface components {
visible?: boolean | null;
[key: string]: unknown;
};
/** UpdateHistoryPayload */
UpdateHistoryPayload: {
/** Annotation */
annotation?: string | null;
/** Deleted */
deleted?: boolean | null;
/** Genome Build */
genome_build?: string | null;
/** Importable */
importable?: boolean | null;
/** Name */
name?: string | null;
/** Preferred Object Store Id */
preferred_object_store_id?: string | null;
/** Published */
published?: boolean | null;
/** Purged */
purged?: boolean | null;
tags?: components["schemas"]["TagCollection"] | null;
};
/** UpdateInstancePayload */
UpdateInstancePayload: {
/** Active */
Expand Down Expand Up @@ -17588,7 +17608,7 @@ export interface operations {
};
requestBody: {
content: {
"application/json": unknown;
"application/json": components["schemas"]["UpdateHistoryPayload"];
};
};
responses: {
Expand Down
12 changes: 12 additions & 0 deletions lib/galaxy/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,18 @@ class CustomHistoryView(HistoryDetailed):
]


class UpdateHistoryPayload(Model):
name: Optional[str] = None
annotation: Optional[str] = None
tags: Optional[TagCollection] = None
published: Optional[bool] = None
importable: Optional[bool] = None
deleted: Optional[bool] = None
purged: Optional[bool] = None
genome_build: Optional[str] = None
preferred_object_store_id: Optional[str] = None


class ExportHistoryArchivePayload(Model):
gzip: Optional[bool] = Field(
default=True,
Expand Down
6 changes: 4 additions & 2 deletions lib/galaxy/webapps/galaxy/api/histories.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
ShareWithPayload,
SharingStatus,
StoreExportPayload,
UpdateHistoryPayload,
WriteStoreToPayload,
)
from galaxy.schema.types import LatestLiteral
Expand Down Expand Up @@ -457,13 +458,14 @@ def update(
self,
history_id: HistoryIDPathParam,
trans: ProvidesHistoryContext = DependsOnTrans,
payload: Any = Body(
payload: UpdateHistoryPayload = Body(
...,
description="Object containing any of the editable fields of the history.",
),
serialization_params: SerializationParams = Depends(query_serialization_params),
) -> AnyHistoryView:
return self.service.update(trans, history_id, payload, serialization_params)
data = payload.model_dump(exclude_unset=True)
return self.service.update(trans, history_id, data, serialization_params)

@router.post(
"/api/histories/from_store",
Expand Down
Loading