Skip to content

Commit

Permalink
fix(publi-service-metadata): correction message d'erreur type et géné…
Browse files Browse the repository at this point in the history
…alogie de ressource #528
  • Loading branch information
ocruze committed Nov 26, 2024
1 parent 2a6ef44 commit 1c3602a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions assets/entrepot/pages/service/common-schemas-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class CommonSchemasValidation {
projection: yup.string().required(tValidMD("metadatas.projection_error")),
// encoding: yup.string().required(tValidMD("metadatas.encoding_error")),
resolution: yup.string(),
hierarchy_level: yup.string().required(tValidMD("metadatas.hierarchy_level_error")),
})
.required();
}
Expand Down
2 changes: 1 addition & 1 deletion assets/entrepot/pages/service/default-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getMetadataFormDefaultValues = (metadata?: Metadata): MetadataFormValuesTy
return {
languages: metadata?.csw_metadata?.language ? [metadata?.csw_metadata?.language] : [DEFAULT_LANGUAGE],
creation_date: metadata?.csw_metadata?.creation_date,
resource_genealogy: metadata?.csw_metadata?.resource_genealogy,
resource_genealogy: metadata?.csw_metadata?.resource_genealogy ?? "",
hierarchy_level: metadata?.csw_metadata?.hierarchy_level ?? MetadataHierarchyLevel.Dataset,
email_contact: metadata?.csw_metadata?.contact_email,
organization: metadata?.csw_metadata?.organisation_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const { i18n } = declareComponentKeys<
| "metadatas.organization_error"
| "metadatas.organization_email_required_error"
| "metadatas.organization_email_error"
| "metadatas.hierarchy_level_error"
| "metadatas.language_error"
| "metadatas.charset_error"
| "metadatas.encoding_error"
Expand Down Expand Up @@ -49,6 +50,7 @@ export const ValidationMetadatasFrTranslations: Translations<"fr">["ValidationMe
"metadatas.organization_error": "l’organisme est obligatoire",
"metadatas.organization_email_required_error": "l’email de l’organisme est obligatoire",
"metadatas.organization_email_error": "l’email de l’organisme n'est pas correct",
"metadatas.hierarchy_level_error": "Le type de ressource doit être [dataset] ou [series]",
"metadatas.language_error": "La langue est obligatoire",
"metadatas.charset_error": "Le jeu de caractères est obligatoire",
"metadatas.encoding_error": "l’encodage de la ressource est obligatoire",
Expand All @@ -75,6 +77,7 @@ export const ValidationMetadatasEnTranslations: Translations<"en">["ValidationMe
"metadatas.organization_error": "Organization is required",
"metadatas.organization_email_required_error": "Organization email is required",
"metadatas.organization_email_error": "Organization email is not correct",
"metadatas.hierarchy_level_error": undefined,
"metadatas.language_error": "La langue est obligatoire",
"metadatas.charset_error": "Dataset is required",
"metadatas.encoding_error": "Encoding of the resource is required",
Expand Down
4 changes: 3 additions & 1 deletion src/Dto/CommonDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ public function __construct(

#[Assert\Choice([
'choices' => ['', 'dataset', 'series'],
'message' => 'metadatas.resource_genealogy_error',
'message' => 'metadatas.hierarchy_level_error',
])]
public readonly ?string $hierarchy_level,

public readonly string $resource_genealogy,

#[Assert\Choice([
Expand Down
4 changes: 3 additions & 1 deletion src/Dto/Pyramid/PublishPyramidDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ public function __construct(

#[Assert\Choice([
'choices' => ['', 'dataset', 'series'],
'message' => 'common.resource_genealogy_error',
'message' => 'common.hierarchy_level_error',
])]
public readonly ?string $hierarchy_level,

public readonly ?string $resource_genealogy,

#[Assert\Choice([
Expand Down
4 changes: 3 additions & 1 deletion src/Dto/WfsAddDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ public function __construct(

#[Assert\Choice([
'choices' => ['', 'dataset', 'series'],
'message' => 'common.resource_genealogy_error',
'message' => 'common.hierarchy_level_error',
])]
public readonly ?string $hierarchy_level,

public readonly ?string $resource_genealogy,

#[Assert\NotBlank(['message' => 'common.frequency_code_error'])]
Expand Down
2 changes: 1 addition & 1 deletion translations/cartesgouvfr.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ metadatas:
description_error: "Le résumé est obligatoire"
identifier_error: "L’identificateur de resource est obligatoire"
identifier_regex: "L’identificateur de resource ne doit contenir que des lettres, chiffres, tirets (-), underscores (_), ou points (.)"
resource_genealogy_error: "La généalogie de la resource doit être [dataset] ou [series]"
hierarchy_level_error: "Le type de ressource doit être [dataset] ou [series]"
organization_error: "Le nom de l’organisme est obligatoire"
category_error: "La catégorie thématique est obligatoire"
category_min_error: "Il doit y avoir au moins une catégorie thématique"
Expand Down
4 changes: 2 additions & 2 deletions translations/validators/validators.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pyramid_publish:
description_error: "Le résumé est obligatoire"
identifier_error: "L'identificateur de resource est obligatoire"
identifier_regex: "L'identificateur de resource ne doit contenir que des lettres, chiffres, tirets (-), underscores (_), ou points (.)"
resource_genealogy_error: "La généalogie de la resource doit être [dataset] ou [series]"
hierarchy_level_error: "Le type de ressource doit être [dataset] ou [series]"
organization_error: "Le nom de l'organisme est obligatoire"
category_min_error: "Il doit y avoir au moins une catégorie thématique"
projection_error: "La projection est obligatoire"
Expand Down Expand Up @@ -82,7 +82,7 @@ common:
description_error: "Le résumé est obligatoire"
identifier_error: "L'identificateur de resource est obligatoire"
identifier_regex: "L'identificateur de resource ne doit contenir que des lettres, chiffres, tirets (-), underscores (_), ou points (.)"
resource_genealogy_error: "La généalogie de la resource doit être [dataset] ou [series]"
hierarchy_level_error: "Le type de ressource doit être [dataset] ou [series]"
frequency_code_error: "La fréquence de mise à jour est obligatoire"
organization_error: "Le nom de l'organisme est obligatoire"
category_error: "La catégorie thématique est obligatoire"
Expand Down

0 comments on commit 1c3602a

Please sign in to comment.