manifold/common/user.ts

72 lines
1.5 KiB
TypeScript
Raw Normal View History

import { ENV_CONFIG } from './envs/constants'
export type User = {
2022-01-10 23:52:03 +00:00
id: string
createdTime: number
2022-01-10 23:52:03 +00:00
name: string
username: string
avatarUrl?: string
// For their user page
bio?: string
bannerUrl?: string
website?: string
twitterHandle?: string
discordHandle?: string
2022-01-10 23:52:03 +00:00
balance: number
totalDeposits: number
profitCached: {
daily: number
weekly: number
monthly: number
allTime: number
}
creatorVolumeCached: {
daily: number
weekly: number
monthly: number
allTime: number
}
followerCountCached: number
followedCategories?: string[]
referredByUserId?: string
referredByContractId?: string
2022-07-15 14:45:52 +00:00
lastPingTime?: number
2022-01-10 23:52:03 +00:00
}
export const STARTING_BALANCE = ENV_CONFIG.startingBalance ?? 1000
// for sus users, i.e. multiple sign ups for same person
export const SUS_STARTING_BALANCE = ENV_CONFIG.startingBalance ?? 10
export const REFERRAL_AMOUNT = 500
export type PrivateUser = {
id: string // same as User.id
username: string // denormalized from User
email?: string
unsubscribedFromResolutionEmails?: boolean
unsubscribedFromCommentEmails?: boolean
unsubscribedFromAnswerEmails?: boolean
unsubscribedFromGenericEmails?: boolean
initialDeviceToken?: string
initialIpAddress?: string
apiKey?: string
notificationPreferences?: notification_subscribe_types
}
export type notification_subscribe_types = 'all' | 'less' | 'none'
export type PortfolioMetrics = {
investmentValue: number
balance: number
totalDeposits: number
timestamp: number
userId: string
}