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": { "@ucap/ng-store-authentication": {
"version": "file:pack/ucap-ng-store-authentication-0.0.3.tgz", "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": { "@ucap/ng-store-chat": {
"version": "file:pack/ucap-ng-store-chat-0.0.3.tgz", "version": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
@ -2386,9 +2387,8 @@
"dev": true "dev": true
}, },
"@ucap/ng-store-group": { "@ucap/ng-store-group": {
"version": "file:pack/ucap-ng-store-group-0.0.3.tgz", "version": "file:pack/ucap-ng-store-group-0.0.4.tgz",
"integrity": "sha512-S/uognL5t0N5yQSoLOKHnvE01158wmP10p70Swfues9o88Ct55ABFOggDFdNcrHd9K7ei6S+objl3hIq/kg42w==", "integrity": "sha512-UTvyFws2Gl+yFAIAj76oHhsJHowH0sgZFtdNeLRYouB970z1yqUsPLczyZTH6INEukBclANwEzeZxM2+SaeiUg=="
"dev": true
}, },
"@ucap/ng-store-organization": { "@ucap/ng-store-organization": {
"version": "file:pack/ucap-ng-store-organization-0.0.3.tgz", "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-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-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-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-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": "file:pack/ucap-ng-ui-0.0.3.tgz",
"@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.14.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-buddy": "@ucap/ng-protocol-buddy",
"@ucap/ng-protocol-group": "@ucap/ng-protocol-group", "@ucap/ng-protocol-group": "@ucap/ng-protocol-group",
"@ucap/ng-protocol-sync": "@ucap/ng-protocol-sync", "@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", "name": "@ucap/ng-store-group",
"version": "0.0.3", "version": "0.0.4",
"publishConfig": { "publishConfig": {
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/" "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-group": "~0.0.1",
"@ucap/ng-protocol-sync": "~0.0.1", "@ucap/ng-protocol-sync": "~0.0.1",
"@ucap/ng-store-organization": "~0.0.1", "@ucap/ng-store-organization": "~0.0.1",
"@ucap/ng-store-authentication": "~0.0.1",
"tslib": "^1.10.0" "tslib": "^1.10.0"
} }
} }

View File

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

View File

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

View File

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