From 4cc31a17ab27fbccb56a83c2a4f48949bbd72ef4 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Fri, 19 Aug 2022 07:58:34 +0000 Subject: [PATCH] MemberReferrerService is added --- src/app/app.module.ts | 2 + .../member_referrer/member_referrer.module.ts | 16 ++ .../member_referrer/services/index.ts | 5 + .../services/member_referrer.service.ts | 156 ++++++++++++++++++ .../c2se/backend/member_referrer_pb.d.ts | 10 ++ .../proto/c2se/backend/member_referrer_pb.js | 39 +++++ 6 files changed, 228 insertions(+) create mode 100644 src/app/modules/polyglot/member_referrer/member_referrer.module.ts create mode 100644 src/app/modules/polyglot/member_referrer/services/index.ts create mode 100644 src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts create mode 100644 src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts create mode 100644 src/app/modules/proto/c2se/backend/member_referrer_pb.js diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e4bf6bd..74c5968 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -28,6 +28,7 @@ import { MemberBankDepositModule } from 'app/modules/polyglot/member_bank_deposi import { MemberBankWithdrawModule } from 'app/modules/polyglot/member_bank_withdraw/member_bank_withdraw.module'; import { MemberClassModule } from 'app/modules/polyglot/member_class/member_class.module'; import { MemberLevelModule } from 'app/modules/polyglot/member_level/member_level.module'; +import { MemberReferrerModule } from 'app/modules/polyglot/member_referrer/member_referrer.module'; import { MemberModule } from 'app/modules/polyglot/member/member.module'; import { SiteModule } from 'app/modules/polyglot/site/site.module'; @@ -70,6 +71,7 @@ const routerConfig: ExtraOptions = { MemberBankWithdrawModule.forRoot(), MemberClassModule.forRoot(), MemberLevelModule.forRoot(), + MemberReferrerModule.forRoot(), MemberModule.forRoot(), SiteModule.forRoot(), diff --git a/src/app/modules/polyglot/member_referrer/member_referrer.module.ts b/src/app/modules/polyglot/member_referrer/member_referrer.module.ts new file mode 100644 index 0000000..63da405 --- /dev/null +++ b/src/app/modules/polyglot/member_referrer/member_referrer.module.ts @@ -0,0 +1,16 @@ +import { ModuleWithProviders, NgModule } from '@angular/core'; + +import { SERVICES } from './services'; + +@NgModule({}) +export class MemberReferrerRootModule {} + +@NgModule({}) +export class MemberReferrerModule { + public static forRoot(): ModuleWithProviders { + return { + ngModule: MemberReferrerRootModule, + providers: [...SERVICES], + }; + } +} diff --git a/src/app/modules/polyglot/member_referrer/services/index.ts b/src/app/modules/polyglot/member_referrer/services/index.ts new file mode 100644 index 0000000..af8c96b --- /dev/null +++ b/src/app/modules/polyglot/member_referrer/services/index.ts @@ -0,0 +1,5 @@ +import { Type } from '@angular/core'; + +import { MemberReferrerService } from './member_referrer.service'; + +export const SERVICES: Type[] = [MemberReferrerService]; diff --git a/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts new file mode 100644 index 0000000..fa26a99 --- /dev/null +++ b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts @@ -0,0 +1,156 @@ +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/proto/protobuf/rpc_pb'; + +import { + ListMemberReferrersRequest, + ListMemberReferrersResponse, + CreateMemberReferrerRequest, + CreateMemberReferrerResponse, + UpdateMemberReferrerRequest, + UpdateMemberReferrerResponse, + DeleteMemberReferrerRequest, + DeleteMemberReferrerResponse, + GetMemberReferrerResponse, + GetMemberReferrerRequest, +} from 'app/modules/proto/c2se/member_referrer_pb'; +import { + SUBJECT_LIST_MEMBER_REFERRERS, + SUBJECT_CREATE_MEMBER_REFERRER, + SUBJECT_UPDATE_MEMBER_REFERRER, + SUBJECT_DELETE_MEMBER_REFERRER, + SUBJECT_GET_MEMBER_REFERRER, +} from 'app/modules/proto/c2se/backend/member_referrer_pb'; + +@Injectable({ + providedIn: 'root', +}) +export class MemberReferrerService { + /** + * Constructor + */ + constructor(private __natsService: NatsService) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Accessors + // ----------------------------------------------------------------------------------------------------- + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + createMemberReferrer(): Promise { + return new Promise( + (resolve, reject) => { + let req = new CreateMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_CREATE_MEMBER_REFERRER, + req.serializeBinary(), + CreateMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } + + listMemberReferrers(): Promise { + return new Promise( + (resolve, reject) => { + let req = new ListMemberReferrersRequest(); + + this.__natsService + .request( + SUBJECT_LIST_MEMBER_REFERRERS, + req.serializeBinary(), + ListMemberReferrersResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrersList()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + reject(e); + }); + } + ); + } + + getMemberReferrer(): Promise { + return new Promise((resolve, reject) => { + let req = new GetMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_GET_MEMBER_REFERRER, + req.serializeBinary(), + GetMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + }); + } + + updateMemberReferrer(): Promise { + return new Promise( + (resolve, reject) => { + let req = new UpdateMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_UPDATE_MEMBER_REFERRER, + req.serializeBinary(), + UpdateMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } + + deleteMemberReferrer(): Promise { + return new Promise( + (resolve, reject) => { + let req = new DeleteMemberReferrerRequest(); + + this.__natsService + .request( + SUBJECT_DELETE_MEMBER_REFERRER, + req.serializeBinary(), + DeleteMemberReferrerResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } +} diff --git a/src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts b/src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts new file mode 100644 index 0000000..4959224 --- /dev/null +++ b/src/app/modules/proto/c2se/backend/member_referrer_pb.d.ts @@ -0,0 +1,10 @@ +// package: bet.beteran.c2se.backend.member_level +// file: c2se/backend/member_level.proto + +import * as jspb from 'google-protobuf'; + +export const SUBJECT_CREATE_MEMBER_REFERRER: string; +export const SUBJECT_LIST_MEMBER_REFERRERS: string; +export const SUBJECT_GET_MEMBER_REFERRER: string; +export const SUBJECT_UPDATE_MEMBER_REFERRER: string; +export const SUBJECT_DELETE_MEMBER_REFERRER: string; diff --git a/src/app/modules/proto/c2se/backend/member_referrer_pb.js b/src/app/modules/proto/c2se/backend/member_referrer_pb.js new file mode 100644 index 0000000..20388bf --- /dev/null +++ b/src/app/modules/proto/c2se/backend/member_referrer_pb.js @@ -0,0 +1,39 @@ +// source: c2se/backend/member_referrer.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require("google-protobuf"); +var goog = jspb; +var global = function () { + return this || window || global || self || Function("return this")(); +}.call(null); + +goog.exportSymbol( + "proto.bet.beteran.c2se.backend.member_referrer", + null, + global +); + +proto.bet.beteran.c2se.backend.member_referrer = {}; + +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_CREATE_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.CreateMemberReferrer"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_LIST_MEMBER_REFERRERS = + "bet.beteran.c2se.backend.member_referrer.ListMemberReferrers"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_GET_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.GetMemberReferrer"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_UPDATE_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.UpdateMemberReferrer"; +proto.bet.beteran.c2se.backend.member_referrer.SUBJECT_DELETE_MEMBER_REFERRER = + "bet.beteran.c2se.backend.member_referrer.DeleteMemberReferrer"; + +goog.object.extend(exports, proto.bet.beteran.c2se.backend.member_referrer);