Implement backend API and database services in Docker setup
- Added a new `api` service for the NestJS backend, including health checks and dependencies on PostgreSQL, Redis, and MinIO. - Introduced PostgreSQL and Redis services with health checks and configurations for data persistence. - Added MinIO for S3-compatible object storage and a one-shot service to initialize required buckets. - Updated the Nginx configuration to proxy requests to the new backend API and MinIO storage. - Enhanced the Dockerfile to support the new API environment variables and configurations. - Updated the `package.json` and `package-lock.json` to include new dependencies for QR code generation and other utilities. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
124
src/types/api.ts
124
src/types/api.ts
@@ -143,8 +143,16 @@ export interface NostrSessionRequest {
|
||||
}
|
||||
|
||||
export interface NostrSessionResponse {
|
||||
token: string
|
||||
user: ApiUser
|
||||
/** JWT access token from backend */
|
||||
accessToken: string
|
||||
/** JWT refresh token */
|
||||
refreshToken: string
|
||||
/** Token TTL in seconds */
|
||||
expiresIn: number
|
||||
/** Convenience alias (mapped from accessToken) */
|
||||
token?: string
|
||||
/** User object (populated after separate /auth/me call) */
|
||||
user?: ApiUser
|
||||
}
|
||||
|
||||
// API Response Wrappers
|
||||
@@ -162,6 +170,118 @@ export interface PaginatedResponse<T> {
|
||||
hasMore: boolean
|
||||
}
|
||||
|
||||
// Filmmaker / Creator Types
|
||||
export interface ApiPaymentMethod {
|
||||
id: string
|
||||
filmmakerUserId: string
|
||||
type: 'lightning' | 'bank'
|
||||
lightningAddress?: string
|
||||
bankName?: string
|
||||
accountNumber?: string
|
||||
routingNumber?: string
|
||||
withdrawalFrequency: 'manual' | 'weekly' | 'monthly'
|
||||
isSelected: boolean
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface ApiFilmmakerAnalytics {
|
||||
balance: number
|
||||
totalEarnings: number
|
||||
myTotalEarnings: number
|
||||
averageSharePercentage: number
|
||||
}
|
||||
|
||||
export interface ApiWatchAnalytics {
|
||||
viewsByDate: Record<string, number>
|
||||
trailerViews: number
|
||||
averageWatchTime: number
|
||||
streamingRevenueSats: number
|
||||
rentalRevenueSats: number
|
||||
purchasesCount: number
|
||||
purchasesByContent: Array<{ contentId: string; title: string; count: number }>
|
||||
revenueByDate: Record<string, number>
|
||||
}
|
||||
|
||||
export interface ApiPayment {
|
||||
id: string
|
||||
amount: number
|
||||
currency: string
|
||||
status: 'pending' | 'completed' | 'failed'
|
||||
type: 'withdrawal' | 'payout'
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface ApiCastMember {
|
||||
id: string
|
||||
name: string
|
||||
role: string
|
||||
profilePictureUrl?: string
|
||||
type: 'cast' | 'crew'
|
||||
}
|
||||
|
||||
export interface ApiProjectPermission {
|
||||
id: string
|
||||
userId: string
|
||||
projectId: string
|
||||
role: 'owner' | 'admin' | 'editor' | 'viewer' | 'revenue-manager'
|
||||
user?: ApiUser
|
||||
}
|
||||
|
||||
export interface ApiRevenueSplit {
|
||||
id: string
|
||||
userId: string
|
||||
projectId: string
|
||||
percentage: number
|
||||
user?: ApiUser
|
||||
}
|
||||
|
||||
export interface ApiCoupon {
|
||||
id: string
|
||||
code: string
|
||||
projectId: string
|
||||
discountType: 'percentage' | 'fixed'
|
||||
discountValue: number
|
||||
usageLimit: number
|
||||
usedCount: number
|
||||
expiresAt?: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export type ProjectStatus = 'draft' | 'published' | 'rejected'
|
||||
export type ProjectType = 'film' | 'episodic' | 'music-video'
|
||||
|
||||
export interface CreateProjectData {
|
||||
name: string
|
||||
type: ProjectType
|
||||
}
|
||||
|
||||
export interface UpdateProjectData {
|
||||
name?: string
|
||||
title?: string
|
||||
slug?: string
|
||||
synopsis?: string
|
||||
status?: ProjectStatus
|
||||
type?: ProjectType
|
||||
format?: string
|
||||
category?: string
|
||||
poster?: string
|
||||
trailer?: string
|
||||
rentalPrice?: number
|
||||
releaseDate?: string
|
||||
genres?: string[]
|
||||
deliveryMode?: 'native' | 'partner'
|
||||
}
|
||||
|
||||
export interface UploadInitResponse {
|
||||
UploadId: string
|
||||
Key: string
|
||||
}
|
||||
|
||||
export interface UploadPresignedUrlsResponse {
|
||||
parts: Array<{ PartNumber: number; signedUrl: string }>
|
||||
}
|
||||
|
||||
// Error Types
|
||||
export interface ApiError {
|
||||
message: string
|
||||
|
||||
@@ -22,6 +22,10 @@ export interface Content {
|
||||
drmEnabled?: boolean
|
||||
streamingUrl?: string
|
||||
apiData?: any
|
||||
|
||||
// Dual-mode content delivery
|
||||
deliveryMode?: 'native' | 'partner'
|
||||
keyUrl?: string
|
||||
}
|
||||
|
||||
// Nostr event types
|
||||
|
||||
Reference in New Issue
Block a user