|
|
// Containers
//
// Users
// - Partition Key: pk (userId)
// Groups
// - Partition Key: pk (groupId)
// GroupDirectory
// - Partition Key: pk
// Posts
// - Partition Key: pk (postId)
// Ancestry
// - Partition Key: pk (postId)
// Points: total reward value + likes
import { GROUP_LISTING_PARTITION_KEY, APP_PARTITION_KEY, INSTALLATION_PARTITION_KEY, MEDIA_PARTITION_KEY, } from '../constants'
export enum UserItemType { User = 'user', Token = 'token', Post = 'post', Follow = 'follow', Timeline = 'timeline', Subscription = 'subscription', InverseSubscription = 'isubscription', Block = 'block', Transaction = 'transation', }
export enum UserPrivacyType { Public = 'public', Group = 'group', Subscribers = 'subscribers', Private = 'private', }
export enum UserTransactionType { Purchase = 'purchase', Award = 'award', }
export enum GroupStatus { Pending = 'pending', Paid = 'paid', }
export enum GroupRegistrationType { Open = 'open', Approval = 'approval', Closed = 'closed', }
export enum GroupItemType { Group = 'group', Membership = 'membership', Report = 'report', Block = 'block', Invitation = 'invitation', Log = 'log', }
export enum GroupMembershipType { Admin = 'admin', Moderator = 'moderator', Member = 'member', }
export enum ReportStatus { Pending = 'pending', Complete = 'complete', }
export enum BlockType { User = 'user', Group = 'group', }
export enum PostItemType { Post = 'post', Award = 'award', }
export interface GroupListing { id: string pk: typeof GROUP_LISTING_PARTITION_KEY name: string about?: string registration: GroupRegistrationType members: number posts: number awards: number points: number latestAwards: PostAwardPartial[] created: number }
export interface Group { id: string pk: string // ID
t: GroupItemType.Group userId: string name: string // Prenormalized ID
about?: string codeOfConduct?: string imageUrl?: string coverImageUrl?: string iconImageUrl?: string registration: GroupRegistrationType status: GroupStatus active: boolean created: number }
export interface GroupMembership { id?: string pk: string // Group ID
t: GroupItemType.Membership userId: string pending: boolean membership: GroupMembershipType invitation?: string created: number }
export interface GroupInvitation { id: string pk: string // Group ID
t: GroupItemType.Invitation userId: string limit?: number expiration?: number uses: number active: boolean created: number }
export interface GroupReport { id: string pk: string // Group ID
t: GroupItemType.Report postId: string reportedById: string description?: string status: string created: number }
export interface GroupBlock { id?: string pk: string // Group ID
t: GroupItemType.Block blockedId: string // User or Group ID
userId: string // blocker ID
created: number }
export interface GroupLog { id?: string pk: string // Group ID
t: GroupItemType.Log userId: string content: string created: number }
export interface User { id: string pk: string // ID
t: UserItemType.User groupId?: string group?: Group name: string about?: string imageUrl?: string coverImageUrl?: string email: string emailVerified: boolean passwordHash: string installations: string[] awards: number // Total Awards
points: number balance: number // Currency (Flex)
posts: number subscriberCount: number subscribedCount: number pending: boolean requiresApproval: boolean privacy: UserPrivacyType paid: boolean active: boolean created: number // Timestamp
}
export interface UserToken { id: string pk: string // userId
t: UserItemType.Token userAgent: string ip: string expires: number created: number }
export interface UserPost { id?: string postId: string pk: string // userId
t: UserItemType.Post created: number }
export interface UserSubscription { id?: string userId: string // from
pk: string // to
t: UserItemType.Subscription pending: boolean created: number }
export interface UserInverseSubscription { id?: string userId: string // to
pk: string // from
t: UserItemType.InverseSubscription pending: boolean created: number }
export interface UserBlock { id?: string blockedId: string pk: string t: UserItemType.Block blockType: BlockType description?: string created: number }
export interface UserTransaction { id: string pk: string t: UserItemType.Transaction transactionType: UserTransactionType fromUserId: string toUserId: string amount: number created: number }
export interface UserTimelinePost { id: string pk: string // userId
t: UserItemType.Timeline created: number }
export interface PostAttachment { url: string text?: string cover?: string }
export interface Status { imageUrl: string text: string created: number }
export interface PostData { [key: string]: any }
export interface Post { id: string pk: string // postId
t: PostItemType.Post userId: string appId: string root: string parents: string[] // Post IDs
text?: string cover?: string attachments: PostAttachment[] status?: Status data?: PostData visible: boolean replies: number awards: number latestAwards: PostAwardPartial[] created: number }
export interface PostAward { id: string pk: string // postId
t: PostItemType.Award userId: string imageUrl: string text: string userText: string cost: number reward: number created: number }
export interface PostAwardPartial { userId: string imageUrl: string text: string userText: string created: number }
export interface PostRelationship { id: string parents: string[] // Post IDs
pk: string // root post ID
}
export interface InstallationSettings { [key: string]: any }
export interface Installation { id: string pk: typeof INSTALLATION_PARTITION_KEY userId: string appId: string settings: InstallationSettings created: number }
export interface AppRevision { version: string name: string imageUrl?: string coverImageUrl?: string iconImageUrl?: string about?: string websiteUrl?: string companyName?: string composerUrl?: string composerSchema?: object rendererUrl?: string rendererSchema?: object initCallbackUrl?: string composeCallbackUrl?: string created: number }
export interface App { id: string pk: typeof APP_PARTITION_KEY userId: string version: string name: string imageUrl?: string coverImageUrl?: string iconImageUrl?: string about?: string websiteUrl?: string companyName?: string composerUrl?: string composerSchema?: object rendererUrl?: string rendererSchema?: object initCallbackUrl?: string composeCallbackUrl?: string rating: number users: number publicKey: string privateKey: string preinstall: boolean revisions: AppRevision[] active: boolean updated: number created: number }
export interface Media { id: string pk: typeof MEDIA_PARTITION_KEY size: number type: string originalName: string attached: boolean created: number }
|