listMemberRequest 설정

This commit is contained in:
Park Byung Eun 2022-08-11 08:18:52 +00:00
parent 0e07f16204
commit 3dd1902deb
3 changed files with 41 additions and 32 deletions

View File

@ -8,13 +8,8 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { FormBuilder, FormControl } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import {
@ -40,11 +35,12 @@ import { MatDialog } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
import { Site } from 'app/modules/protobuf/models/domain/site_pb';
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
import {
Member,
MemberModel,
} from 'app/modules/protobuf/models/member/member_pb';
import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
ListMembersRequest,
ListMembersResponse,
} from 'app/modules/protobuf/c2se/backend/member_pb';
import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb';
@Component({
selector: 'partner-list',
templateUrl: './list.component.html',
@ -130,23 +126,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this._changeDetectorRef.markForCheck();
});
// Get the products
/* this.partners$ = this._partnerService.partners$; */
/* this._siteService
this._siteService
.listSites()
.then((result) => {
this.sites = result.getSitesList();
})
.catch((reson) => console.log(reson));
// Get the products
this.__memberService
.listMembers()
.then((result) => {
this.__members = result.getMembersList();
console.log('member list', this.__members);
})
.catch((reson) => console.log(reson)); */
this._activatedRoute.data.subscribe((data) => {
let listMemberResult: ListMembersResponse.Result = data['listPartner'];
this.listPartner$ = of(listMemberResult.getMembersList());
@ -186,12 +173,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
.pipe(
switchMap(() => {
this.isLoading = true;
return this._partnerService.getPartners(
this._paginator.pageIndex,
this._paginator.pageSize,
this._sort.active,
this._sort.direction
);
let req = new ListMembersRequest();
let paging = new Pagination();
paging.setPage(this._paginator.pageIndex);
paging.setPageSize(this._paginator.pageSize);
req.setPagination(paging);
req.setMemberClassId('4b014ef5-3bab-4413-aaf9-b0040a70ec77');
return of(this.__memberService.listMembers(req));
}),
map(() => {
this.isLoading = false;

View File

@ -6,7 +6,11 @@ import {
RouterStateSnapshot,
} from '@angular/router';
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
import {
ListMembersRequest,
ListMembersResponse,
} from 'app/modules/protobuf/c2se/backend/member_pb';
import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb';
import { catchError, Observable, throwError } from 'rxjs';
import { Partner } from '../models/partner';
@ -116,6 +120,10 @@ export class PartnerListResolver implements Resolve<any> {
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
return this.__memberService.listMembers();
let req = new ListMembersRequest();
req.setMemberClassId('4b014ef5-3bab-4413-aaf9-b0040a70ec77');
return this.__memberService.listMembers(req);
}
}

View File

@ -15,6 +15,7 @@ import {
SUBJECT_GET_MEMBER,
SUBJECT_GET_MEMBER_BY_USERNAME,
} from 'app/modules/protobuf/c2se/backend/member_pb';
import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb';
@Injectable({
providedIn: 'root',
@ -33,9 +34,19 @@ export class MemberService {
// @ Public methods
// -----------------------------------------------------------------------------------------------------
listMembers(): Promise<ListMembersResponse.Result> {
listMembers(req?: ListMembersRequest): Promise<ListMembersResponse.Result> {
return new Promise<ListMembersResponse.Result>((resolve, reject) => {
let req = new ListMembersRequest();
if (!req) {
req = new ListMembersRequest();
}
if (!req.getPagination()) {
let paging = new Pagination();
paging.setPageSize(10);
paging.setPage(0);
req.setPagination(paging);
}
this.__natsService
.request<ListMembersResponse.Result>(