chore(): Remove default_locale from StoreLocale (#14300)

## Summary

**What** — What changes are introduced in this PR?

Remove `default_locale` from Store <> Locale relation

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Nicolas Gorga
2025-12-15 06:05:46 -03:00
committed by GitHub
parent dd3eb10b1a
commit 8964a03fa1
23 changed files with 63 additions and 226 deletions

View File

@@ -1,4 +1,4 @@
import { ContainerRegistrationKeys, normalizeLocale } from "@medusajs/utils"
import { normalizeLocale } from "@medusajs/utils"
import type {
MedusaNextFunction,
MedusaRequest,
@@ -35,30 +35,5 @@ export async function applyLocale(
return next()
}
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
const {
data: [store],
} = await query.graph(
{
entity: "store",
fields: ["id", "supported_locales"],
pagination: {
take: 1,
},
},
{
cache: {
enable: true,
},
}
)
if (store?.supported_locales?.length) {
req.locale = store.supported_locales.find(
(locale) => locale.is_default
)?.locale_code
return next()
}
return next()
}

View File

@@ -55,10 +55,6 @@ export interface AdminStoreLocale {
* The ID of the store that the locale belongs to.
*/
store_id: string
/**
* Whether the locale is the default locale for the store.
*/
is_default: boolean
/**
* The locale's details.
*/

View File

@@ -26,10 +26,6 @@ export interface AdminUpdateStoreSupportedLocale {
* The locale's BCP 47 language tag.
*/
locale_code: string
/**
* Whether this locale is the default locale in the store.
*/
is_default?: boolean
}
/**

View File

@@ -40,10 +40,6 @@ export interface StoreLocaleDTO {
* The locale code of the store locale.
*/
locale_code: string
/**
* Whether the locale is the default one for the store.
*/
is_default: boolean
/**
* The store ID associated with the locale.
*/

View File

@@ -14,10 +14,6 @@ export interface CreateStoreLocaleDTO {
* The locale code of the store locale.
*/
locale_code: string
/**
* Whether the locale is the default one for the store.
*/
is_default?: boolean
}
/**