Skip to content

Commit

Permalink
Merge pull request #18618 from davelopez/improve_update_history_paylo…
Browse files Browse the repository at this point in the history
…ad_schema

Improve update history payload schema
  • Loading branch information
bgruening authored Jul 31, 2024
2 parents ffc810c + 1bb3fdf commit a716782
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
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

0 comments on commit a716782

Please sign in to comment.