effect backup

This commit is contained in:
Park Byung Eun 2020-03-06 09:37:54 +09:00
parent f68c261c3f
commit ff9e5b89bf
2 changed files with 37 additions and 369 deletions

View File

@ -1,344 +0,0 @@
import { createAction, props } from '@ngrx/store';
import {
BuddyRequest,
GroupRequest,
GroupDetailData,
GroupResponse,
UserInfo,
RoomRequest,
PhoneBookInfo,
PhoneBookReadyRequest,
PhoneBookReadyResponse,
PhoneBookReadyNotification,
PhoneBookReadyOkRequest,
PhoneBookReadyOkResponse,
PhoneBookSndNotification,
PhoneBookRcvRequest,
PhoneBookRcvResponse
} from '@ucap-webmessenger/protocol-sync';
import {
RoomInfo,
UserInfoShort,
UserInfo as RoomUserInfo,
InfoRequest
} from '@ucap-webmessenger/protocol-room';
import { Info, EventJson } from '@ucap-webmessenger/protocol-event';
import {
AddResponse as GroupAddResponse,
UpdateRequest as GroupUpdateRequest,
UpdateResponse as GroupUpdateResponse,
DelRequest as GroupDelRequest,
DelResponse as GroupDelResponse
} from '@ucap-webmessenger/protocol-group';
import {
AddRequest as BuddyAddRequest,
AddResponse as BuddyAddResponse,
DelRequest as BuddyDelRequest,
DelResponse as BuddyDelResponse,
UpdateRequest as BuddyUpdateRequest,
UpdateResponse as BuddyUpdateResponse
} from '@ucap-webmessenger/protocol-buddy';
export const buddy2 = createAction(
'[Messenger::Sync] Buddy2',
props<BuddyRequest>()
);
export const buddy2Success = createAction(
'[Messenger::Sync] Buddy2 Success',
props<{ buddyList: UserInfo[]; syncDate: string }>()
);
export const buddy2Failure = createAction(
'[Messenger::Sync] Buddy2 Failure',
props<{ error: any }>()
);
export const group2 = createAction(
'[Messenger::Sync] Group2',
props<GroupRequest>()
);
export const group2Success = createAction(
'[Messenger::Sync] Group2 Success',
props<{ groupList: GroupDetailData[]; syncDate: string }>()
);
export const group2Failure = createAction(
'[Messenger::Sync] Group2 Failure',
props<{ error: any }>()
);
export const room = createAction(
'[Messenger::Sync] Room',
props<RoomRequest>()
);
export const roomSuccess = createAction(
'[Messenger::Sync] Room Success',
props<{
roomList: RoomInfo[];
roomUserInfoMap: {
[param: string]: {
userInfoShortList: UserInfoShort[];
userInfoList: RoomUserInfo[];
};
};
syncDate: string;
}>()
);
export const roomFailure = createAction(
'[Messenger::Sync] Room Failure',
props<{ error: any }>()
);
export const updateRoomForNewEventMessage = createAction(
'[Messenger::Sync] updateRoomForNewEventMessage',
props<{
roomSeq: string;
info: Info<EventJson>;
}>()
);
export const refreshRoom = createAction(
'[Messenger::Sync] refresh room in sync',
props<InfoRequest>()
);
export const refreshRoomSuccess = createAction(
'[Messenger::Sync] refresh room in sync Success',
props<{
roomInfo: RoomInfo;
userInfoShortList: UserInfoShort[];
userInfoList: RoomUserInfo[];
}>()
);
export const refreshRoomFailure = createAction(
'[Messenger::Sync] refresh room in sync Failure',
props<{ error: any }>()
);
export const updateUnreadCount = createAction(
'[Messenger::Sync] Update unread count',
props<{
roomSeq: string;
noReadCnt?: number;
}>()
);
/** 새그룹 추가 & 그룹원 추가 */
export const createGroupAndBuddy = createAction(
'[Messenger::Sync] Group & Buddy Create',
props<{
groupName: string;
trgtUserSeq: number[];
}>()
);
export const createGroupAndBuddySuccess = createAction(
'[Messenger::Sync] Group & Buddy Create Success',
props<GroupAddResponse>()
);
export const createGroupAndBuddyFailure = createAction(
'[Messenger::Sync] Group & Buddy Create Failure',
props<{ error: any }>()
);
/** 그룹원 수정 */
export const updateGroupMember = createAction(
'[Messenger::Sync] Update Group Member',
props<{
oldGroup: GroupDetailData;
trgtUserSeq: number[];
}>()
);
export const updateGroupMemberSuccess = createAction(
'[Messenger::Sync] Update Group Member Success',
props<GroupAddResponse>()
);
export const updateGroupMemberFailure = createAction(
'[Messenger::Sync] Update Group Member Failure',
props<{ error: any }>()
);
/** 그룹원 이동 */
export const moveGroupMember = createAction(
'[Messenger::Sync] Move Group Member',
props<{
fromGroup: GroupDetailData;
toGroup: GroupDetailData;
trgtUserSeq: number[];
}>()
);
export const moveGroupToFailure = createAction(
'[Messenger::Sync] Move Group Member / To',
props<{ error: any }>()
);
export const moveGroupFromFailure = createAction(
'[Messenger::Sync] Move Group Member / From',
props<{ error: any }>()
);
/** 동료 추가 */
export const addBuddy = createAction(
'[Messenger::Sync] Buddy Add',
props<BuddyAddRequest>()
);
export const addBuddySuccess = createAction(
'[Messenger::Sync] Buddy Add Success',
props<BuddyAddResponse>()
);
export const addBuddyFailure = createAction(
'[Messenger::Sync] Buddy Add Failure',
props<{ error: any }>()
);
/** 동료 삭제 */
export const delBuddy = createAction(
'[Messenger::Sync] Buddy Del',
props<BuddyDelRequest>()
);
export const delBuddySuccess = createAction(
'[Messenger::Sync] Buddy Del Success',
props<BuddyDelResponse>()
);
export const delBuddyFailure = createAction(
'[Messenger::Sync] Buddy Del Failure',
props<{ error: any }>()
);
/** 동료 삭제 및 그룹 클리어.(in profile) */
export const delBuddyAndClear = createAction(
'[Messenger::Sync] Buddy Del and Group Clear',
props<{ seq: number }>()
);
export const delBuddyAndClearSuccess = createAction(
'[Messenger::Sync] Buddy Del and Group Clear Success',
props<BuddyDelResponse>()
);
export const delBuddyAndClearFailure = createAction(
'[Messenger::Sync] Buddy Del and Group Clear Failure',
props<{ error: any }>()
);
/** 동료 변경(즐겨찾기) */
export const updateBuddy = createAction(
'[Messenger::Sync] Buddy Update',
props<BuddyUpdateRequest>()
);
export const updateBuddySuccess = createAction(
'[Messenger::Sync] Buddy Update Success',
props<BuddyUpdateResponse>()
);
export const updateBuddyFailure = createAction(
'[Messenger::Sync] Buddy Update Failure',
props<{ error: any }>()
);
/** 새그룹 추가 */
export const createGroup = createAction(
'[Messenger::Sync] Group Create',
props<{
groupName: string;
}>()
);
export const createGroupSuccess = createAction(
'[Messenger::Sync] Group Create Success',
props<GroupAddResponse>()
);
export const createGroupFailure = createAction(
'[Messenger::Sync] Group Create Failure',
props<{ error: any }>()
);
/** 그룹 업데이트 */
export const updateGroup = createAction(
'[Messenger::Sync] Group Update',
props<GroupUpdateRequest>()
);
export const updateGroupSuccess = createAction(
'[Messenger::Sync] Group Update Success',
props<GroupUpdateResponse>()
);
export const updateGroupFailure = createAction(
'[Messenger::Sync] Group Update Failure',
props<{ error: any }>()
);
/** 그룹 삭제 */
export const delGroup = createAction(
'[Messenger::Sync] Group Del',
props<{
group: GroupDetailData;
}>()
);
export const delGroupSuccess = createAction(
'[Messenger::Sync] Group Del Success',
props<GroupDelResponse>()
);
export const delGroupFailure = createAction(
'[Messenger::Sync] Group Del Failure',
props<{ error: any }>()
);
/** Sync 되어 있는 방의 방인원의 isJoinRoom flag 를 false 로 변경. */
export const clearRoomUsers = createAction(
'[Messenger::Sync] Clear room users.',
props<{ roomSeq: string; userSeqs: number[] }>()
);
/**
* PhoneBook Req Sync Date
*/
export const phoneBookReqSyncDate = createAction(
'[Messenger::Sync] PhoneBook Ready Req Sync Date',
props<{ syncStartDate: string }>()
);
/* PhoneBook Ready*/
export const phoneBookReady = createAction(
'[Messenger::Sync] PhoneBook Ready Sync.',
props<{ req: PhoneBookReadyRequest }>()
);
export const phoneBookReadySuccess = createAction(
'[Messenger::Sync] PhoneBook Ready Success',
props<{ res: PhoneBookReadyResponse }>()
);
export const phoneBookReadyFailure = createAction(
'[Messenger::Sync] PhoneBook Ready Failure',
props<{ error: any }>()
);
/* PhoneBook Ready*/
/* PhoneBook Ready Ok*/
export const phoneBookReadyOk = createAction(
'[Messenger::Sync] PhoneBook Ready OK.',
props<{ req: PhoneBookReadyOkRequest }>()
);
export const phoneBookReadyOkSuccess = createAction(
'[Messenger::Sync] PhoneBook Ready OK Success.',
props<{ res: PhoneBookReadyOkResponse }>()
);
export const phoneBookReadyOkFailure = createAction(
'[Messenger::Sync] PhoneBook Ready OK Failure',
props<{ error: any }>()
);
/* PhoneBook Ready Ok*/
/* PhoneBook Send Noti */
export const phoneBookSndNotification = createAction(
'[Messenger::Sync] PhoneBook Send Notification',
props<{ noti: PhoneBookSndNotification }>()
);
/* PhoneBook Send Noti */
/* PhoneBook Recv */
export const phoneBookRcv = createAction(
'[Messenger::Sync] PhoneBook Rcv request',
props<{ req: PhoneBookRcvRequest }>()
);
export const phoneBookRcvSuccess = createAction(
'[Messenger::Sync] PhoneBook Rcv Success',
props<PhoneBookRcvRequest>()
);
export const phoneBookRcvFailure = createAction(
'[Messenger::Sync] PhoneBook Rcv Failure',
props<PhoneBookRcvRequest>()
);
/* PhoneBook Send Noti */

