You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
359 lines
6.9 KiB
359 lines
6.9 KiB
// 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 } from '../constants'
|
|
|
|
export enum UserItemType {
|
|
User = 'user',
|
|
Token = 'token',
|
|
Post = 'post',
|
|
Follow = 'follow',
|
|
Timeline = 'timeline',
|
|
Subscription = 'subscription',
|
|
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
|
|
registration: GroupRegistrationType
|
|
status: GroupStatus
|
|
active: boolean
|
|
created: number
|
|
}
|
|
|
|
export interface GroupPartial {
|
|
id: string
|
|
name: string
|
|
imageUrl?: string
|
|
coverImageUrl?: string
|
|
}
|
|
|
|
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
|
|
group?: GroupPartial
|
|
name: string
|
|
about?: string
|
|
imageUrl?: string
|
|
coverImageUrl?: string
|
|
email: string
|
|
emailVerified: boolean
|
|
passwordHash: string
|
|
installations: Installation[]
|
|
awards: number // Total Awards
|
|
points: number
|
|
balance: number // Currency (Flex)
|
|
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
|
|
subscriberId: string
|
|
pk: string
|
|
t: UserItemType.Subscription
|
|
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
|
|
postId: string
|
|
pk: string // userId
|
|
t: UserItemType.Timeline
|
|
created: number
|
|
}
|
|
|
|
export interface PostAttachment {
|
|
imageUrl: string
|
|
caption?: string
|
|
cover?: string
|
|
}
|
|
|
|
export interface Status {
|
|
imageUrl: string
|
|
text: string
|
|
created: number
|
|
}
|
|
|
|
export interface Post {
|
|
id: string
|
|
pk: string // postId
|
|
t: PostItemType.Post
|
|
userId: string
|
|
root: string
|
|
parents: string[] // Post IDs
|
|
text?: string
|
|
cover?: string
|
|
attachments: PostAttachment[]
|
|
status?: Status
|
|
visible: boolean
|
|
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 Installation {
|
|
id: string
|
|
appId: string
|
|
settings: object
|
|
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
|
|
publicKey: string
|
|
privateKey: string
|
|
preinstall: boolean
|
|
revisions: AppRevision[]
|
|
active: boolean
|
|
updated: number
|
|
created: number
|
|
}
|