bug fixed

This commit is contained in:
richard-loafle 2020-04-03 10:43:34 +09:00
parent d511140c1d
commit b3b75eef81
8 changed files with 43 additions and 51 deletions

8
package-lock.json generated
View File

@ -2378,7 +2378,8 @@
},
"@ucap/ng-store-authentication": {
"version": "file:pack/ucap-ng-store-authentication-0.0.3.tgz",
"integrity": "sha512-qgtPOxPDBWLytKNl4KxPJiAt+EhWk+7JZMiKGlrs/VqXgys4UHVv/OJhOC46d0ZBunswUsiEw4W97NXi+APW/w=="
"integrity": "sha512-qgtPOxPDBWLytKNl4KxPJiAt+EhWk+7JZMiKGlrs/VqXgys4UHVv/OJhOC46d0ZBunswUsiEw4W97NXi+APW/w==",
"dev": true
},
"@ucap/ng-store-chat": {
"version": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
@ -2386,9 +2387,8 @@
"dev": true
},
"@ucap/ng-store-group": {
"version": "file:pack/ucap-ng-store-group-0.0.3.tgz",
"integrity": "sha512-S/uognL5t0N5yQSoLOKHnvE01158wmP10p70Swfues9o88Ct55ABFOggDFdNcrHd9K7ei6S+objl3hIq/kg42w==",
"dev": true
"version": "file:pack/ucap-ng-store-group-0.0.4.tgz",
"integrity": "sha512-UTvyFws2Gl+yFAIAj76oHhsJHowH0sgZFtdNeLRYouB970z1yqUsPLczyZTH6INEukBclANwEzeZxM2+SaeiUg=="
},
"@ucap/ng-store-organization": {
"version": "file:pack/ucap-ng-store-organization-0.0.3.tgz",

View File

@ -167,7 +167,7 @@
"@ucap/ng-protocol-umg": "file:pack/ucap-ng-protocol-umg-0.0.1.tgz",
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.3.tgz",
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.3.tgz",
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.4.tgz",
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.3.tgz",
"@ucap/ng-ui": "file:pack/ucap-ng-ui-0.0.3.tgz",
"@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.14.tgz",

View File

@ -17,7 +17,8 @@
"@ucap/ng-protocol-buddy": "@ucap/ng-protocol-buddy",
"@ucap/ng-protocol-group": "@ucap/ng-protocol-group",
"@ucap/ng-protocol-sync": "@ucap/ng-protocol-sync",
"@ucap/ng-store-organization": "@ucap/ng-store-organization"
"@ucap/ng-store-organization": "@ucap/ng-store-organization",
"@ucap/ng-store-authentication": "@ucap/ng-store-authentication"
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-store-group",
"version": "0.0.3",
"version": "0.0.4",
"publishConfig": {
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
},
@ -16,6 +16,7 @@
"@ucap/ng-protocol-group": "~0.0.1",
"@ucap/ng-protocol-sync": "~0.0.1",
"@ucap/ng-store-organization": "~0.0.1",
"@ucap/ng-store-authentication": "~0.0.1",
"tslib": "^1.10.0"
}
}

View File