View File

@ -1224,32 +1224,44 @@ export class Effects {
{ dispatch: false }
);
// phoneBookReadySuccess$ = createEffect(() =>
// this.actions$.pipe(
// ofType(phoneBookReadySuccess),
// tap(() => {
// this.syncProtocolService.notification$
// .pipe(
// take(1),
// timeout(30 * 1000),
// tap(noti => {
// switch (noti.SSVC_TYPE) {
// case SSVC_TYPE_SYNC_PHONEBOOK_SND_NOTI:
// {
// console.log(
// 'SSVC_TYPE_SYNC_PHONEBOOK_SND_NOTI',
// noti as PhoneBookSndNotification
// );
// }
// break;
// default:
// break;
// phoneBookReadySuccess$ = createEffect(
// () =>
// this.actions$.pipe(
// ofType(phoneBookReadySuccess),
// tap(() => {
// this.syncProtocolService.notification$
// .pipe(
// take(1),
// timeout(10000),
// tap(noti => {
// switch (noti.SSVC_TYPE) {
// case SSVC_TYPE_SYNC_PHONEBOOK_SND_NOTI:
// {
// console.log(
// 'SSVC_TYPE_SYNC_PHONEBOOK_SND_NOTI',
// noti as PhoneBookSndNotification
// );
// }
// break;
// default:
// break;
// }
// })
// )
// .subscribe(
// x => this.logger.debug(x),
// err => {
// if (err instanceof TimeoutError) {
// this.logger.debug('TimeoutError');
// return;
// }
// this.logger.debug(err);
// }
// })
// )
// .subscribe();
// })
// )
// );
// })
// ),
// { dispatch: false }
// );
phoneBookReadyOk$ = createEffect(() =>