Skip to content

Commit

Permalink
Rename flyover service
Browse files Browse the repository at this point in the history
  • Loading branch information
lserra-iov committed May 3, 2024
1 parent b5484a1 commit fcd93fe
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/__tests__/unit/register.controller.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {RegisterService} from '../../services/register.service';
import {RegisterPayload} from '../../models';
import {SessionRepository} from '../../repositories';
import * as constants from '../../constants';
import {RegisterFlyoverService} from '../../services';
import {FlyoverService} from '../../services';

describe('RegisterController', () => {
let registerController: RegisterController;
let registerService: RegisterService;
let registerFlyoverService: RegisterFlyoverService;
let flyoverService: FlyoverService;
let sessionRepository: StubbedInstanceWithSinonAccessor<SessionRepository>;
let context: ExpressContextStub;
let register: sinon.SinonStub;
Expand Down Expand Up @@ -47,14 +47,14 @@ describe('RegisterController', () => {
function reset() {
context = stubExpressContext();
registerService = createStubInstance(RegisterService);
registerFlyoverService = createStubInstance(RegisterFlyoverService);
flyoverService = createStubInstance(FlyoverService);
sessionRepository = createStubInstance(SessionRepository);
get = sessionRepository.get as sinon.SinonStub;
register = registerService.register as sinon.SinonStub;
registerFlyover = registerFlyoverService.register as sinon.SinonStub;
registerFlyover = flyoverService.register as sinon.SinonStub;
registerController = new RegisterController(
registerService,
registerFlyoverService,
flyoverService,
context.response,
sessionRepository,
);
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/unit/tx-status.controller.unit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {TxStatusController} from "../../controllers";
import {PeginStatusService, PegoutStatusService, RegisterFlyoverService} from "../../services";
import {PeginStatusService, PegoutStatusService, FlyoverService} from "../../services";
import {createStubInstance, expect, StubbedInstanceWithSinonAccessor} from "@loopback/testlab";
import {BtcPeginStatus, PeginStatus, RskPeginStatus, Status, TxStatus, TxStatusType} from "../../models";
import {PeginStatus as RskPeginStatusEnum} from "../../models/rsk/pegin-status-data.model";
Expand All @@ -18,12 +18,12 @@ describe('Controller: Tx Status', () => {
let txStatusController: TxStatusController;
let peginStatusService: StubbedInstanceWithSinonAccessor<PeginStatusService>;
let pegoutStatusService: StubbedInstanceWithSinonAccessor<PegoutStatusService>;
let flyoverService: StubbedInstanceWithSinonAccessor<RegisterFlyoverService>;
let flyoverService: StubbedInstanceWithSinonAccessor<FlyoverService>;

function resetController() {
peginStatusService = createStubInstance(PeginStatusService);
pegoutStatusService = createStubInstance(PegoutStatusService);
flyoverService = createStubInstance(RegisterFlyoverService);
flyoverService = createStubInstance(FlyoverService);
txStatusController = new TxStatusController(peginStatusService, pegoutStatusService, flyoverService);
}
function getMockedPeginStatus(mockedTxId: string,status: Status): PeginStatus {
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/register.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Response, RestBindings, getModelSchemaRef, post, requestBody} from '@loo
import {repository} from '@loopback/repository';
import {ServicesBindings} from '../dependency-injection-bindings';
import {RegisterPayload} from '../models';
import {RegisterService, RegisterFlyoverService} from '../services';
import {RegisterService, FlyoverService} from '../services';
import {SessionRepository} from '../repositories';
import * as constants from '../constants';

Expand All @@ -14,8 +14,8 @@ export class RegisterController {
constructor(
@inject(ServicesBindings.REGISTER_SERVICE)
protected registerService: RegisterService,
@inject(ServicesBindings.REGISTER_FLYOVER_SERVICE)
protected registerFlyoverService: RegisterFlyoverService,
@inject(ServicesBindings.FLYOVER_SERVICE)
protected flyoverService: FlyoverService,
@inject(RestBindings.Http.RESPONSE)
private response: Response,
@repository(SessionRepository)
Expand Down Expand Up @@ -47,7 +47,7 @@ export class RegisterController {
await this.registerService.register(payload);
}
if (provider) {
await this.registerFlyoverService.register(payload);
await this.flyoverService.register(payload);
}
return this.response.status(200).send();
}
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/tx-status.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {inject} from "@loopback/core";
import {PeginStatus, Status, TxStatus, TxStatusType} from '../models';
import {PeginStatusError} from "../models/pegin-status-error.model";
import {ServicesBindings} from "../dependency-injection-bindings";
import {PeginStatusService, PegoutStatusService, RegisterFlyoverService} from "../services";
import {PeginStatusService, PegoutStatusService, FlyoverService} from "../services";
import {PegoutStatus} from "../models/rsk/pegout-status-data-model";
import {ensure0x, remove0x} from '../utils/hex-utils';
import {isValidTxId} from '../utils/tx-validator';
Expand All @@ -19,8 +19,8 @@ export class TxStatusController {
protected peginStatusService: PeginStatusService,
@inject(ServicesBindings.PEGOUT_STATUS_SERVICE)
protected pegoutStatusService: PegoutStatusService,
@inject(ServicesBindings.REGISTER_FLYOVER_SERVICE)
protected registerFlyoverService: RegisterFlyoverService,
@inject(ServicesBindings.FLYOVER_SERVICE)
protected flyoverService: FlyoverService,
) {
this.logger = getLogger('TxStatusController');
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export class TxStatusController {

try {
this.logger.debug(`[getTxStatus] trying to get a flyover status with txHash: ${txId}`);
const flyoverStatus = await this.registerFlyoverService.getFlyoverStatus(txId);
const flyoverStatus = await this.flyoverService.getFlyoverStatus(txId);
if (flyoverStatus) {
this.logger.debug(`[getTxStatus] Flyover status got for txId ${txId} - Status: ${flyoverStatus.status}`);
if (flyoverStatus.type === TX_TYPE_PEGIN) {
Expand Down
2 changes: 1 addition & 1 deletion src/dependency-injection-bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export const ServicesBindings = {
UTXO_PROVIDER_SERVICE: 'services.UtxoProvider',
REGISTER_SERVICE: 'services.RegisterService',
FEATURES_SERVICE: 'services.FeaturesDataService',
REGISTER_FLYOVER_SERVICE: 'services.RegisterFlyoverService',
FLYOVER_SERVICE: 'services.FlyoverService',
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const FlyoverStatusSchema = new mongoose.Schema({

const FlyoverStatusConnector = mongoose.model<FlyoverStatusMongoModel>('FlyoverStatuses', FlyoverStatusSchema);

export class RegisterFlyoverService extends MongoDbDataService<FlyoverStatusModel, FlyoverStatusMongoModel> {
export class FlyoverService extends MongoDbDataService<FlyoverStatusModel, FlyoverStatusMongoModel> {

rskNodeService = new RskNodeService();

protected getLoggerName(): string {
return 'registerFlyService';
return 'flyoverService';
}

protected getConnector(): mongoose.Model<FlyoverStatusMongoModel, {}, {}> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export * from './sync-status-data.service';
export * from './rsk-node.service';
export * from './register.service';
export * from './features-data.service';
export * from './register-flyover.service';
export * from './flyover.service';

0 comments on commit fcd93fe

Please sign in to comment.