@ -1,5 +1,5 @@
import { createAction, props } from '@ngrx/store';
import { BuddyRequest, UserInfo } from '@ucap/protocol-sync';
import { UserInfo } from '@ucap/protocol-sync';
import {
AddRequest as BuddyAddRequest,
@ -13,10 +13,7 @@ import {
/**
* retrieve list of buddy
*/
export const buddy2 = createAction(
'[ucap::group::buddy] buddy2',
props<{ req: BuddyRequest }>()
);
export const buddy2 = createAction('[ucap::group::buddy] buddy2');
/**
* Success of buddy2 request
*/

View File

@ -11,24 +11,20 @@ import {
import { Injectable, Inject } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Dictionary } from '@ngrx/entity';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { GroupDetailData } from '@ucap/protocol-sync';
import {
AddResponse as BuddyAddResponse,
DelResponse as BuddyDelResponse,
UpdateResponse as BuddyUpdateResponse
} from '@ucap/protocol-buddy';
import { UserInfoSS } from '@ucap/protocol-query';
import { SyncProtocolService } from '@ucap/ng-protocol-sync';
import { BuddyProtocolService } from '@ucap/ng-protocol-buddy';
import { DepartmentSelector } from '@ucap/ng-store-organization';
import { LoginActions } from '@ucap/ng-store-authentication';
import * as groupActions from '../group/actions';
@ -54,12 +50,20 @@ import { _MODULE_CONFIG } from '../../config/token';
@Injectable()
export class Effects {
postLoginSuccessForBuddy2$ = createEffect(() => {
return this.actions$.pipe(
ofType(LoginActions.loginSuccess),
map(action => action.loginRes),
map(req => buddy2())
);
});
buddy2$ = createEffect(() => {
return this.actions$.pipe(
ofType(buddy2),
map(action => action.req),
switchMap(req => {
return this.syncProtocolService.buddy2(req).pipe(
withLatestFrom(this.store.pipe(select(BuddySelector.buddySyncDate))),
switchMap(([action, syncDate]) => {
return this.syncProtocolService.buddy2({ syncDate }).pipe(
map(res =>
buddy2Success({
buddyList: res.buddyInfos,
@ -76,15 +80,10 @@ export class Effects {
this.actions$.pipe(
ofType(add),
map(action => action.req),
withLatestFrom(this.store.pipe(select(BuddySelector.buddySyncDate))),
exhaustMap(([req, syncDate]) =>
exhaustMap(req =>
this.buddyProtocolService.add(req).pipe(
map((res: BuddyAddResponse) => {
return buddy2({
req: {
syncDate
}
});
return buddy2();
}),
catchError(error => of(addFailure({ error })))
)

View File

@ -11,10 +11,7 @@ import {
/**
* retrieve list of group
*/
export const groups = createAction(
'[ucap::group::group] groups',
props<{ req: GroupRequest }>()
);
export const groups = createAction('[ucap::group::group] groups');
/**
* Success of groups request
*/

View File

@ -24,6 +24,7 @@ import { GroupProtocolService } from '@ucap/ng-protocol-group';
import { SyncProtocolService } from '@ucap/ng-protocol-sync';
import { DepartmentSelector } from '@ucap/ng-store-organization';
import { LoginActions } from '@ucap/ng-store-authentication';
import { ModuleConfig } from '../../config/module-config';
import { _MODULE_CONFIG } from '../../config/token';
@ -53,12 +54,20 @@ import {
@Injectable()
export class Effects {
postLoginSuccessForGroups$ = createEffect(() => {
return this.actions$.pipe(
ofType(LoginActions.loginSuccess),
map(action => action.loginRes),
map(req => groups())
);
});
groups$ = createEffect(() => {
return this.actions$.pipe(
ofType(groups),
map(action => action.req),
concatMap(req => {
return this.syncProtocolService.group2(req).pipe(
withLatestFrom(this.store.pipe(select(GroupSelector.groupSyncDate))),
switchMap(([action, syncDate]) => {
return this.syncProtocolService.group2({ syncDate }).pipe(
map(res =>
groupsSuccess({
groupList: res.groupInfos,
@ -173,11 +182,8 @@ export class Effects {
moveMember$ = createEffect(() =>
this.actions$.pipe(
ofType(moveMember),
withLatestFrom(
this.store.pipe(select(GroupSelector.groups)),
this.store.pipe(select(GroupSelector.groupSyncDate))
),
exhaustMap(([action, groupList, syncDate]) => {
withLatestFrom(this.store.pipe(select(GroupSelector.groups))),
exhaustMap(([action, groupList]) => {
// copy to
const toGroup = groupList.find(g => g.seq === action.toGroup.seq);
@ -215,11 +221,7 @@ export class Effects {
})
.pipe(
map((resFrom: GroupUpdateResponse) => {
return groups({
req: {
syncDate
}
});
return groups();
}),
catchError(error => of(moveFromFailure({ error })))
);
@ -305,15 +307,10 @@ export class Effects {
this.actions$.pipe(
ofType(update),
map(action => action.req),
withLatestFrom(this.store.pipe(select(GroupSelector.groupSyncDate))),
concatMap(([req, syncDate]) =>
concatMap(req =>
this.groupProtocolService.update2(req).pipe(
map((res: GroupUpdateResponse) => {
return groups({
req: {
syncDate
}
});
return groups();
}),
catchError(error => of(updateFailure({ error })))
)