| 31 | } |
| 32 | |
| 33 | interface IChatModel extends mongoose.Model<IChatDocument> { |
| 34 | getChatList({ userId, teamId }: { userId: string; teamId: string }): Promise<IChatDocument[]>; |
| 35 | |
| 36 | createOrUpdate({ |
| 37 | chatParticipantIds, |
| 38 | userId, |
| 39 | teamId, |
| 40 | id, |
| 41 | content, |
| 42 | }: { |
| 43 | chatParticipantIds: string[]; |
| 44 | userId: string; |
| 45 | teamId: string; |
| 46 | id: string; |
| 47 | content: string; |
| 48 | }): Promise<{ newOrUpdatedChat: IChatDocument; initialMessages: IMessageDocument[] }>; |
| 49 | |
| 50 | delete({ userId, chatId }: { userId: string; chatId: string }): Promise<{ teamId: string }>; |
| 51 | |
| 52 | clearHistory({ userId, chatId }: { userId: string; chatId: string }): Promise<{ teamId: string }>; |
| 53 | |
| 54 | searchWithinChat({ |
| 55 | userId, |
| 56 | teamId, |
| 57 | chatId, |
| 58 | query, |
| 59 | }: { |
| 60 | userId: string; |
| 61 | teamId: string; |
| 62 | chatId: string; |
| 63 | query: string; |
| 64 | }): Promise<{ foundMessages: IMessageDocument[]; contextMessages: IMessageDocument[] }>; |
| 65 | |
| 66 | checkPermission({ |
| 67 | userId, |
| 68 | teamId, |
| 69 | chat, |
| 70 | }: { |
| 71 | userId: string; |
| 72 | teamId: string; |
| 73 | chat?: IChatDocument; |
| 74 | }): Promise<any>; |
| 75 | } |
| 76 | |
| 77 | class ChatClass extends mongoose.Model { |
| 78 | public static async getChatList(params) { |
no outgoing calls
no test coverage detected