feat: add verify to auth proto
All checks were successful
Publish / Publish npm package action (push) Successful in 17s
All checks were successful
Publish / Publish npm package action (push) Successful in 17s
This commit is contained in:
parent
80f62ccbe5
commit
fa73b7d5c6
17
gen/auth.ts
17
gen/auth.ts
@ -19,19 +19,34 @@ export interface SendOtpResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyOtpRequest {
|
||||
identifier: string;
|
||||
type: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface VerifyOtpResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
||||
|
||||
export interface AuthServiceClient {
|
||||
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
||||
|
||||
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
||||
}
|
||||
|
||||
export interface AuthServiceController {
|
||||
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
||||
|
||||
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
||||
}
|
||||
|
||||
export function AuthServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["sendOtp"];
|
||||
const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@teacinema/contracts",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Protocol Buffers contracts for microservices",
|
||||
"scripts": {
|
||||
"generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
||||
|
||||
@ -4,6 +4,7 @@ package auth.v1;
|
||||
|
||||
service AuthService {
|
||||
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
||||
rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
|
||||
}
|
||||
|
||||
message SendOtpRequest {
|
||||
@ -14,3 +15,15 @@ message SendOtpRequest {
|
||||
message SendOtpResponse {
|
||||
bool ok = 1;
|
||||
}
|
||||
|
||||
|
||||
message VerifyOtpRequest {
|
||||
string identifier = 1;
|
||||
string type = 2;
|
||||
string code = 3;
|
||||
}
|
||||
|
||||
message VerifyOtpResponse {
|
||||
string access_token = 1;
|
||||
string refresh_token = 2;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user