/
opt
/
canhelp
/
packages
/
shared
/
src
/
/opt/canhelp/packages/shared/src
mkdir
upload
Name
Size
Mode
Actions
index.ts
24
0644
edit
dl
rm
types.ts
6092
0644
edit
dl
rm
Edit:
/opt/canhelp/packages/shared/src/types.ts
(6092B)
// ─── Enums ──────────────────────────────────────────────────────────────── export type UserRole = 'user' | 'admin' | 'customer' | 'specialist' export type PlanRole = 'requester' | 'helper' | 'customer' | 'specialist' export type PlanTier = 'free' | 'pro' | 'ultimate' export type TaskStatus = 'draft' | 'open' | 'in_progress' | 'completed' | 'cancelled' export type OfferStatus = 'pending' | 'accepted' | 'declined' | 'withdrawn' export type NotificationType = | 'new_offer' | 'offer_accepted' | 'offer_declined' | 'task_completed' | 'task_cancelled' | 'new_message' | 'new_review' | 'task_invite' | 'referral_reward' | 'specialist_card_submitted' | 'specialist_card_approved' | 'specialist_card_rejected' export type ReportReason = 'spam' | 'inappropriate' | 'fraud' | 'duplicate' | 'other' export type ReportStatus = 'pending' | 'reviewed' | 'dismissed' export type Locale = 'el' | 'en' | 'uk' | 'ru' // ─── API Models ─────────────────────────────────────────────────────────── export interface User { id: string name: string email: string firstName: string lastName: string role: UserRole isHelperReady?: boolean legacyMarketRole?: 'customer' | 'specialist' phone: string | null bio: string | null image: string | null skills: string[] | null locale: Locale isActive: boolean lastSeenAt: string | null createdAt: string updatedAt: string balance: string planId: string | null planExpiresAt: string | null plan?: Plan | null showContactInfo: boolean phoneVerified: boolean personalSiteSlug: string | null } export interface Plan { id: string name: string description: string | null role: PlanRole tier: PlanTier price: string currency: string maxTasks: number | null maxOffers: number | null maxCards: number | null maxMessagesPerDay: number | null maxOrdersPerDay: number | null maxSkills: number | null maxProfiles: number | null maxPortfolioItems: number | null notifyNewTasks: boolean canContactFreePlan: boolean canContactProPlan: boolean canContactAll: boolean canShowContactInfo: boolean canViewPhone: boolean canUploadVideo: boolean hasFavorites: boolean hasGoogleCalendar: boolean hasVerifiedBadge: boolean highlightedReviews: boolean searchBoost: number hasPersonalSite: boolean hasCanHelpNowStatus: boolean hasNeedHelpStatus: boolean hasAutoResponse: boolean hasAutoMatch: boolean offersMultiplier: string receiveInstantDispatchFree: boolean receiveInstantDispatchPro: boolean features: string[] | null durationDays: number | null isDefault: boolean isActive: boolean order: number createdAt: string updatedAt: string } export interface DailyUsage { messagesLeft: number | null // null = unlimited ordersLeft: number | null // null = unlimited messagesSent: number ordersMade: number } export type UserStatusType = 'canhelp_now' | 'need_help' export interface UserStatus { id: string userId: string statusType: UserStatusType isActive: boolean activatedAt: string | null expiresAt: string | null createdAt: string } export interface Task { id: string title: string description: string originalLocale: Locale titleEl: string | null titleEn: string | null titleRu: string | null descriptionEl: string | null descriptionEn: string | null descriptionRu: string | null status: TaskStatus budget: string | null budgetNegotiable: boolean currency: string category: string | null location: string | null district: string | null street: string | null houseNumber: string | null timeSlot: string | null confidentialNote: string | null images: string[] | null deadline: string | null expiresAt: string | null customerId: string customer?: Pick<User, 'id' | 'name' | 'image' | 'firstName' | 'lastName'> createdAt: string updatedAt: string } export interface Offer { id: string taskId: string specialistId: string specialist?: Pick<User, 'id' | 'name' | 'image' | 'firstName' | 'lastName'> price: string currency: string message: string | null counterPrice: string | null status: OfferStatus createdAt: string updatedAt: string } export interface ChatRoom { id: string taskId: string task?: Pick<Task, 'id' | 'title'> customerId: string specialistId: string otherUser?: Pick<User, 'id' | 'name' | 'image' | 'firstName' | 'lastName'> createdAt: string } export interface Message { id: string roomId: string senderId: string body: string isRead: boolean createdAt: string } export interface Review { id: string taskId: string authorId: string author?: Pick<User, 'id' | 'name' | 'image'> targetId: string rating: number comment: string | null createdAt: string } export interface Notification { id: string recipientId: string type: NotificationType title: string body: string | null referenceId: string | null isRead: boolean createdAt: string } export interface Favorite { id: string userId: string taskId: string task?: Task createdAt: string } export interface Report { id: string reporterId: string targetType: 'task' | 'user' targetId: string reason: ReportReason description: string | null status: ReportStatus createdAt: string } export interface Category { id: string slug: string icon: string names: Record<Locale, string> parentId: string | null order: number isActive: boolean children?: Category[] } // ─── API Response wrappers ──────────────────────────────────────────────── export interface Paginated<T> { data: T[] total: number page: number limit: number } export interface ApiError { error: string statusCode?: number }
Save
cmd:
run