Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmthecoder committed Mar 30, 2024
1 parent 2e893f2 commit 85fc732
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
12 changes: 4 additions & 8 deletions packages/logging-service/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { AppController } from './app.controller';
import { AppService } from './app.service';
import { LoggingModule } from './modules/logging/logging.module';
import { ClientsModule, Transport } from '@nestjs/microservices';
import * as path from 'path';
import { JUNO_LOGGING_PACKAGE_NAME } from 'juno-proto/dist/gen/logging';
import { LoggingProtoFile } from 'juno-proto';

@Module({
imports: [
Expand All @@ -13,13 +14,8 @@ import * as path from 'path';
name: 'LOGGING_SERVICE',
transport: Transport.GRPC,
options: {
package: 'error_logging',
protoPath: path.join(
__dirname,
'../../',
'juno-proto/dist/definitions',
'error_logging.proto',
),
package: JUNO_LOGGING_PACKAGE_NAME,
protoPath: [LoggingProtoFile],
},
},
]),
Expand Down
15 changes: 0 additions & 15 deletions packages/proto/definitions/error_logging.proto

This file was deleted.

10 changes: 9 additions & 1 deletion packages/proto/definitions/logging.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ package juno.logging;

service LoggingService {
rpc recordInfo(RecordInfoRequest) returns (RecordInfoResponse);
rpc recordError (ErrorLogRequest) returns (ErrorLogResponse) {}
}

message RecordInfoRequest {
string message = 1;
}

message RecordInfoResponse {}
message RecordInfoResponse {}

message ErrorLogRequest {
string message = 1;
}

// TODO: to be defined later
message ErrorLogResponse {}
18 changes: 17 additions & 1 deletion packages/proto/src/gen/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ export interface RecordInfoRequest {

export interface RecordInfoResponse {}

export interface ErrorLogRequest {
message: string;
}

/** TODO: to be defined later */
export interface ErrorLogResponse {}

export const JUNO_LOGGING_PACKAGE_NAME = 'juno.logging';

export interface LoggingServiceClient {
recordInfo(request: RecordInfoRequest): Observable<RecordInfoResponse>;

recordError(request: ErrorLogRequest): Observable<ErrorLogResponse>;
}

export interface LoggingServiceController {
Expand All @@ -23,11 +32,18 @@ export interface LoggingServiceController {
| Promise<RecordInfoResponse>
| Observable<RecordInfoResponse>
| RecordInfoResponse;

recordError(
request: ErrorLogRequest,
):
| Promise<ErrorLogResponse>
| Observable<ErrorLogResponse>
| ErrorLogResponse;
}

export function LoggingServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ['recordInfo'];
const grpcMethods: string[] = ['recordInfo', 'recordError'];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
Expand Down

0 comments on commit 85fc732

Please sign in to comment.