Class

GcsService

GcsService()

Google Cloud Storage Service Handles file uploads and management in Google Cloud Storage with automatic image optimization.

Constructor

# new GcsService()

Instantiate the GCS client with configured credentials and bucket.

View Source services/gcs.service.js, line 14

Methods

# async deleteInvestigationImages(investigationId) → {Promise.<number>}

Delete all images for a specific investigation.

Parameters:
Name Type Description
investigationId string

The investigation ID.

View Source services/gcs.service.js, line 266

Number of files deleted.

Promise.<number>

# async deleteObjectImage(imageUrl) → {Promise.<boolean>}

Delete an object image from GCS.

Parameters:
Name Type Description
imageUrl string

The public URL of the image to delete.

View Source services/gcs.service.js, line 230

True when deleted successfully.

Promise.<boolean>

# async getImageMetadata(imageUrl) → {Promise.<(FileMetadata|null)>}

Get image metadata.

Parameters:
Name Type Description
imageUrl string

The public URL of the image.

View Source services/gcs.service.js, line 324

File metadata response.

Promise.<(FileMetadata|null)>

# async healthCheck() → {Promise.<boolean>}

Health check for GCS connection.

View Source services/gcs.service.js, line 356

True if GCS is accessible.

Promise.<boolean>

# async imageExists(imageUrl) → {Promise.<boolean>}

Check if an image exists in GCS.

Parameters:
Name Type Description
imageUrl string

The public URL of the image.

View Source services/gcs.service.js, line 298

True if the file exists.

Promise.<boolean>

# async uploadObjectImage(investigationId, objectId, base64Image) → {Promise.<string>}

Upload an object image to GCS with resizing and compression.

Parameters:
Name Type Description
investigationId string

The investigation ID.

objectId string

The object ID.

base64Image string

Base64 encoded image string.

View Source services/gcs.service.js, line 167

The public URL of the uploaded image.

Promise.<string>