done
This commit is contained in:
15
packages/shared/package.json
Normal file
15
packages/shared/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@fileshare/shared",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"watch": "tsc -w",
|
||||
"test": "node -e \"console.log('Shared package build and types verified')\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.7.3"
|
||||
}
|
||||
}
|
||||
172
packages/shared/src/index.ts
Normal file
172
packages/shared/src/index.ts
Normal file
@@ -0,0 +1,172 @@
|
||||
export enum UserRole {
|
||||
SUPER_ADMIN = 'SUPER_ADMIN',
|
||||
ADMIN = 'ADMIN',
|
||||
USER = 'USER',
|
||||
}
|
||||
|
||||
export enum UserStatus {
|
||||
ACTIVE = 'ACTIVE',
|
||||
SUSPENDED = 'SUSPENDED',
|
||||
PENDING = 'PENDING',
|
||||
}
|
||||
|
||||
export enum FileCategory {
|
||||
VIDEO = 'VIDEO',
|
||||
IMAGE = 'IMAGE',
|
||||
DOCUMENT = 'DOCUMENT',
|
||||
ARCHIVE = 'ARCHIVE',
|
||||
AUDIO = 'AUDIO',
|
||||
OTHER = 'OTHER',
|
||||
}
|
||||
|
||||
export enum FileStatus {
|
||||
PENDING = 'PENDING',
|
||||
UPLOADING = 'UPLOADING',
|
||||
PROCESSING = 'PROCESSING',
|
||||
READY = 'READY',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
export enum PermissionResourceType {
|
||||
FILE = 'FILE',
|
||||
FOLDER = 'FOLDER',
|
||||
USER_FILES = 'USER_FILES',
|
||||
}
|
||||
|
||||
export enum ProcessingJobStatus {
|
||||
QUEUED = 'QUEUED',
|
||||
PROCESSING = 'PROCESSING',
|
||||
COMPLETED = 'COMPLETED',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
export enum UploadSessionStatus {
|
||||
INITIALIZED = 'INITIALIZED',
|
||||
UPLOADING = 'UPLOADING',
|
||||
COMPLETED = 'COMPLETED',
|
||||
ABORTED = 'ABORTED',
|
||||
EXPIRED = 'EXPIRED',
|
||||
}
|
||||
|
||||
export interface GranularPermissions {
|
||||
canViewMetadata: boolean;
|
||||
canPreview: boolean;
|
||||
canPlay: boolean;
|
||||
canDownload: boolean;
|
||||
canListFolder: boolean;
|
||||
}
|
||||
|
||||
export enum ShareResourceType {
|
||||
FILE = 'FILE',
|
||||
FOLDER = 'FOLDER',
|
||||
}
|
||||
|
||||
export interface UserSummaryDto {
|
||||
id: string;
|
||||
email: string;
|
||||
username: string;
|
||||
fullName: string;
|
||||
companyName?: string;
|
||||
allowedCompanies?: string | null;
|
||||
role: UserRole;
|
||||
status: UserStatus;
|
||||
storageQuotaBytes: string;
|
||||
storageUsedBytes: string;
|
||||
canCreateShareLinks?: boolean;
|
||||
canDeleteFiles?: boolean;
|
||||
canViewOtherUsers?: boolean;
|
||||
remoteFileServerUrl?: string | null;
|
||||
canUseRemoteServer?: boolean;
|
||||
createdAt: string;
|
||||
lastLoginAt?: string | null;
|
||||
}
|
||||
|
||||
export interface ShareLinkDto {
|
||||
id: string;
|
||||
token: string;
|
||||
title?: string | null;
|
||||
ownerId: string;
|
||||
ownerName?: string;
|
||||
resourceType: ShareResourceType;
|
||||
fileId?: string | null;
|
||||
folderId?: string | null;
|
||||
allowDownload: boolean;
|
||||
hasPassword?: boolean;
|
||||
expiresAt?: string | null;
|
||||
viewCount: number;
|
||||
downloadCount: number;
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface FileAssetDto {
|
||||
id: string;
|
||||
ownerId: string;
|
||||
ownerName?: string;
|
||||
ownerEmail?: string;
|
||||
ownerCompanyName?: string;
|
||||
folderId?: string | null;
|
||||
originalFilename: string;
|
||||
mimeType: string;
|
||||
fileExtension: string;
|
||||
fileSizeBytes: string;
|
||||
fileCategory: FileCategory;
|
||||
status: FileStatus;
|
||||
durationSeconds?: number | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
videoCodec?: string | null;
|
||||
audioCodec?: string | null;
|
||||
thumbnailUrl?: string | null;
|
||||
hasHlsStream?: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
permissions?: GranularPermissions;
|
||||
}
|
||||
|
||||
export interface FolderDto {
|
||||
id: string;
|
||||
ownerId: string;
|
||||
parentId?: string | null;
|
||||
name: string;
|
||||
logicalPath: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
subfolderCount?: number;
|
||||
fileCount?: number;
|
||||
permissions?: GranularPermissions;
|
||||
}
|
||||
|
||||
export interface FilePermissionDto {
|
||||
id: string;
|
||||
resourceType: PermissionResourceType;
|
||||
resourceId?: string | null;
|
||||
resourceName?: string;
|
||||
ownerId: string;
|
||||
ownerName?: string;
|
||||
granteeUserId: string;
|
||||
granteeName?: string;
|
||||
granteeEmail?: string;
|
||||
grantedByUserId: string;
|
||||
grantedByName?: string;
|
||||
canViewMetadata: boolean;
|
||||
canPreview: boolean;
|
||||
canPlay: boolean;
|
||||
canDownload: boolean;
|
||||
canListFolder: boolean;
|
||||
expiresAt?: string | null;
|
||||
revokedAt?: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface StorageOverviewDto {
|
||||
totalStorageBytes: string;
|
||||
usedStorageBytes: string;
|
||||
freeStorageBytes: string;
|
||||
userCount: number;
|
||||
fileCount: number;
|
||||
videoCount: number;
|
||||
quotaUtilizationPercent: number;
|
||||
}
|
||||
17
packages/shared/tsconfig.json
Normal file
17
packages/shared/tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user