MemberReferrerService is added

This commit is contained in:
병준 박 2022-08-19 07:58:34 +00:00
parent e2f15292dd
commit 4cc31a17ab
6 changed files with 228 additions and 0 deletions

View File

@ -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 { MemberBankWithdrawModule } from 'app/modules/polyglot/member_bank_withdraw/member_bank_withdraw.module';
import { MemberClassModule } from 'app/modules/polyglot/member_class/member_class.module'; import { MemberClassModule } from 'app/modules/polyglot/member_class/member_class.module';
import { MemberLevelModule } from 'app/modules/polyglot/member_level/member_level.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 { MemberModule } from 'app/modules/polyglot/member/member.module';
import { SiteModule } from 'app/modules/polyglot/site/site.module'; import { SiteModule } from 'app/modules/polyglot/site/site.module';
@ -70,6 +71,7 @@ const routerConfig: ExtraOptions = {
MemberBankWithdrawModule.forRoot(), MemberBankWithdrawModule.forRoot(),
MemberClassModule.forRoot(), MemberClassModule.forRoot(),
MemberLevelModule.forRoot(), MemberLevelModule.forRoot(),
MemberReferrerModule.forRoot(),
MemberModule.forRoot(), MemberModule.forRoot(),
SiteModule.forRoot(), SiteModule.forRoot(),

View File

@ -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<MemberReferrerRootModule> {
return {
ngModule: MemberReferrerRootModule,
providers: [...SERVICES],
};
}
}

View File

@ -0,0 +1,5 @@
import { Type } from '@angular/core';
import { MemberReferrerService } from './member_referrer.service';
export const SERVICES: Type<any>[] = [MemberReferrerService];

View File

@ -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<CreateMemberReferrerResponse.Result> {
return new Promise<CreateMemberReferrerResponse.Result>(
(resolve, reject) => {
let req = new CreateMemberReferrerRequest();
this.__natsService
.request<CreateMemberReferrerResponse.Result>(
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<ListMemberReferrersResponse.Result> {
return new Promise<ListMemberReferrersResponse.Result>(
(resolve, reject) => {
let req = new ListMemberReferrersRequest();
this.__natsService
.request<ListMemberReferrersResponse.Result>(
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<GetMemberReferrerResponse.Result> {
return new Promise<GetMemberReferrerResponse.Result>((resolve, reject) => {
let req = new GetMemberReferrerRequest();
this.__natsService
.request<GetMemberReferrerResponse.Result>(
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<UpdateMemberReferrerResponse.Result> {
return new Promise<UpdateMemberReferrerResponse.Result>(
(resolve, reject) => {
let req = new UpdateMemberReferrerRequest();
this.__natsService
.request<UpdateMemberReferrerResponse.Result>(
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<DeleteMemberReferrerResponse.Result> {
return new Promise<DeleteMemberReferrerResponse.Result>(
(resolve, reject) => {
let req = new DeleteMemberReferrerRequest();
this.__natsService
.request<DeleteMemberReferrerResponse.Result>(
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);
});
}
);
}
}

View File

@ -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;

View File

@ -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);