Changeset View
Changeset View
Standalone View
Standalone View
lib/types/messages/create-subthread.js
// @flow | // @flow | ||||
import t, { type TInterface } from 'tcomb'; | |||||
import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; | |||||
import { messageTypes } from '../message-types-enum.js'; | |||||
import type { ThreadInfo } from '../thread-types.js'; | import type { ThreadInfo } from '../thread-types.js'; | ||||
import type { RelativeUserInfo } from '../user-types.js'; | import type { RelativeUserInfo } from '../user-types.js'; | ||||
export type CreateSubthreadMessageData = { | export type CreateSubthreadMessageData = { | ||||
type: 3, | type: 3, | ||||
threadID: string, | threadID: string, | ||||
creatorID: string, | creatorID: string, | ||||
time: number, | time: number, | ||||
childThreadID: string, | childThreadID: string, | ||||
}; | }; | ||||
export type RawCreateSubthreadMessageInfo = { | export type RawCreateSubthreadMessageInfo = { | ||||
...CreateSubthreadMessageData, | ...CreateSubthreadMessageData, | ||||
id: string, | id: string, | ||||
}; | }; | ||||
export const rawCreateSubthreadMessageInfoValidator: TInterface<RawCreateSubthreadMessageInfo> = | |||||
tShape<RawCreateSubthreadMessageInfo>({ | |||||
type: tNumber(messageTypes.CREATE_SUB_THREAD), | |||||
threadID: tID, | |||||
creatorID: t.String, | |||||
time: t.Number, | |||||
childThreadID: tID, | |||||
id: tID, | |||||
}); | |||||
export type CreateSubthreadMessageInfo = { | export type CreateSubthreadMessageInfo = { | ||||
type: 3, | type: 3, | ||||
id: string, | id: string, | ||||
threadID: string, | threadID: string, | ||||
creator: RelativeUserInfo, | creator: RelativeUserInfo, | ||||
time: number, | time: number, | ||||
childThreadInfo: ThreadInfo, | childThreadInfo: ThreadInfo, | ||||
}; | }; |