cloud_server.models

Pydantic models for the server.

Functions

current_timestamp_int()

Get the current Unix timestamp as an integer.

Classes

CloudServerConfig(**data)

Cloud server configuration.

DatabaseAction(*values)

Enumeration for database actions.

DeleteFileResponse(**data)

Response model for deleting a file.

FileMetadata(**data)

Model for file metadata stored in the index.

ListFilesResponse(**data)

Response model for getting metadata for all files.

ServerDatabaseConfig(**data)

Configuration for the server database.

StorageConfig(**data)

Configuration model for the cloud storage.

UpdateFileMetadataRequest(**data)

Request model for updating file metadata.

UpdateFileMetadataResponse(**data)

Response model for updating file metadata.

UploadFileResponse(**data)

Response model for uploading a file.

class cloud_server.models.ServerDatabaseConfig(**data)[source]

Configuration for the server database.

files_metadata_db_filename: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cloud_server.models.StorageConfig(**data)[source]

Configuration model for the cloud storage.

upload_chunk_size_kb: int
max_file_size_mb: int
thumbnail_size: tuple[int, int]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cloud_server.models.CloudServerConfig(**data)[source]

Cloud server configuration.

db: ServerDatabaseConfig
storage_config: StorageConfig
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

cloud_server.models.current_timestamp_int()[source]

Get the current Unix timestamp as an integer.

Return int:

The current Unix timestamp

Return type:

int

class cloud_server.models.DatabaseAction(*values)[source]

Enumeration for database actions.

CREATE = 'create'
READ = 'read'
UPDATE = 'update'
DELETE = 'delete'
class cloud_server.models.FileMetadata(**data)[source]

Model for file metadata stored in the index.

id: int | None
filename: str
parent_directory: Path
mime_type: str
size: int
uploaded_at: int
updated_at: int
property filepath: Path

Get the full file path relative to the server storage directory.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cloud_server.models.ListFilesResponse(**data)[source]

Response model for getting metadata for all files.

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

files_metadata: list[FileMetadata]
class cloud_server.models.UploadFileResponse(**data)[source]

Response model for uploading a file.

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

file_metadata: FileMetadata
class cloud_server.models.DeleteFileResponse(**data)[source]

Response model for deleting a file.

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

file_metadata: FileMetadata
class cloud_server.models.UpdateFileMetadataResponse(**data)[source]

Response model for updating file metadata.

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

file_metadata: FileMetadata
class cloud_server.models.UpdateFileMetadataRequest(**data)[source]

Request model for updating file metadata.

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

filename: str
parent_directory: Path