Revert schema changes in backend

Let's do this on dev, after we evaluate what to improve.
This commit is contained in:
davelopez
2024-03-27 13:27:23 +01:00
parent 6b466505d6
commit d3e9c3b218
2 changed files with 34 additions and 243 deletions
-180
View File
@@ -2232,16 +2232,6 @@ export interface components {
* @description Whether this item is marked as deleted.
*/
deleted: boolean;
/**
* Encoded Email
* @description Encoded owner email.
*/
email_hash?: string | null;
/**
* Empty
* @description Whether this history is empty.
*/
empty: boolean;
/**
* Export Record Data
* @description The export record data associated with this archived history. Used to recover the history.
@@ -2253,11 +2243,6 @@ export interface components {
* @default ?
*/
genome_build?: string | null;
/**
* HID Counter
* @description The current HID counter for this History.
*/
hid_counter: number;
/**
* History ID
* @example 0123456789ABCDEF
@@ -3644,26 +3629,11 @@ export interface components {
* @description Whether this item is marked as deleted.
*/
deleted?: boolean | null;
/**
* Encoded Email
* @description Encoded owner email.
*/
email_hash?: string | null;
/**
* Empty
* @description Whether this history is empty.
*/
empty?: boolean | null;
/**
* Genome Build
* @description TODO
*/
genome_build?: string | null;
/**
* HID Counter
* @description The current HID counter for this History.
*/
hid_counter?: number | null;
/**
* History ID
* @example 0123456789ABCDEF
@@ -7015,27 +6985,12 @@ export interface components {
* @description Whether this item is marked as deleted.
*/
deleted: boolean;
/**
* Encoded Email
* @description Encoded owner email.
*/
email_hash?: string | null;
/**
* Empty
* @description Whether this history is empty.
*/
empty: boolean;
/**
* Genome Build
* @description TODO
* @default ?
*/
genome_build?: string | null;
/**
* HID Counter
* @description The current HID counter for this History.
*/
hid_counter: number;
/**
* History ID
* @example 0123456789ABCDEF
@@ -7130,127 +7085,6 @@ export interface components {
*/
username_and_slug?: string | null;
};
/**
* HistoryDevDetailed
* @description View used by the client to display "some" detailed history information.
*
* Currently used by the `HistoryController` endpoints.
*/
HistoryDevDetailed: {
/**
* Annotation
* @description An annotation to provide details or to help understand the purpose and usage of this item.
*/
annotation: string | null;
/**
* Archived
* @description Whether this item has been archived and is no longer active.
*/
archived: boolean;
/** Contents Active */
contents_active: components["schemas"]["HistoryActiveContentCounts"];
/**
* Contents URL
* @description The relative URL to access the contents of this History.
*/
contents_url: string;
/**
* Count
* @description The number of items in the history.
*/
count: number;
/**
* Create Time
* Format: date-time
* @description The time and date this item was created.
*/
create_time: string;
/**
* Deleted
* @description Whether this item is marked as deleted.
*/
deleted: boolean;
/**
* Genome Build
* @description TODO
* @default ?
*/
genome_build?: string | null;
/**
* HID Counter
* @description The current HID counter for this History.
*/
hid_counter: number;
/**
* History ID
* @example 0123456789ABCDEF
*/
id: string;
/**
* Importable
* @description Whether this History can be imported by other users with a shared link.
*/
importable: boolean;
/**
* Model class
* @description The name of the database model class.
* @constant
*/
model_class: "History";
/**
* Name
* @description The name of the history.
*/
name: string;
/**
* Preferred Object Store ID
* @description The ID of the object store that should be used to store new datasets in this history.
*/
preferred_object_store_id?: string | null;
/**
* Published
* @description Whether this resource is currently publicly available to all users.
*/
published: boolean;
/**
* Purged
* @description Whether this item has been permanently removed.
*/
purged: boolean;
/**
* Size
* @description The total size of the contents of this history in bytes.
*/
size: number;
/**
* Slug
* @description Part of the URL to uniquely identify this History by link in a readable way.
*/
slug?: string | null;
tags: components["schemas"]["TagCollection"];
/**
* Update Time
* Format: date-time
* @description The last time and date this item was updated.
*/
update_time: string;
/**
* URL
* @deprecated
* @description The relative URL to access this item.
*/
url: string;
/**
* User ID
* @description The encoded ID of the user that owns this History.
*/
user_id?: string | null;
/**
* Username and slug
* @description The relative URL in the form of /u/{username}/h/{slug}
*/
username_and_slug?: string | null;
};
/**
* HistorySummary
* @description History summary information.
@@ -15758,7 +15592,6 @@ export interface operations {
content: {
"application/json": (
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"]
)[];
@@ -15801,7 +15634,6 @@ export interface operations {
"application/json":
| components["schemas"]["JobImportHistoryResponse"]
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -15888,7 +15720,6 @@ export interface operations {
content: {
"application/json": (
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"]
)[];
@@ -15927,7 +15758,6 @@ export interface operations {
content: {
"application/json": (
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"]
)[];
@@ -15996,7 +15826,6 @@ export interface operations {
content: {
"application/json": (
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"]
)[];
@@ -16034,7 +15863,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -16072,7 +15900,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -16133,7 +15960,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -16176,7 +16002,6 @@ export interface operations {
content: {
"application/json": (
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"]
)[];
@@ -16220,7 +16045,6 @@ export interface operations {
content: {
"application/json": (
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"]
)[];
@@ -16258,7 +16082,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -16300,7 +16123,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -16343,7 +16165,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
@@ -16438,7 +16259,6 @@ export interface operations {
content: {
"application/json":
| components["schemas"]["CustomHistoryView"]
| components["schemas"]["HistoryDevDetailed"]
| components["schemas"]["HistoryDetailed"]
| components["schemas"]["HistorySummary"];
};
+34 -63
View File
@@ -1303,44 +1303,6 @@ class HistorySummary(Model, WithModelClass):
preferred_object_store_id: Optional[str] = PreferredObjectStoreIdField
class HistoryCommonDetailed(HistorySummary):
"""Common detailed information provided by a History."""
contents_url: ContentsUrlField
size: int = Field(
...,
title="Size",
description="The total size of the contents of this history in bytes.",
)
user_id: Optional[EncodedDatabaseIdField] = Field(
None,
title="User ID",
description="The encoded ID of the user that owns this History.",
)
create_time: datetime = CreateTimeField
importable: bool = Field(
...,
title="Importable",
description="Whether this History can be imported by other users with a shared link.",
)
slug: Optional[str] = Field(
None,
title="Slug",
description="Part of the URL to uniquely identify this History by link in a readable way.",
)
username_and_slug: Optional[str] = Field(
None,
title="Username and slug",
description="The relative URL in the form of /u/{username}/h/{slug}",
)
genome_build: Optional[str] = GenomeBuildField
hid_counter: int = Field(
...,
title="HID Counter",
description="The current HID counter for this History.",
)
class HistoryActiveContentCounts(Model):
"""Contains the number of active, deleted or hidden items in a History."""
@@ -1369,24 +1331,42 @@ HistoryContentStates = Union[DatasetState, DatasetCollectionPopulatedState]
HistoryContentStateCounts = Dict[HistoryContentStates, int]
class HistoryDetailed(HistoryCommonDetailed):
class HistoryDetailed(HistorySummary): # Equivalent to 'dev-detailed' view, which seems the default
"""History detailed information."""
email_hash: Optional[str] = Field(
None,
title="Encoded Email",
description="Encoded owner email.",
)
empty: bool = Field(
contents_url: ContentsUrlField
size: int = Field(
...,
title="Empty",
description="Whether this history is empty.",
title="Size",
description="The total size of the contents of this history in bytes.",
)
user_id: Optional[EncodedDatabaseIdField] = Field(
None,
title="User ID",
description="The encoded ID of the user that owns this History.",
)
create_time: datetime = CreateTimeField
importable: bool = Field(
...,
title="Importable",
description="Whether this History can be imported by other users with a shared link.",
)
slug: Optional[str] = Field(
None,
title="Slug",
description="Part of the URL to uniquely identify this History by link in a readable way.",
)
username: Optional[str] = Field(
None,
title="Username",
description="Owner of the history",
)
username_and_slug: Optional[str] = Field(
None,
title="Username and slug",
description="The relative URL in the form of /u/{username}/h/{slug}",
)
genome_build: Optional[str] = GenomeBuildField
state: DatasetState = Field(
...,
title="State",
@@ -1410,21 +1390,8 @@ class HistoryDetailed(HistoryCommonDetailed):
)
class HistoryDevDetailed(HistoryCommonDetailed):
"""View used by the client to display "some" detailed history information.
Currently used by the `HistoryController` endpoints.
"""
contents_active: HistoryActiveContentCounts = Field(
...,
title="Contents Active",
description=("Contains the number of active, deleted or hidden items in a History."),
)
@partial_model()
class CustomHistoryView(HistoryDetailed, HistoryDevDetailed):
class CustomHistoryView(HistoryDetailed):
"""History Response with all optional fields.
It is used for serializing only specific attributes using the "keys"
@@ -1432,7 +1399,12 @@ class CustomHistoryView(HistoryDetailed, HistoryDevDetailed):
will be requested, so we have to allow all fields to be optional.
"""
# Define a few more useful fields to be optional that are not part of other views
# Define a few more useful fields to be optional that are not part of HistoryDetailed
contents_active: Optional[HistoryActiveContentCounts] = Field(
default=None,
title="Contents Active",
description=("Contains the number of active, deleted or hidden items in a History."),
)
contents_states: Optional[HistoryContentStateCounts] = Field(
default=None,
title="Contents States",
@@ -1448,7 +1420,6 @@ class CustomHistoryView(HistoryDetailed, HistoryDevDetailed):
AnyHistoryView = Annotated[
Union[
CustomHistoryView,
HistoryDevDetailed,
HistoryDetailed,
HistorySummary,
],