Skip to content

Commit

Permalink
chore: moving earn to its own app module
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Dec 19, 2023
1 parent fbcaf2e commit 99d5e9e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { intraledgerPaymentSendWalletIdForBtcWallet } from "./send-intraledger"
import { intraledgerPaymentSendWalletIdForBtcWallet } from "../payments/send-intraledger"

import { getRewardsConfig, OnboardingEarn } from "@/config"

Expand Down
1 change: 1 addition & 0 deletions core/api/src/app/earn/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./add-earn"
3 changes: 3 additions & 0 deletions core/api/src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as AuthenticationMod from "./authentication"
import * as AdminMod from "./admin"
import * as CallbackMod from "./callback"
import * as CommMod from "./comm"
import * as EarnMod from "./earn"
import * as LightningMod from "./lightning"
import * as OnChainMod from "./on-chain"
import * as PricesMod from "./prices"
Expand All @@ -20,6 +21,7 @@ const allFunctions = {
Admin: { ...AdminMod },
Callback: { ...CallbackMod },
Comm: { ...CommMod },
Earn: { ...EarnMod },
Lightning: { ...LightningMod },
OnChain: { ...OnChainMod },
Prices: { ...PricesMod },
Expand Down Expand Up @@ -49,6 +51,7 @@ export const {
Admin,
Callback,
Comm,
Earn,
Lightning,
OnChain,
Prices,
Expand Down
1 change: 0 additions & 1 deletion core/api/src/app/payments/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./add-earn"
export * from "./get-protocol-fee"
export * from "./reimburse-fee"
export * from "./send-intraledger"
Expand Down
4 changes: 2 additions & 2 deletions core/api/src/graphql/public/root/mutation/quiz-completed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Payments } from "@/app"
import { Earn } from "@/app"
import { mapAndParseErrorForGqlResponse } from "@/graphql/error-map"
import { GT } from "@/graphql/index"

Expand Down Expand Up @@ -26,7 +26,7 @@ const QuizCompletedMutation = GT.Field<
resolve: async (_, args, { domainAccount, ip }) => {
const { id } = args.input

const question = await Payments.addEarn({
const question = await Earn.addEarn({
quizQuestionId: id,
accountId: domainAccount.id,
ip,
Expand Down
6 changes: 3 additions & 3 deletions core/api/test/integration/app/payments/add-earn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import crypto from "crypto"

import { Payments } from "@/app"
import { Earn } from "@/app"

import { InvalidIpMetadataError } from "@/domain/errors"
import {
Expand All @@ -18,7 +18,7 @@ afterEach(async () => {

describe("addEarn", () => {
it("fails if ip is undefined", async () => {
const result = await Payments.addEarn({
const result = await Earn.addEarn({
accountId: crypto.randomUUID() as AccountId,
quizQuestionId: "fakeQuizQuestionId",
ip: undefined,
Expand All @@ -39,7 +39,7 @@ describe("addEarn", () => {
consume: () => new RateLimiterExceededError(),
})

const result = await Payments.addEarn({
const result = await Earn.addEarn({
accountId: crypto.randomUUID() as AccountId,
quizQuestionId: "fakeQuizQuestionId",
ip: "192.168.13.13" as IpAddress,
Expand Down

0 comments on commit 99d5e9e

Please sign in to comment.