Skip to content

Commit

Permalink
refactor: Move to /service folder
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Oct 3, 2023
1 parent 3665eef commit eeed25d
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions api.planx.uk/modules/webhooks/controller.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ServerError } from "../../errors";
import { CreateSessionEventController } from "./lowcalSessionEvents/schema";
import { CreateSessionEventController } from "./service/lowcalSessionEvents/schema";
import {
createSessionExpiryEvent,
createSessionReminderEvent,
} from "./lowcalSessionEvents/service";
import { CreatePaymentEventController } from "./paymentRequestEvents/schema";
} from "./service/lowcalSessionEvents";
import { SendSlackNotification } from "./service/sendNotification/types";
import { sendSlackNotification } from "./service/sendNotification";
import { CreatePaymentEventController } from "./service/paymentRequestEvents/schema";
import {
createPaymentExpiryEvents,
createPaymentInvitationEvents,
createPaymentReminderEvents,
} from "./paymentRequestEvents/service";
import { sendSlackNotification } from "./sendNotification/service";
import { SendSlackNotification } from "./sendNotification/types";
} from "./service/paymentRequestEvents";

export const sendSlackNotificationController: SendSlackNotification = async (
req,
Expand Down
6 changes: 3 additions & 3 deletions api.planx.uk/modules/webhooks/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
createSessionReminderEventController,
sendSlackNotificationController,
} from "./controller";
import { sendSlackNotificationSchema } from "./sendNotification/schema";
import { createPaymentEventSchema } from "./paymentRequestEvents/schema";
import { createSessionEventSchema } from "./lowcalSessionEvents/schema";
import { sendSlackNotificationSchema } from "./service/sendNotification/schema";
import { createPaymentEventSchema } from "./service//paymentRequestEvents/schema";
import { createSessionEventSchema } from "./service/lowcalSessionEvents/schema";

const router = Router();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import supertest from "supertest";
import app from "../../../server";
import { createScheduledEvent } from "../../../hasura/metadata";
import app from "../../../../server";
import { createScheduledEvent } from "../../../../hasura/metadata";

const { post } = supertest(app);

jest.mock("../../../hasura/metadata");
jest.mock("../../../../hasura/metadata");
const mockedCreateScheduledEvent = createScheduledEvent as jest.MockedFunction<
typeof createScheduledEvent
>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { addDays } from "date-fns";

import { createScheduledEvent } from "../../../hasura/metadata";
import { createScheduledEvent } from "../../../../hasura/metadata";
import {
DAYS_UNTIL_EXPIRY,
REMINDER_DAYS_FROM_EXPIRY,
} from "../../../saveAndReturn/utils";
} from "../../../../saveAndReturn/utils";
import { CreateSessionEvent } from "./schema";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod";
import { ValidatedRequestHandler } from "../../../shared/middleware/validate";
import { ScheduledEventResponse } from "../../../hasura/metadata";
import { ValidatedRequestHandler } from "../../../../shared/middleware/validate";
import { ScheduledEventResponse } from "../../../../hasura/metadata";

export const createSessionEventSchema = z.object({
body: z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import supertest from "supertest";
import app from "../../../server";
import { createScheduledEvent } from "../../../hasura/metadata";
import app from "../../../../server";
import { createScheduledEvent } from "../../../../hasura/metadata";
import { CreatePaymentEvent } from "./schema";

const { post } = supertest(app);

jest.mock("../../../hasura/metadata");
jest.mock("../../../../hasura/metadata");
const mockedCreateScheduledEvent = createScheduledEvent as jest.MockedFunction<
typeof createScheduledEvent
>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { addDays } from "date-fns";

import { createScheduledEvent } from "../../../hasura/metadata";
import { createScheduledEvent } from "../../../../hasura/metadata";
import {
DAYS_UNTIL_EXPIRY,
REMINDER_DAYS_FROM_EXPIRY,
} from "../../../saveAndReturn/utils";
} from "../../../../saveAndReturn/utils";
import { CreatePaymentEvent } from "./schema";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod";
import { ValidatedRequestHandler } from "../../../shared/middleware/validate";
import { ScheduledEventResponse } from "../../../hasura/metadata";
import { ValidatedRequestHandler } from "../../../../shared/middleware/validate";
import { ScheduledEventResponse } from "../../../../hasura/metadata";

export const createPaymentEventSchema = z.object({
body: z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import supertest from "supertest";
import app from "../../../server";
import app from "../../../../server";
import SlackNotify from "slack-notify";
import { BOPSBody, EmailBody, UniformBody } from "./types";
import { $admin } from "../../../client";
import { $admin } from "../../../../client";
import { CoreDomainClient } from "@opensystemslab/planx-core";

const mockSessionWithFee = {
Expand Down Expand Up @@ -35,7 +35,7 @@ const mockSessionWithResubmissionExemption = {
},
};

jest.mock<CoreDomainClient>("../../../client");
jest.mock<CoreDomainClient>("../../../../client");
const mockAdmin = jest.mocked($admin);

const mockSend = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
EventType,
UniformEventData,
} from "./types";
import { $admin } from "../../../client";
import { $admin } from "../../../../client";

export const sendSlackNotification = async (
data: EventData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod";
import { ValidatedRequestHandler } from "../../../shared/middleware/validate";
import { ValidatedRequestHandler } from "../../../../shared/middleware/validate";
import {
bopsSubmissionSchema,
emailSubmissionSchema,
Expand Down

0 comments on commit eeed25d

Please sign in to comment.