feat(regions): Add support for updating countries in a region (#6432)
**What** Add missing support for updating countries on the POST /admin/regions/:id route. Furthermore, the PR refactors how the normalization and validation was handled in both create and update scenarios. Finally, the PR adds a unique index on the country entity, which ensures at the DB level that we cannot have a duplicate country in the DB for a single region.
This commit is contained in:
@@ -7,21 +7,15 @@ export interface CreateRegionDTO {
|
||||
|
||||
export interface UpdateRegionDTO {
|
||||
id: string
|
||||
name?: string
|
||||
currency_code?: string
|
||||
countries?: string[]
|
||||
name?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface UpdatableRegionFields {
|
||||
currency_code?: string
|
||||
name?: string
|
||||
currency_code?: string
|
||||
countries?: string[]
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AddCountryToRegionDTO {
|
||||
region_id: string
|
||||
country_id: string
|
||||
}
|
||||
|
||||
export interface RemoveCountryFromRegionDTO extends AddCountryToRegionDTO {}
|
||||
|
||||
Reference in New Issue
Block a user