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.
138 lines
2.4 KiB
138 lines
2.4 KiB
export enum EntityType {
|
|
App = 'apps',
|
|
Group = 'groups',
|
|
Installation = 'installations',
|
|
Invitation = 'invitations',
|
|
Log = 'logs',
|
|
Post = 'posts',
|
|
User = 'users',
|
|
}
|
|
|
|
export enum GroupMembershipType {
|
|
Admin = 'admin',
|
|
Moderator = 'moderator',
|
|
Member = 'member',
|
|
}
|
|
|
|
export interface Entity {
|
|
[key: string]: any
|
|
id: string
|
|
created: number
|
|
}
|
|
|
|
export type Group = Entity & {
|
|
name: string
|
|
membership?: GroupMembershipType
|
|
about: string
|
|
imageUrl: string
|
|
coverImageUrl: string
|
|
iconImageUrl: string
|
|
}
|
|
|
|
type BaseInstallation = Entity & {
|
|
settings: object
|
|
}
|
|
|
|
export type Installation = BaseInstallation & {
|
|
app: App
|
|
user: User
|
|
}
|
|
|
|
export type NormalizedInstallation = BaseInstallation & {
|
|
app: string
|
|
user: string
|
|
}
|
|
|
|
type BaseUser = Entity & {
|
|
name: string
|
|
about?: string
|
|
imageUrl?: string
|
|
coverImageUrl?: string
|
|
requiresApproval: boolean
|
|
privacy: string
|
|
subscribed: boolean
|
|
subscribedToYou: boolean
|
|
}
|
|
|
|
export type User = BaseUser & {
|
|
group?: Group
|
|
}
|
|
|
|
export type NormalizedUser = BaseUser & {
|
|
group?: string
|
|
}
|
|
|
|
type BaseGroupLog = Entity & {
|
|
content: string
|
|
}
|
|
|
|
export type GroupLog = BaseGroupLog & {
|
|
user: User
|
|
}
|
|
|
|
export type NormalizedGroupLog = BaseGroupLog & {
|
|
user: string
|
|
}
|
|
|
|
type BaseInvitation = Entity & {
|
|
uses: number
|
|
expires: number
|
|
}
|
|
|
|
export type Invitation = BaseInvitation & {
|
|
user: User
|
|
}
|
|
|
|
export type NormalizedInvitation = BaseInvitation & {
|
|
user: string
|
|
}
|
|
|
|
export type App = Entity & {
|
|
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
|
|
active: boolean
|
|
updated: number
|
|
created: number
|
|
}
|
|
|
|
export interface EntityCollection {
|
|
[id: string]: Entity
|
|
}
|
|
|
|
export interface EntityStore {
|
|
[type: string]: EntityCollection
|
|
}
|
|
|
|
export type BasePost = Entity & {
|
|
text?: string
|
|
cover?: string
|
|
data?: object
|
|
visible: boolean
|
|
}
|
|
|
|
export type NormalizedPost = BasePost & {
|
|
user: string
|
|
parents?: string[]
|
|
children?: string[]
|
|
}
|
|
|
|
export type Post = BasePost & {
|
|
user: User
|
|
parents?: Post[]
|
|
children?: Post[]
|
|
}
|