FEAT: terms of use

This commit is contained in:
Arthur Simas
2022-07-11 02:13:33 -03:00
parent cc3b34d87e
commit db78ee3d8b
8 changed files with 127 additions and 8 deletions
@@ -0,0 +1,33 @@
import { OnModuleInit, Inject, Injectable } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import { DadosferaLogger } from 'dadosfera-logs';
import { lastValueFrom } from 'rxjs';
import { ProtoServices } from 'protospack-v2/dist/lib/Duc';
import { TermsOfUseProtoService as TermsOfUseServiceInterface } from 'protospack-v2/dist/lib/Duc/interfaces/write-service';
import { TermsOfUseAcceptRequest } from 'protospack-v2/dist/lib/Duc/interfaces/messages';
@Injectable()
export class TermsOfUseClientService implements OnModuleInit {
logger: any;
private termsOfUseService: TermsOfUseServiceInterface;
constructor(
@Inject(DadosferaLogger)
dadosferaLogger: DadosferaLogger,
@Inject('DUC_PACKAGE') private readonly grpcClient: ClientGrpc,
) {
this.logger = dadosferaLogger.logger;
}
onModuleInit() {
this.termsOfUseService =
this.grpcClient.getService<TermsOfUseServiceInterface>(
ProtoServices.TermsOfUseProtoService,
);
}
async accept(data: TermsOfUseAcceptRequest) {
return lastValueFrom(this.termsOfUseService.TermsOfUseAccept(data));
}
}