Skip to content

Commit

Permalink
Rename IOutputDeduplicationService to IOutputService
Browse files Browse the repository at this point in the history
  • Loading branch information
AleDore committed Mar 1, 2024
1 parent 8d8ec0e commit baf816f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/output/__tests__/indexer-deduplication.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as TE from "fp-ts/TaskEither";
import { constVoid, pipe } from "fp-ts/lib/function";
import { IOutputDocument } from "../elasticsearch/elasticsearch";
import { IOutputDeduplicationService } from "../elasticsearch/service";
import { IOutputService } from "../elasticsearch/service";
import { indexerDeduplication } from "../indexer-deduplication";

const mockGet = jest.fn();
const mockInsert = jest.fn();
const mockUpdate = jest.fn();

const mockService: IOutputDeduplicationService = {
const mockService: IOutputService = {
get: mockGet,
insert: mockInsert,
update: mockUpdate
Expand Down
4 changes: 2 additions & 2 deletions src/output/__tests__/tablestorage-deduplication.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as tableUtils from "../../utils/tableStorage";

import { pipe } from "fp-ts/lib/function";
import { IOutputDocument } from "../elasticsearch/elasticsearch";
import { IOutputDeduplicationService } from "../elasticsearch/service";
import { IOutputService } from "../elasticsearch/service";
import { tableStorageDeduplication } from "../tablestorage-deduplication";
import { NonEmptyString } from "@pagopa/ts-commons/lib/strings";

Expand All @@ -19,7 +19,7 @@ const mockGet = jest.fn();
const mockInsert = jest.fn().mockImplementation(() => TE.right(void 0));
const mockUpdate = jest.fn().mockImplementation(() => TE.right(void 0));

const mockService: IOutputDeduplicationService = {
const mockService: IOutputService = {
get: mockGet,
insert: mockInsert,
update: mockUpdate
Expand Down
4 changes: 2 additions & 2 deletions src/output/elasticsearch/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
export type OutputClient = EL.Client;
export type OutputDataRead = GetResponse<IOutputDocument>;
export type OutputDataWrite = EL.estypes.Result;
export interface IOutputDeduplicationService {
export interface IOutputService {
readonly get: (
indexName: string,
document: IOutputDocument
Expand All @@ -32,7 +32,7 @@ export interface IOutputDeduplicationService {

export const getElasticSearchService = (
connectionString: string
): E.Either<Error, IOutputDeduplicationService> =>
): E.Either<Error, IOutputService> =>
pipe(
getElasticClient(connectionString),
E.map(client => ({
Expand Down
4 changes: 2 additions & 2 deletions src/output/indexer-deduplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as O from "fp-ts/Option";
import * as TE from "fp-ts/TaskEither";
import { flow, pipe } from "fp-ts/lib/function";
import { IOutputDocument } from "./elasticsearch/elasticsearch";
import { IOutputDeduplicationService } from "./elasticsearch/service";
import { IOutputService } from "./elasticsearch/service";

export const indexerDeduplication = (
indexName: string,
document: IOutputDocument
) => (service: IOutputDeduplicationService): TE.TaskEither<Error, void> =>
) => (service: IOutputService): TE.TaskEither<Error, void> =>
pipe(
service.get(indexName, document),
TE.map(O.some),
Expand Down
4 changes: 2 additions & 2 deletions src/output/service.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as TE from "fp-ts/TaskEither";
import { NonEmptyString } from "@pagopa/ts-commons/lib/strings";
import { IOutputDocument } from "./elasticsearch/elasticsearch";
import { IOutputDeduplicationService } from "./elasticsearch/service";
import { IOutputService } from "./elasticsearch/service";
import { indexerDeduplication } from "./indexer-deduplication";
import { tableStorageDeduplication } from "./tablestorage-deduplication";

export interface IDeduplicationStrategy {
readonly execute: (
indexName: string,
document: IOutputDocument
) => (service: IOutputDeduplicationService) => TE.TaskEither<Error, void>;
) => (service: IOutputService) => TE.TaskEither<Error, void>;
}

export const indexerDeduplicationStrategy: IDeduplicationStrategy = {
Expand Down
4 changes: 2 additions & 2 deletions src/output/tablestorage-deduplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import {
upsertTableDocument
} from "../utils/tableStorage";
import { IOutputDocument } from "./elasticsearch/elasticsearch";
import { IOutputDeduplicationService } from "./elasticsearch/service";
import { IOutputService } from "./elasticsearch/service";

export const tableStorageDeduplication = (
tableStorageConnectionString: NonEmptyString
) => (indexName: string, document: IOutputDocument) => (
service: IOutputDeduplicationService
service: IOutputService
): TE.TaskEither<Error, void> =>
pipe(
TE.Do,
Expand Down

0 comments on commit baf816f

Please sign in to comment.