Skip to content

Commit

Permalink
Improve update history payload schema
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Jul 30, 2024
1 parent 543ad8b commit 443ff0a
Show file tree
Hide file tree
Showing 3 changed files with 42 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
17 changes: 17 additions & 0 deletions lib/galaxy/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,23 @@ 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

# Potentially deprecated fields that are registered in the deserializer
# TODO: Expose or remove?
# user_rating: Optional[int] = None
# users_shared_with: Optional[List[DecodedDatabaseIdField]] = 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 443ff0a

Please sign in to comment.