Skip to content

Commit

Permalink
Fix lint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
manelcecs authored and Pl217 committed Nov 17, 2023
1 parent 216113c commit b960eb7
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { type FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { Op } from '@unocha/hpc-api-core/src/db/util/conditions';
import { InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model';
import { type InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model';
import { Service } from 'typedi';
import { FlowExternalReference } from '../flows/graphql/types';
import { type FlowExternalReference } from '../flows/graphql/types';

@Service()
export class ExternalReferenceService {
Expand All @@ -19,11 +19,11 @@ export class ExternalReferenceService {

const externalReferencesMap = new Map<number, any>();

flowIDs.forEach((flowID) => {
for (const flowID of flowIDs) {
externalReferencesMap.set(flowID, []);
});
}

externalReferences.forEach((externalReference) => {
for (const externalReference of externalReferences) {
const flowID = externalReference.flowID;
const externalReferenceMapped =
this.mapExternalReferenceToExternalReferenceFlows(externalReference);
Expand All @@ -33,7 +33,7 @@ export class ExternalReferenceService {
}

externalReferencesMap.get(flowID).push(externalReferenceMapped);
});
}

return externalReferencesMap;
}
Expand Down
14 changes: 7 additions & 7 deletions src/domain-services/flow-link/flow-link-service.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { Database } from '@unocha/hpc-api-core/src/db/type';
import { type FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { type Database } from '@unocha/hpc-api-core/src/db/type';
import { Op } from '@unocha/hpc-api-core/src/db/util/conditions';
import { InstanceOfModel } from '@unocha/hpc-api-core/src/db/util/types';
import { type InstanceOfModel } from '@unocha/hpc-api-core/src/db/util/types';
import { Service } from 'typedi';

@Service()
export class FlowLinkService {
async getFlowLinksForFlows(
flowIds: FlowId[],
models: Database
): Promise<Map<number, InstanceOfModel<Database['flowLink']>[]>> {
): Promise<Map<number, Array<InstanceOfModel<Database['flowLink']>>>> {
const flowLinks = await models.flowLink.find({
where: {
childID: {
Expand All @@ -21,11 +21,11 @@ export class FlowLinkService {
// Group flowLinks by flow ID for easy mapping
const flowLinksMap = new Map<
number,
InstanceOfModel<Database['flowLink']>[]
Array<InstanceOfModel<Database['flowLink']>>
>();

// Populate the map with flowLinks for each flow
flowLinks.forEach((flowLink) => {
for (const flowLink of flowLinks) {
const flowId = flowLink.childID.valueOf();

if (!flowLinksMap.has(flowId)) {
Expand All @@ -35,7 +35,7 @@ export class FlowLinkService {
const flowLinksForFlow = flowLinksMap.get(flowId)!;

flowLinksForFlow.push(flowLink);
});
}

return flowLinksMap;
}
Expand Down
4 changes: 2 additions & 2 deletions src/domain-services/flow-object/flow-object-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { type FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { Op } from '@unocha/hpc-api-core/src/db/util/conditions';
import { Service } from 'typedi';

Expand Down
4 changes: 2 additions & 2 deletions src/domain-services/flow-object/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { InstanceOfModel } from '@unocha/hpc-api-core/src/db/util/types';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { type InstanceOfModel } from '@unocha/hpc-api-core/src/db/util/types';

export type FlowObject = InstanceOfModel<Database['flowObject']>;
4 changes: 2 additions & 2 deletions src/domain-services/flows/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { type InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model';

export type FlowEntity = InstanceDataOfModel<Database['flow']>;
4 changes: 2 additions & 2 deletions src/domain-services/flows/strategy/flow-search-strategy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { FlowEntity } from '../model';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { type FlowEntity } from '../model';

export interface FlowSearchStrategyResponse {
flows: FlowEntity[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { Service } from 'typedi';
import { FlowService } from '../../flow-service';
import {
FlowSearchStrategy,
FlowSearchStrategyResponse,
type FlowSearchStrategy,
type FlowSearchStrategyResponse,
} from '../flow-search-strategy';

@Service()
Expand Down
14 changes: 7 additions & 7 deletions src/domain-services/report-details/report-detail-service.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Database } from '@unocha/hpc-api-core/src/db';
import { FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { type Database } from '@unocha/hpc-api-core/src/db';
import { type FlowId } from '@unocha/hpc-api-core/src/db/models/flow';
import { Op } from '@unocha/hpc-api-core/src/db/util/conditions';
import { InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model';
import { type InstanceDataOfModel } from '@unocha/hpc-api-core/src/db/util/raw-model';
import { Service } from 'typedi';
import { ReportDetail } from './graphql/types';
import { type ReportDetail } from './graphql/types';
@Service()
export class ReportDetailService {
async getReportDetailsForFlows(
flowIds: FlowId[],
models: Database
): Promise<Map<number, ReportDetail[]>> {
const reportDetails: InstanceDataOfModel<Database['reportDetail']>[] =
const reportDetails: Array<InstanceDataOfModel<Database['reportDetail']>> =
await models.reportDetail.find({
where: {
flowID: {
Expand All @@ -22,7 +22,7 @@ export class ReportDetailService {

const reportDetailsMap = new Map<number, ReportDetail[]>();

flowIds.forEach((flowId: FlowId) => {
for (const flowId of flowIds) {
if (!reportDetailsMap.has(flowId)) {
reportDetailsMap.set(flowId, []);
}
Expand All @@ -35,7 +35,7 @@ export class ReportDetailService {
this.mapReportDetailsToFlowReportDetail(reportDetail);
reportDetailsMap.get(flowId)?.push(reportDetailMapped);
}
});
}

return reportDetailsMap;
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/graphql/pagination.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Op } from '@unocha/hpc-api-core/src/db/util/conditions';
import { createBrandedValue } from '@unocha/hpc-api-core/src/util/types';
import { ObjectType, Field, ArgsType } from 'type-graphql';
import { ArgsType, Field, ObjectType } from 'type-graphql';

export type SortOrder = 'asc' | 'desc';

Expand Down Expand Up @@ -46,7 +46,7 @@ export function prepareConditionFromCursor(

if (afterCursor || beforeCursor) {
const isAscending = sortCondition.order === 'asc';
const cursorValue = afterCursor || beforeCursor;
const cursorValue = afterCursor ?? beforeCursor;

let op;
if (isAscending) {
Expand Down

0 comments on commit b960eb7

Please sign in to comment.