@@ -10,27 +10,27 @@ import { RulesEngine } from '@omega-core/utils/rules.engine';
1010import { ChatReduxModel } from '../chat.redux-model' ; // Todo: This would change based on web and mobile
1111
1212// Interfaces
13- export interface IChat {
13+ export interface Chat {
1414 id : number ;
1515 groupId ?: number ;
1616 ownerId : number ;
1717 message : string ;
1818 date : Date | number ;
1919}
2020
21- interface IAction {
21+ interface Action {
2222 type : string ;
2323 payload : any ;
2424}
2525
26- interface IGraphqlDataResponse {
26+ interface GraphqlDataResponse {
2727 error ?: boolean ;
2828 message ?: string ;
2929 data : any ;
3030}
3131
3232// persisted vars
33- const initialAction : IAction = {
33+ const initialAction : Action = {
3434 type : 'NO_ACTION' ,
3535 payload : { }
3636} ;
@@ -45,12 +45,12 @@ class ChatEffect {
4545 RulesEngine . applyRule (
4646 action$ ,
4747 ChatReduxModel . actionTypes . READ_ALL_CHATS ,
48- ( action : IAction ) => [
48+ ( action : Action ) => [
4949 ChatReduxModel . rules . validateChat ( action ) ,
5050 ChatReduxModel . rules . validateChatAgain ( action )
5151 ] ,
5252 ( ) => [
53- flatMap ( ( action : IAction ) => {
53+ flatMap ( ( action : Action ) => {
5454 const { apolloClient, data } = action . payload . payload ;
5555 const { chatPayload } = data ;
5656 const graphqlPayload = {
@@ -60,7 +60,7 @@ class ChatEffect {
6060 return ChatReduxModel . services . requestAllChats ( graphqlPayload ) ;
6161 } ) ,
6262 map ( data => ChatReduxModel . rules . isValidChatResponse ( data ) ) ,
63- map ( ( chatResponse : IGraphqlDataResponse ) => {
63+ map ( ( chatResponse : GraphqlDataResponse ) => {
6464 if ( chatResponse && chatResponse . error ) {
6565 return ChatReduxModel . actions . reducer . processErrorChatResponse ( {
6666 ...chatResponse
@@ -72,7 +72,7 @@ class ChatEffect {
7272 const { id, chats, groupMembers, groupName, groupDescription, groupImage, groupType,
7373 accessType, member } = getGroup [ 0 ] ;
7474 const finalData = Array . isArray ( chats )
75- ? chats . map ( ( val : IChat ) => {
75+ ? chats . map ( ( val : Chat ) => {
7676 // eslint-disable-next-line no-param-reassign
7777 val . date = new Date ( val . date ) . getTime ( ) ;
7878 return val ;
@@ -101,7 +101,7 @@ class ChatEffect {
101101 static readAllUsers = ( action$ : any ) =>
102102 action$ . pipe (
103103 ofType ( ChatReduxModel . actionTypes . READ_ALL_USERS ) ,
104- flatMap ( ( action : IAction ) => {
104+ flatMap ( ( action : Action ) => {
105105 const { apolloClient, data } = action . payload . payload ;
106106 const { profilePayload } = data ;
107107 const graphqlPayload = {
@@ -110,7 +110,7 @@ class ChatEffect {
110110 } ;
111111 return ChatReduxModel . services . requestAllUsers ( graphqlPayload ) ;
112112 } ) ,
113- map ( ( userResponse : IGraphqlDataResponse ) => {
113+ map ( ( userResponse : GraphqlDataResponse ) => {
114114 const {
115115 data : { getProfile }
116116 } = userResponse ;
@@ -129,7 +129,7 @@ class ChatEffect {
129129 static readAllGroups = ( action$ : any ) =>
130130 action$ . pipe (
131131 ofType ( ChatReduxModel . actionTypes . READ_ALL_GROUPS ) ,
132- flatMap ( ( action : IAction ) => {
132+ flatMap ( ( action : Action ) => {
133133 const { apolloClient, data } = action . payload . payload ;
134134 const { groupPayload } = data ;
135135 const graphqlPayload = {
@@ -138,7 +138,7 @@ class ChatEffect {
138138 } ;
139139 return ChatReduxModel . services . requestAllGroups ( graphqlPayload ) ;
140140 } ) ,
141- map ( ( userResponse : IGraphqlDataResponse ) => {
141+ map ( ( userResponse : GraphqlDataResponse ) => {
142142 const {
143143 data : { getGroup }
144144 } = userResponse ;
@@ -157,7 +157,7 @@ class ChatEffect {
157157 static readAllUsersAndChats = ( action$ : any ) =>
158158 action$ . pipe (
159159 ofType ( ChatReduxModel . actionTypes . READ_ALL_USERS_AND_CHATS ) ,
160- mergeMap ( ( action : IAction ) =>
160+ mergeMap ( ( action : Action ) =>
161161 concat (
162162 of ( ChatReduxModel . actions . effects . readAllUsers ( action ) ) ,
163163 of ( ChatReduxModel . actions . effects . readAllGroups ( action ) ) ,
@@ -175,7 +175,7 @@ class ChatEffect {
175175 let componentCallBack = ( ) => { } ;
176176 return action$ . pipe (
177177 ofType ( ChatReduxModel . actionTypes . CREATE_CHAT ) ,
178- flatMap ( ( action : IAction ) => {
178+ flatMap ( ( action : Action ) => {
179179 const {
180180 payload : { apolloClient, data, callBack }
181181 } = action ;
@@ -208,7 +208,7 @@ class ChatEffect {
208208 let chatSn = '' ;
209209 return action$ . pipe (
210210 ofType ( ChatReduxModel . actionTypes . DELETE_CHAT ) ,
211- switchMap ( ( action : IAction ) => {
211+ switchMap ( ( action : Action ) => {
212212 getPayload . chatId = action . payload . chatId ;
213213 getPayload . token = action . payload . token ;
214214 chatSn = action . payload . chatSn ;
@@ -235,7 +235,7 @@ class ChatEffect {
235235 } ;
236236 return action$ . pipe (
237237 ofType ( ChatReduxModel . actionTypes . UPDATE_CHAT ) ,
238- switchMap ( ( action : IAction ) => {
238+ switchMap ( ( action : Action ) => {
239239 getPayload . chatId = action . payload . chatId ;
240240 getPayload . token = action . payload . token ;
241241 return ChatReduxModel . services . requestEditChat ( action . payload ) ;
@@ -258,7 +258,7 @@ class ChatEffect {
258258 let componentCallBack : any = ( ) => { } ;
259259 return action$ . pipe (
260260 ofType ( ChatReduxModel . actionTypes . CREATE_GROUP ) ,
261- flatMap ( ( action : IAction ) => {
261+ flatMap ( ( action : Action ) => {
262262 const {
263263 payload : { apolloClient, data, callBack }
264264 } = action ;
@@ -292,7 +292,7 @@ class ChatEffect {
292292 let chatSn = '' ;
293293 return action$ . pipe (
294294 ofType ( ChatReduxModel . actionTypes . DELETE_GROUP ) ,
295- switchMap ( ( action : IAction ) => {
295+ switchMap ( ( action : Action ) => {
296296 getPayload . groupId = action . payload . groupId ;
297297 getPayload . token = action . payload . token ;
298298 chatSn = action . payload . chatSn ;
@@ -319,7 +319,7 @@ class ChatEffect {
319319 } ;
320320 return action$ . pipe (
321321 ofType ( ChatReduxModel . actionTypes . UPDATE_GROUP ) ,
322- switchMap ( ( action : IAction ) => {
322+ switchMap ( ( action : Action ) => {
323323 getPayload . groupId = action . payload . groupId ;
324324 getPayload . token = action . payload . token ;
325325 return ChatReduxModel . services . updateGroup ( action . payload ) ;
0 commit comments