Skip to content

Commit

Permalink
fix(all-services): fix lint issues
Browse files Browse the repository at this point in the history
fix lint issues

gh-1969
  • Loading branch information
arpit1503khanna committed Apr 1, 2024
1 parent 45e7ddb commit b03bdd8
Show file tree
Hide file tree
Showing 31 changed files with 18,477 additions and 6,566 deletions.
24,772 changes: 18,362 additions & 6,410 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 7 additions & 31 deletions packages/cli/src/generators/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,52 +33,28 @@ export default class UpdateGenerator extends BaseUpdateGenerator<UpdateOptions>
}

async updateAllProjects() {
const types = [
'packages',
'services',
'sandbox',
'sandbox/chat-notification-pubnub-example/facade',
'sandbox/chat-notification-pubnub-example/services/chat-service',
'sandbox/chat-notification-pubnub-example/services/notifications-service',
'sandbox/chat-notification-socketio-example/facade',
'sandbox/chat-notification-socketio-example/services/chat-service',
'sandbox/chat-notification-socketio-example/services/notifications-service',
'sandbox/chat-notification-socketio-example/services/socketio-service',
'sandbox/telemed-app/backend/authentication-service',
'sandbox/telemed-app/backend/notification-service',
'sandbox/telemed-app/backend/video-conferencing-service',
];
const types = ['facades', 'services', 'packages'];
const monoRepo = this.destinationPath();
const ignore = [
'custom-sf-changelog',
'@sourceloop/ocr-parser',
'@sourceloop/search-client',
'@sourceloop/user-onboarding-client',
'@sourceloop/ocr-service',
'@sourceloop/ocr-s3-service',
'@sourceloop/cli',
];

for (const type of types) {
this.destinationRoot(monoRepo);
const folders = this._getDirectories(
const folders = await this._getDirectories(
this.destinationRoot(join('.', type)),
);
for (const folder of await folders) {
for (const folder of folders) {
this.destinationRoot(join(monoRepo, type, folder));

const pkgJs = this.fs.readJSON(
this.destinationPath(packageJsonFile),
) as AnyObject;

if (pkgJs) {
const ignoredPackage = ignore.find(pack => pack === pkgJs.name);
if (ignoredPackage) {
this.log(chalk.yellow(`Ignoring - ${pkgJs.name}`));
continue;
}
this.log(
chalk.cyan(
`Updating dependencies in the following project- ${pkgJs.name}`,
),
);

await this._updateSourceloopDep();
}
}
Expand Down
28 changes: 13 additions & 15 deletions sandbox/task-example/migrations/20230808104436-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,44 @@ var path = require('path');
var Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
Promise = options.Promise;
};

exports.up = function(db) {
exports.up = function (db) {
var filePath = path.join(__dirname, 'sqls', '20230808104436-init-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
return new Promise(function (resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
}).then(function (data) {
return db.runSql(data);
});
};

exports.down = function(db) {
exports.down = function (db) {
var filePath = path.join(__dirname, 'sqls', '20230808104436-init-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
return new Promise(function (resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
}).then(function (data) {
return db.runSql(data);
});
};

exports._meta = {
"version": 1
version: 1,
};
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ describe('AuditController(unit) ', () => {
);
sinon.assert.calledOnce(logFetch);
expect(controllerResult).to.have.length(1);
const controllerResultWithoutFilter = await controller.find(
includeArchivedLogs,
);
const controllerResultWithoutFilter =
await controller.find(includeArchivedLogs);
expect(controllerResultWithoutFilter).to.have.length(2);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,10 @@ export class LoginController {
let oldPassword = prevPassword;
let newPassword = password;
if (process.env.PRIVATE_DECRYPTION_KEY) {
const decryptedOldPassword = await this.userRepo.decryptPassword(
oldPassword,
);
const decryptedNewPassword = await this.userRepo.decryptPassword(
password,
);
const decryptedOldPassword =
await this.userRepo.decryptPassword(oldPassword);
const decryptedNewPassword =
await this.userRepo.decryptPassword(password);
oldPassword = decryptedOldPassword;
newPassword = decryptedNewPassword;
}
Expand Down
10 changes: 4 additions & 6 deletions services/bpmn-service/src/controllers/workflow.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ export class WorkflowController {
workflowDto: WorkflowDto,
): Promise<Workflow> {
try {
const workflowResponse = await this.workflowManagerService.createWorkflow(
workflowDto,
);
const workflowResponse =
await this.workflowManagerService.createWorkflow(workflowDto);

const entity = new Workflow({
workflowVersion: workflowResponse.version,
Expand Down Expand Up @@ -141,9 +140,8 @@ export class WorkflowController {
workflowDto: WorkflowDto,
@param.path.string('id') id: string,
): Promise<void> {
const workflowResponse = await this.workflowManagerService.updateWorkflow(
workflowDto,
);
const workflowResponse =
await this.workflowManagerService.updateWorkflow(workflowDto);

const entity = new Workflow({
workflowVersion: workflowResponse.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,8 @@ export class ProcessNotificationService {
}
//Create filter using criteria given in request
const filterUsers = this._createFilterBuilder(notificationSettings).build();
const notificationUsers = await this.notificationUserRepository.find(
filterUsers,
);
const notificationUsers =
await this.notificationUserRepository.find(filterUsers);
if (notificationUsers.length === 0) {
throw new HttpErrors.UnprocessableEntity(
ErrorKeys.NoUserFoundToSendNotification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ export class SubscriptionTransactionsController {
: new Date(),
planId: subscriptions?.planId,
};
const newSubscription = await this.subscriptionRepository.create(
subscriptionEntity,
);
const newSubscription =
await this.subscriptionRepository.create(subscriptionEntity);
const hostUrl = this.req.get('host');
const hostProtocol = this.req.protocol;
this.req.query.method = newSubscription.paymentMethod;
Expand Down Expand Up @@ -116,9 +115,8 @@ export class SubscriptionTransactionsController {
...chargeResponse,
subscriptionId: this.req.query.subscriptionId,
};
const chargeHelper = await this.gatewayHelper.subscriptionCharge(
chargeResponse,
);
const chargeHelper =
await this.gatewayHelper.subscriptionCharge(chargeResponse);
const hostUrl = this.req.get('host');
const hostProtocol = this.req.protocol;
const defaultUrl = `${hostProtocol}://${hostUrl}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,8 @@ export class TransactionsController {
if (transaction) {
const gatewayId = transaction.paymentGatewayId;
if (gatewayId) {
const paymentGateway = await this.paymentGatewaysRepository.findById(
gatewayId,
);
const paymentGateway =
await this.paymentGatewaysRepository.findById(gatewayId);
const gatewayType = paymentGateway?.gatewayType;
const hostUrl = this.req.get('host');
const hostProtocol = this.req.protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ export class PaypalProvider implements Provider<PayPalPaymentGateway> {
}
},
refund: async (transactionId: string, note?: string) => {
const transaction = await this.transactionsRepository.findById(
transactionId,
);
const transaction =
await this.transactionsRepository.findById(transactionId);
const orderDetails = await this.ordersRepository.findById(
transaction.orderId,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,8 @@ export class RazorpayProvider implements Provider<RazorpayPaymentGateway> {
},

refund: async (transactionId: string) => {
const transaction = await this.transactionsRepository.findById(
transactionId,
);
const transaction =
await this.transactionsRepository.findById(transactionId);
const paymentId = transaction?.res?.chargeResponse?.id;
const refund = await this.instance.payments.refund(paymentId);
transaction.res.refundDetails = refund;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ export class StripeProvider implements Provider<StripePaymentGateway> {
},

refund: async (transactionId: string) => {
const transaction = await this.transactionsRepository.findById(
transactionId,
);
const transaction =
await this.transactionsRepository.findById(transactionId);
const paymentId = await transaction?.res?.chargeResponse?.id;
const refund = await this.stripe.refunds.create({
charge: paymentId,
Expand Down
2 changes: 1 addition & 1 deletion services/reporting-service/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.0",
"info": {
"title": "@sourceloop/reporting-service",
"version": "0.8.2",
"version": "0.9.0",
"description": "reporting-service",
"contact": {
"name": "Sourav Bhargava",
Expand Down
4 changes: 2 additions & 2 deletions services/reporting-service/openapi.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "@sourceloop/reporting-service v0.8.2"
title: "@sourceloop/reporting-service v0.9.0"
language_tabs:
- javascript: JavaScript
- javascript--nodejs: Node.JS
Expand All @@ -16,7 +16,7 @@ headingLevel: 2

<!-- Generator: Widdershins v4.0.1 -->

<h1 id="-sourceloop-reporting-service">@sourceloop/reporting-service v0.8.2</h1>
<h1 id="-sourceloop-reporting-service">@sourceloop/reporting-service v0.9.0</h1>

> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ describe('DataSourcesController', () => {

it('lists columns for a data source', async () => {
const testDataSource = 'testDataSource';
const columns = await dataSourcesService.listDataSourceColumns(
testDataSource,
);
const columns =
await dataSourcesService.listDataSourceColumns(testDataSource);

await client
.get(`/data-sources/${testDataSource}/columns`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ describe('DataSourcesService', () => {

describe('listDataSourceColumns', () => {
it('should return a list of columns for a given data source', async () => {
const columns = await dataSourcesService.listDataSourceColumns(
'mockDataSource',
);
const columns =
await dataSourcesService.listDataSourceColumns('mockDataSource');
expect(columns).to.be.an.Array();
expect(columns[0].columnName).to.equal('mockColumn');
sinon.assert.calledOnce(
Expand All @@ -72,9 +71,8 @@ describe('DataSourcesService', () => {
dataTypeMap,
);

const columns = await dataSourcesService.listDataSourceColumns(
'mockDataSource',
);
const columns =
await dataSourcesService.listDataSourceColumns('mockDataSource');

expect(columns[0].dataType).to.equal(ResponseDataType.string);
});
Expand Down
17 changes: 10 additions & 7 deletions services/reporting-service/src/controllers/dashboard.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ export class DashboardController {
});

// Map widget IDs to their respective dashboards
const dashboardIdToWidgetIdsMap = allDashboardWidgets.reduce((map, dw) => {
if (!map[dw.dashboardId]) {
map[dw.dashboardId] = [];
}
map[dw.dashboardId].push(dw.widgetId);
return map;
}, {} as Record<string, string[]>);
const dashboardIdToWidgetIdsMap = allDashboardWidgets.reduce(
(map, dw) => {
if (!map[dw.dashboardId]) {
map[dw.dashboardId] = [];
}
map[dw.dashboardId].push(dw.widgetId);
return map;
},
{} as Record<string, string[]>,
);

// Construct the final result
const enhancedDashboards = dashboards.map(dashboard => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ export class ReportingServiceInitializer implements LifeCycleObserver {
async start(): Promise<void> {
this.bindDataSourcesService();
const mappingsDict = await this.fetchAndBindIngestionMappings();
const mappingsWithoutCustomListeners = await this.processServiceBindings(
mappingsDict,
);
const mappingsWithoutCustomListeners =
await this.processServiceBindings(mappingsDict);
this.bindMappingsAndServices(mappingsWithoutCustomListeners);
this.bindReportIngestionMessagingService();
this.application
Expand All @@ -65,10 +64,13 @@ export class ReportingServiceInitializer implements LifeCycleObserver {
Record<string, IngestionMapping>
> {
const allMappings = await this.ingestionMappingsRepo.find();
const mappingsDict = allMappings.reduce((acc, mapping) => {
acc[mapping.recordType] = mapping;
return acc;
}, {} as Record<string, IngestionMapping>);
const mappingsDict = allMappings.reduce(
(acc, mapping) => {
acc[mapping.recordType] = mapping;
return acc;
},
{} as Record<string, IngestionMapping>,
);

this.application
.bind(ReportingServiceComponentBindings.INGESTION_MAPPINGS_LIST)
Expand Down
Loading

0 comments on commit b03bdd8

Please sign in to comment.