MemberService is added

This commit is contained in:
병준 박 2022-08-10 08:05:23 +00:00
parent a9fc35301d
commit 119ebac6ed
5 changed files with 118 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import { RegistComposeComponent } from '../compose/regist-compose.component';
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 { MembeerService } from 'app/modules/polyglot/member/services/member.service';
@Component({
selector: 'partner-list',
templateUrl: './list.component.html',
@ -91,6 +92,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _partnerService: PartnerService,
private __memberService: MembeerService,
private _siteService: SiteService,
private router: Router,
private _matDialog: MatDialog

View File

@ -1,5 +1,6 @@
import { Type } from '@angular/core';
import { IdentityService } from './identity.service';
import { MembeerService } from './member.service';
export const SERVICES: Type<any>[] = [IdentityService];
export const SERVICES: Type<any>[] = [IdentityService, MembeerService];

View File

@ -0,0 +1,100 @@
import { Injectable } from '@angular/core';
import { NatsService } from 'app/core/nats/services/nats.service';
import * as nats from 'nats.ws';
import { Error } from 'app/modules/protobuf/protobuf/rpc/error_pb';
import {
ListMembersRequest,
ListMembersResponse,
GetMemberByUsernameRequest,
GetMemberByUsernameResponse,
GetMemberRequest,
GetMemberResponse,
SUBJECT_LIST_MEMBERS,
SUBJECT_GET_MEMBER,
SUBJECT_GET_MEMBER_BY_USERNAME,
} from 'app/modules/protobuf/c2se/backend/member_pb';
@Injectable({
providedIn: 'root',
})
export class MembeerService {
/**
* Constructor
*/
constructor(private __natsService: NatsService) {}
// -----------------------------------------------------------------------------------------------------
// @ Accessors
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
listMembers(): Promise<ListMembersResponse.Result> {
return new Promise<ListMembersResponse.Result>((resolve, reject) => {
let req = new ListMembersRequest();
this.__natsService
.request<ListMembersResponse.Result>(
SUBJECT_LIST_MEMBERS,
req.serializeBinary(),
ListMembersResponse.deserializeBinary
)
.then((result) => {
console.log('success', result, result.getMembersList());
resolve(result);
})
.catch((e: Error) => {
console.log('failed', e);
reject(e);
});
});
}
getMember(id: string): Promise<GetMemberResponse.Result> {
return new Promise<GetMemberResponse.Result>((resolve, reject) => {
let req = new GetMemberRequest();
req.setId(id);
this.__natsService
.request<GetMemberResponse.Result>(
SUBJECT_GET_MEMBER,
req.serializeBinary(),
GetMemberResponse.deserializeBinary
)
.then((result) => {
console.log('success', result, result.getMember());
resolve(result);
})
.catch((e: Error) => {
console.log('failed', e);
reject(e);
});
});
}
getMemberByUsername(): Promise<GetMemberByUsernameResponse.Result> {
return new Promise<GetMemberByUsernameResponse.Result>(
(resolve, reject) => {
let req = new GetMemberByUsernameRequest();
this.__natsService
.request<GetMemberByUsernameResponse.Result>(
SUBJECT_GET_MEMBER_BY_USERNAME,
req.serializeBinary(),
GetMemberByUsernameResponse.deserializeBinary
)
.then((result) => {
resolve(result);
})
.catch((e: Error) => {
console.log('failed', e);
reject(e);
});
}
);
}
}

View File

@ -8,6 +8,12 @@ import * as protobuf_pagination_search_pb from '../../protobuf/pagination/search
import * as protobuf_pagination_sort_pb from '../../protobuf/pagination/sort_pb';
import * as models_member_member_pb from '../../models/member/member_pb';
export const SUBJECT_LIST_MEMBERS: string;
export const SUBJECT_GET_MEMBER: string;
export const SUBJECT_GET_MEMBER_BY_USERNAME: string;
export class ListMembersRequest extends jspb.Message {
hasPagination(): boolean;
clearPagination(): void;

View File

@ -72,6 +72,14 @@ goog.exportSymbol(
null,
global
);
proto.bet.beteran.c2se.backend.member.SUBJECT_LIST_MEMBERS =
"bet.beteran.c2se.backend.member.ListMembers";
proto.bet.beteran.c2se.backend.member.SUBJECT_GET_MEMBER =
"bet.beteran.c2se.backend.member.GetMember";
proto.bet.beteran.c2se.backend.member.SUBJECT_GET_MEMBER_BY_USERNAME =
"bet.beteran.c2se.backend.member.GetMemberByUsername";
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a