Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: normalize currency code #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions backend/data/medusa-eats-seed-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"prices": [
{
"amount": 12.99,
"currency_code": "USD"
"currency_code": "usd"
},
{
"amount": 9.99,
"currency_code": "EUR"
"currency_code": "eur"
}
]
}
Expand All @@ -73,11 +73,11 @@
"prices": [
{
"amount": 14.99,
"currency_code": "USD"
"currency_code": "usd"
},
{
"amount": 11.99,
"currency_code": "EUR"
"currency_code": "eur"
}
]
}
Expand All @@ -100,11 +100,11 @@
"prices": [
{
"amount": 9.99,
"currency_code": "USD"
"currency_code": "usd"
},
{
"amount": 7.99,
"currency_code": "EUR"
"currency_code": "eur"
}
]
}
Expand All @@ -127,11 +127,11 @@
"prices": [
{
"amount": 11.99,
"currency_code": "USD"
"currency_code": "usd"
},
{
"amount": 8.99,
"currency_code": "EUR"
"currency_code": "eur"
}
]
}
Expand All @@ -154,11 +154,11 @@
"prices": [
{
"amount": 5.99,
"currency_code": "USD"
"currency_code": "usd"
},
{
"amount": 4.99,
"currency_code": "EUR"
"currency_code": "eur"
}
]
}
Expand All @@ -181,11 +181,11 @@
"prices": [
{
"amount": 2.99,
"currency_code": "USD"
"currency_code": "usd"
},
{
"amount": 1.99,
"currency_code": "EUR"
"currency_code": "eur"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions backend/src/api/restaurants/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa";
import { MedusaError, remoteQueryObjectFromString } from "@medusajs/utils";
import { createRestaurantWorkflow } from "../../workflows/restaurant/workflows";
import zod from "zod";
import { CreateRestaurantDTO } from "../../types/restaurant/mutations";
import { getPricesByPriceSetId } from "../../utils/get-prices-by-price-set-id";
import { createRestaurantWorkflow } from "../../workflows/restaurant/workflows";

const schema = zod.object({
name: zod.string(),
Expand Down Expand Up @@ -97,7 +97,7 @@ export async function GET(req: MedusaRequest, res: MedusaResponse) {

const productsWithPrices = await getPricesByPriceSetId({
products,
currency_code: "EUR",
currency_code: "eur",
pricingService: req.scope.resolve("pricingModuleService"),
});

Expand Down
8 changes: 4 additions & 4 deletions backend/src/scripts/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default async function seedDemoData({ container }: ExecArgs) {
update: {
supported_currencies: [
{
currency_code: "EUR",
currency_code: "eur",
is_default: true,
},
{
Expand All @@ -88,7 +88,7 @@ export default async function seedDemoData({ container }: ExecArgs) {
regions: [
{
name: "Europe",
currency_code: "EUR",
currency_code: "eur",
countries,
payment_providers: ["pp_system_default"],
},
Expand Down Expand Up @@ -228,7 +228,7 @@ export default async function seedDemoData({ container }: ExecArgs) {
amount: 10,
},
{
currency_code: "EUR",
currency_code: "eur",
amount: 10,
},
{
Expand Down Expand Up @@ -266,7 +266,7 @@ export default async function seedDemoData({ container }: ExecArgs) {
amount: 10,
},
{
currency_code: "EUR",
currency_code: "eur",
amount: 10,
},
{
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/lib/actions/carts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use server";

import { metadata } from "@frontend/app/layout";
import { retrieveUser } from "@frontend/lib/data";
import { CartDTO, CreateCartDTO } from "@medusajs/types";
import { revalidateTag } from "next/cache";
Expand Down Expand Up @@ -67,7 +66,7 @@ export async function addToCart(
if (!cartId) {
cart = await createCart(
{
currency_code: "EUR",
currency_code: "eur",
},
restaurantId
);
Expand Down