Changeset View
Changeset View
Standalone View
Standalone View
lib/types/messages/create-sidebar.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 CreateSidebarMessageData = { | export type CreateSidebarMessageData = { | ||||
+type: 18, | +type: 18, | ||||
+threadID: string, | +threadID: string, | ||||
+creatorID: string, | +creatorID: string, | ||||
+time: number, | +time: number, | ||||
+sourceMessageAuthorID: string, | +sourceMessageAuthorID: string, | ||||
+initialThreadState: { | +initialThreadState: { | ||||
+name: ?string, | +name: ?string, | ||||
+parentThreadID: string, | +parentThreadID: string, | ||||
+color: string, | +color: string, | ||||
+memberIDs: string[], | +memberIDs: string[], | ||||
}, | }, | ||||
}; | }; | ||||
export type RawCreateSidebarMessageInfo = { | export type RawCreateSidebarMessageInfo = { | ||||
...CreateSidebarMessageData, | ...CreateSidebarMessageData, | ||||
id: string, | id: string, | ||||
}; | }; | ||||
export const rawCreateSidebarMessageInfoValidator: TInterface<RawCreateSidebarMessageInfo> = | |||||
tShape<RawCreateSidebarMessageInfo>({ | |||||
type: tNumber(messageTypes.CREATE_SIDEBAR), | |||||
threadID: tID, | |||||
creatorID: t.String, | |||||
time: t.Number, | |||||
sourceMessageAuthorID: t.String, | |||||
initialThreadState: tShape({ | |||||
name: t.maybe(t.String), | |||||
parentThreadID: tID, | |||||
color: t.String, | |||||
memberIDs: t.list(t.String), | |||||
}), | |||||
id: tID, | |||||
}); | |||||
export type CreateSidebarMessageInfo = { | export type CreateSidebarMessageInfo = { | ||||
+type: 18, | +type: 18, | ||||
+id: string, | +id: string, | ||||
+threadID: string, | +threadID: string, | ||||
+creator: RelativeUserInfo, | +creator: RelativeUserInfo, | ||||
+time: number, | +time: number, | ||||
+sourceMessageAuthor: RelativeUserInfo, | +sourceMessageAuthor: RelativeUserInfo, | ||||
+initialThreadState: { | +initialThreadState: { | ||||
+name: ?string, | +name: ?string, | ||||
+parentThreadInfo: ThreadInfo, | +parentThreadInfo: ThreadInfo, | ||||
+color: string, | +color: string, | ||||
+otherMembers: RelativeUserInfo[], | +otherMembers: RelativeUserInfo[], | ||||
}, | }, | ||||
}; | }; |