fix: correct import paths and add missing protocol files for DDD structure

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-07-28 18:19:45 +07:00
parent 234ca7b14c
commit 4568644922
34 changed files with 6097 additions and 5 deletions
+14
View File
@@ -0,0 +1,14 @@
/**
* Core domain entity representing an S3-compatible storage bucket.
* Buckets group objects for the S3-compatible API layer.
*/
export interface Bucket {
/** Primary key, UUID */
id: string;
/** Bucket name (unique, max 63 chars, S3 naming convention) */
name: string;
/** Record creation timestamp */
createdAt: Date;
/** Record last-updated timestamp */
updatedAt: Date;
}
+43
View File
@@ -0,0 +1,43 @@
/**
* Supported compression algorithms for stored file parts.
* - `"gzip"`: Gzip compression was applied
* - `null`: No compression applied
*/
export type CompressionAlgorithm = 'gzip' | null;
/**
* Core domain entity representing a chunk (part) of a file stored in Telegram.
* Large files are split into multiple parts for Telegram-safe storage.
*/
export interface FilePart {
/** Primary key, auto-increment */
id: number;
/** Foreign key to the parent File record (UUID) */
fileId: string;
/** Sequential part number (1-based within the file) */
partNumber: number;
/** Telegram file_id for retrieving this part */
telegramFileId: string;
/** Telegram unique file_id (stable across bot tokens) */
telegramFileUniqueId: string;
/** Chat ID where this part is stored */
storageChatId: number;
/** Message ID within the storage chat */
storageMessageId: number;
/** Original size of this part in bytes */
sizeBytes: number;
/** Stored (post-compression) size in bytes */
storedSizeBytes: number;
/** Compression algorithm applied, or null if uncompressed */
compressionAlgorithm: CompressionAlgorithm;
/** ETag for this part (hash of the stored content) */
etag: string;
/** Record creation timestamp */
createdAt: Date;
}
/**
* Input type for creating a new FilePart record.
* Omits auto-generated fields (id, createdAt).
*/
export type NewFilePart = Omit<FilePart, 'id' | 'createdAt'>;
+64
View File
@@ -0,0 +1,64 @@
/**
* Core domain entity representing a file stored in Telegram.
* Contains both Telegram metadata and optional S3-compatible fields.
*/
export interface File {
/** Primary key, UUID */
id: string;
/** Public-facing unique identifier (short, URL-safe) */
publicId: string;
/** Telegram file_id for retrieving the file */
telegramFileId: string;
/** Telegram unique file_id (stable across bot tokens) */
telegramFileUniqueId: string;
/** Chat ID where the file is stored */
storageChatId: number;
/** Message ID within the storage chat */
storageMessageId: number;
/** Original file name */
fileName: string;
/** MIME type of the file */
mimeType: string;
/** File size in bytes */
sizeBytes: number;
/** File type classification (e.g. "photo", "document", "video") */
fileType: string;
/** Telegram user ID of the uploader */
uploaderId: number;
/** SHA-256 hash of file contents, or null */
fileHash: string | null;
/** Telegram file_id of the archive (zip) containing this file, or null */
archiveTelegramFileId: string | null;
/** Message ID of the archive message, or null */
archiveStorageMessageId: number | null;
/** File name within the archive, or null */
archiveFileName: string | null;
/** Entry name/path within the archive, or null */
archiveEntryName: string | null;
/** MIME type of the archive entry, or null */
archiveMimeType: string | null;
/** Size of the archive entry in bytes, or null */
archiveSizeBytes: number | null;
/** S3 bucket ID if stored via S3-compatible API, or null */
bucketId: string | null;
/** S3 object key if stored via S3-compatible API, or null */
s3Key: string | null;
/** Storage backend identifier, defaults to "telegram" */
storageBackend: string | null;
/** Soft-delete flag */
isDeleted: boolean | null;
/** S3 multipart upload ID if uploaded in parts, or null */
multipartUploadId: string | null;
/** Number of file_parts for chunked storage, or null */
partCount: number | null;
/** Record creation timestamp */
createdAt: Date;
/** Record last-updated timestamp */
updatedAt: Date;
}
/**
* Input type for creating a new File record.
* Omits auto-generated fields (id, createdAt, updatedAt).
*/
export type NewFile = Omit<File, 'id' | 'createdAt' | 'updatedAt'>;
+43
View File
@@ -0,0 +1,43 @@
/**
* Core domain entity representing an S3 multipart upload session.
* Tracks in-progress multipart uploads within a bucket.
*/
export interface MultipartUpload {
/** Unique upload identifier (nanoid) */
uploadId: string;
/** Foreign key to the parent Bucket (UUID) */
bucketId: string;
/** S3 object key being uploaded */
s3Key: string;
/** Timestamp when the upload was initiated */
initiatedAt: Date;
/** Upload status: "in_progress", "completed", or "aborted" */
status: string;
/** Identifier of the entity that initiated the upload */
initiatedBy: string;
}
/**
* Core domain entity representing an individual part of an S3 multipart upload.
* Each part is stored as a separate Telegram message.
*/
export interface MultipartPart {
/** Primary key, auto-increment */
id: number;
/** Foreign key to the parent MultipartUpload */
uploadId: string;
/** Sequential part number (1-based within the upload) */
partNumber: number;
/** Telegram file_id for retrieving this part */
telegramFileId: string;
/** Telegram unique file_id (stable across bot tokens) */
telegramFileUniqueId: string;
/** Message ID within the storage chat */
storageMessageId: number;
/** Part size in bytes */
sizeBytes: number;
/** ETag for this part */
etag: string;
/** Record creation timestamp */
createdAt: Date;
}