diff --git a/backend/src/types.ts b/backend/src/types.ts new file mode 100644 index 0000000..7e855af --- /dev/null +++ b/backend/src/types.ts @@ -0,0 +1,60 @@ +export type Plan = 'free' | 'pro' | 'team'; +export type FileStatus = 'uploaded' | 'deleted' | 'expired'; + +export interface UserRecord { + id: string; + email: string; + passwordHash: string; + plan: Plan; + verified: boolean; + createdAt: string; + updatedAt: string; +} + +export interface FileRecord { + id: string; + linkId: string; + /** Google Drive file ID, used to construct download/view/delete URLs */ + gdriveId: string; + /** Session cookie value of the uploader — scopes dashboard/delete access */ + sessionId: string; + /** @deprecated legacy rclone path — only present on old records */ + gdrivePath?: string; + originalName: string; + mimeType: string; + sizeBytes: number; + status: FileStatus; + uploader: string; + expiresAt: string; + deletedAt?: string; + createdAt: string; + views: number; + downloads: number; +} + +export interface RefreshTokenRecord { + id: string; + userId: string; + tokenHash: string; + expiresAt: string; + revokedAt?: string; + createdAt: string; +} + +export interface EventRecord { + id: string; + linkId: string; + type: 'view' | 'download'; + createdAt: string; + ip?: string; + userAgent?: string; + referrer?: string; +} + +export interface DatabaseShape { + users: UserRecord[]; + refreshTokens: RefreshTokenRecord[]; + files: FileRecord[]; + events: EventRecord[]; +} +