Skip to content
216 changes: 165 additions & 51 deletions opengeodeweb_back_schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,83 @@
"additionalProperties": false
}
},
"time_series_missing_files": {
"$id": "opengeodeweb_back/time_series_missing_files",
"route": "/time_series_missing_files",
"methods": [
"POST"
],
"type": "object",
"properties": {
"filename": {
"type": "string",
"minLength": 1
}
},
"required": [
"filename"
],
"additionalProperties": false,
"response": {
"type": "object",
"properties": {
"has_missing_files": {
"type": "boolean"
},
"mandatory_files": {
"type": "array",
"items": {
"type": "string"
}
},
"additional_files": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"has_missing_files",
"mandatory_files",
"additional_files"
],
"additionalProperties": false
}
},
"time_series_allowed_objects": {
"$id": "opengeodeweb_back/time_series_allowed_objects",
"route": "/time_series_allowed_objects",
"methods": [
"POST"
],
"type": "object",
"properties": {
"filename": {
"type": "string",
"minLength": 1
}
},
"required": [
"filename"
],
"additionalProperties": false,
"response": {
"type": "object",
"properties": {
"allowed_objects": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"allowed_objects"
],
"additionalProperties": false
}
},
"texture_coordinates": {
"$id": "opengeodeweb_back/texture_coordinates",
"route": "/texture_coordinates",
Expand Down Expand Up @@ -1488,55 +1565,6 @@
"additionalProperties": false
}
},
"missing_files": {
"$id": "opengeodeweb_back/missing_files",
"route": "/missing_files",
"methods": [
"POST"
],
"type": "object",
"properties": {
"geode_object_type": {
"type": "string",
"minLength": 1
},
"filename": {
"type": "string",
"minLength": 1
}
},
"required": [
"geode_object_type",
"filename"
],
"additionalProperties": false,
"response": {
"type": "object",
"properties": {
"has_missing_files": {
"type": "boolean"
},
"mandatory_files": {
"type": "array",
"items": {
"type": "string"
}
},
"additional_files": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"has_missing_files",
"mandatory_files",
"additional_files"
],
"additionalProperties": false
}
},
"kill": {
"$id": "opengeodeweb_back/kill",
"route": "/kill",
Expand Down Expand Up @@ -1823,6 +1851,55 @@
"additionalProperties": false
}
},
"data_missing_files": {
"$id": "opengeodeweb_back/data_missing_files",
"route": "/data_missing_files",
"methods": [
"POST"
],
"type": "object",
"properties": {
"geode_object_type": {
"type": "string",
"minLength": 1
},
"filename": {
"type": "string",
"minLength": 1
}
},
"required": [
"geode_object_type",
"filename"
],
"additionalProperties": false,
"response": {
"type": "object",
"properties": {
"has_missing_files": {
"type": "boolean"
},
"mandatory_files": {
"type": "array",
"items": {
"type": "string"
}
},
"additional_files": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"has_missing_files",
"mandatory_files",
"additional_files"
],
"additionalProperties": false
}
},
"cell_attribute_names": {
"$id": "opengeodeweb_back/cell_attribute_names",
"route": "/cell_attribute_names",
Expand Down Expand Up @@ -1907,6 +1984,36 @@
"additionalProperties": false
}
},
"apply_time_series": {
"$id": "opengeodeweb_back/apply_time_series",
"route": "/apply_time_series",
"methods": [
"POST"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 32,
"maxLength": 32
},
"filename": {
"type": "string",
"minLength": 1
}
},
"required": [
"id",
"filename"
],
"additionalProperties": false,
"response": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
},
"allowed_objects": {
"$id": "opengeodeweb_back/allowed_objects",
"route": "/allowed_objects",
Expand Down Expand Up @@ -1966,15 +2073,22 @@
"response": {
"type": "object",
"properties": {
"extensions": {
"data_extensions": {
"type": "array",
"items": {
"type": "string"
}
},
"time_series_extensions": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"extensions"
"data_extensions",
"time_series_extensions"
],
"additionalProperties": false
}
Expand Down
56 changes: 43 additions & 13 deletions opengeodeweb_back_typed_schemas.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,24 @@ export interface UploadFileResponse {
message: string;
}

export interface TimeSeriesMissingFilesParams {
filename: string;
}

export interface TimeSeriesMissingFilesResponse {
additional_files: string[];
has_missing_files: boolean;
mandatory_files: string[];
}

export interface TimeSeriesAllowedObjectsParams {
filename: string;
}

export interface TimeSeriesAllowedObjectsResponse {
allowed_objects: string[];
}

export interface TextureCoordinatesParams {
id: string;
}
Expand Down Expand Up @@ -350,17 +368,6 @@ export interface ModelComponentEdgeAttributeNamesResponseAttribute {
time_steps: number[];
}

export interface MissingFilesParams {
filename: string;
geode_object_type: string;
}

export interface MissingFilesResponse {
additional_files: string[];
has_missing_files: boolean;
mandatory_files: string[];
}

export interface KillParams {
}

Expand Down Expand Up @@ -432,6 +439,17 @@ export interface EdgeAttributeNamesResponseAttribute {
time_steps: number[];
}

export interface DataMissingFilesParams {
filename: string;
geode_object_type: string;
}

export interface DataMissingFilesResponse {
additional_files: string[];
has_missing_files: boolean;
mandatory_files: string[];
}

export interface CellAttributeNamesParams {
id: string;
}
Expand All @@ -452,6 +470,14 @@ export interface CellAttributeNamesResponseAttribute {
time_steps: number[];
}

export interface ApplyTimeSeriesParams {
filename: string;
id: string;
}

export interface ApplyTimeSeriesResponse {
}

export interface AllowedObjectsParams {
filename: string;
}
Expand All @@ -469,7 +495,8 @@ export interface AllowedFilesParams {
}

export interface AllowedFilesResponse {
extensions: string[];
data_extensions: string[];
time_series_extensions: string[];
}

export interface ErrorResponse {
Expand All @@ -495,6 +522,8 @@ export interface Schemas {
readonly vertex_attribute_names: (typeof json)["opengeodeweb_back"]["vertex_attribute_names"] & TypedSchema<VertexAttributeNamesParams, VertexAttributeNamesResponse>;
readonly validate: (typeof json)["opengeodeweb_back"]["validate"] & TypedSchema<ValidateParams, ValidateResponse>;
readonly upload_file: (typeof json)["opengeodeweb_back"]["upload_file"] & TypedSchema<UploadFileParams, UploadFileResponse>;
readonly time_series_missing_files: (typeof json)["opengeodeweb_back"]["time_series_missing_files"] & TypedSchema<TimeSeriesMissingFilesParams, TimeSeriesMissingFilesResponse>;
readonly time_series_allowed_objects: (typeof json)["opengeodeweb_back"]["time_series_allowed_objects"] & TypedSchema<TimeSeriesAllowedObjectsParams, TimeSeriesAllowedObjectsResponse>;
readonly texture_coordinates: (typeof json)["opengeodeweb_back"]["texture_coordinates"] & TypedSchema<TextureCoordinatesParams, TextureCoordinatesResponse>;
readonly save_viewable_file: (typeof json)["opengeodeweb_back"]["save_viewable_file"] & TypedSchema<SaveViewableFileParams, SaveViewableFileResponse>;
readonly polyhedron_attribute_names: (typeof json)["opengeodeweb_back"]["polyhedron_attribute_names"] & TypedSchema<PolyhedronAttributeNamesParams, PolyhedronAttributeNamesResponse>;
Expand All @@ -504,15 +533,16 @@ export interface Schemas {
readonly model_component_polyhedron_attribute_names: (typeof json)["opengeodeweb_back"]["model_component_polyhedron_attribute_names"] & TypedSchema<ModelComponentPolyhedronAttributeNamesParams, ModelComponentPolyhedronAttributeNamesResponse>;
readonly model_component_polygon_attribute_names: (typeof json)["opengeodeweb_back"]["model_component_polygon_attribute_names"] & TypedSchema<ModelComponentPolygonAttributeNamesParams, ModelComponentPolygonAttributeNamesResponse>;
readonly model_component_edge_attribute_names: (typeof json)["opengeodeweb_back"]["model_component_edge_attribute_names"] & TypedSchema<ModelComponentEdgeAttributeNamesParams, ModelComponentEdgeAttributeNamesResponse>;
readonly missing_files: (typeof json)["opengeodeweb_back"]["missing_files"] & TypedSchema<MissingFilesParams, MissingFilesResponse>;
readonly kill: (typeof json)["opengeodeweb_back"]["kill"] & TypedSchema<KillParams, KillResponse>;
readonly import_project: (typeof json)["opengeodeweb_back"]["import_project"] & TypedSchema<ImportProjectParams, ImportProjectResponse>;
readonly geographic_coordinate_systems: (typeof json)["opengeodeweb_back"]["geographic_coordinate_systems"] & TypedSchema<GeographicCoordinateSystemsParams, GeographicCoordinateSystemsResponse>;
readonly geode_objects_and_output_extensions: (typeof json)["opengeodeweb_back"]["geode_objects_and_output_extensions"] & TypedSchema<GeodeObjectsAndOutputExtensionsParams, GeodeObjectsAndOutputExtensionsResponse>;
readonly geode_object_inheritance: (typeof json)["opengeodeweb_back"]["geode_object_inheritance"] & TypedSchema<GeodeObjectInheritanceParams, GeodeObjectInheritanceResponse>;
readonly export_project: (typeof json)["opengeodeweb_back"]["export_project"] & TypedSchema<ExportProjectParams, Blob>;
readonly edge_attribute_names: (typeof json)["opengeodeweb_back"]["edge_attribute_names"] & TypedSchema<EdgeAttributeNamesParams, EdgeAttributeNamesResponse>;
readonly data_missing_files: (typeof json)["opengeodeweb_back"]["data_missing_files"] & TypedSchema<DataMissingFilesParams, DataMissingFilesResponse>;
readonly cell_attribute_names: (typeof json)["opengeodeweb_back"]["cell_attribute_names"] & TypedSchema<CellAttributeNamesParams, CellAttributeNamesResponse>;
readonly apply_time_series: (typeof json)["opengeodeweb_back"]["apply_time_series"] & TypedSchema<ApplyTimeSeriesParams, ApplyTimeSeriesResponse>;
readonly allowed_objects: (typeof json)["opengeodeweb_back"]["allowed_objects"] & TypedSchema<AllowedObjectsParams, AllowedObjectsResponse>;
readonly allowed_files: (typeof json)["opengeodeweb_back"]["allowed_files"] & TypedSchema<AllowedFilesParams, AllowedFilesResponse>;
};
Expand Down
9 changes: 6 additions & 3 deletions src/opengeodeweb_back/geode_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ def get_data_info(data_id: str) -> Data:


def upload_file_path(filename: str) -> str:
upload_folder = flask.current_app.config["UPLOAD_FOLDER_PATH"]
secure_filename = werkzeug.utils.secure_filename(filename)
return str((Path(upload_folder) / secure_filename).resolve())
upload_folder = Path(flask.current_app.config["UPLOAD_FOLDER_PATH"]).resolve()
segments = [werkzeug.utils.secure_filename(segment) for segment in filename.split("/")]
safe_segments = [segment for segment in segments if segment]
if not safe_segments:
flask.abort(400, f"Invalid filename: {filename}")
return str(upload_folder.joinpath(*safe_segments))


def geode_object_output_extensions(
Expand Down
Loading
Loading