Skip to content

Commit

Permalink
[TRELLO-2536] Add script to generate subcategories slugs (#949)
Browse files Browse the repository at this point in the history
* [TRELLO-2536] Add script to generate subcategories slugs

* [TRELLO-2536] Fix script

* [TRELLO-2536] Send subcat to API

* [TRELLO-2536] Add subcategory slug to french categories and some english ones

* [TRELLO-2536] Add more subcategories to english

* [TRELLO-2536] Add more subcategories to english

* [TRELLO-2536] Clean

* Fix

* [TRELLO-2536] Fix watch
  • Loading branch information
charlescd authored Nov 18, 2024
1 parent 0995e38 commit 5cc9640
Show file tree
Hide file tree
Showing 2,171 changed files with 3,817 additions and 1,301 deletions.
2 changes: 1 addition & 1 deletion mobile-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"shared": "workspace:^"
},
"scripts": {
"beforebuild": "yarn shared:generate-json && yarn shared:generate-minimized-anomalies",
"beforebuild": "yarn shared:gen-subcategory-slugs && yarn shared:generate-json && yarn shared:generate-minimized-anomalies",
"test": "jest --config jest.config.mjs",
"build": "yarn beforebuild && tsc",
"start": "node build/index.js",
Expand Down
1 change: 1 addition & 0 deletions shared/anomalies/Anomaly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type CompanyKindQuestionOption = {
}

type SubcategoryBase = CategoryNodeBase & {
subcategory: string
// ex: "3.2.1.3.1.1.1"
// Not in the yaml, they are generated recursively
// Seem to be used in the JS as a unique identifier for the inputs values in the forms
Expand Down
1 change: 1 addition & 0 deletions shared/anomalies/checks/checkAnomaliesJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const baseSubcategorySpec: ObjectSpec = {
ccrfCode: _ => _.ifDefined()?.assertIsArrayOfString(),
companyKind: _ => _.ifDefined()?.assertIsAllowedString(companyKinds),
title: _ => _.assertIsString(),
subcategory: _ => _.assertIsString(),
subcategoriesTitle: _ => _.ifDefined()?.assertIsString(),
// triggers the recursion
subcategories: _ => _.ifDefined()?.assertIsArrayWith(assertIsSubcategory),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ detailInputs:
defaultValue: SYSDATE
- label: Description
type: TEXTAREA
subcategory: Prix_manquants_ou_illisibles
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ blockingInfo:
<br/> For example, the price of books is regulated.
<br/><br/> A merchant does not have the right to sell at too low a price: he cannot sell a product cheaper than what it cost him. There are a few situations where he has the right to sell below the purchase price, such as the
sales period.
subcategory: Prix_plus_eleves_quailleurs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ detailInputs:
defaultValue: SYSDATE
- label: Description
type: TEXTAREA
subcategory: Fausse_reduction_de_prix
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ desc: >-
ccrfCode:
- '271'
reponseconsoCode: '210'
subcategory: Abonnement_ou_frais_caches
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
title: Price
desc: 'Examples: wrong price applied at checkout, price not displayed'
tags:
- ReponseConso
- ReponseConso
subcategory: Prix
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ title: Hygiene
tags:
- Hygiene
- ProduitAlimentaire
desc: 'Examples: unclean store, product not refrigerated, unpleasant odours'
desc: 'Examples: unclean store, product not refrigerated, unpleasant odours'
subcategory: Hygiene
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
title: Advertising
desc: 'Examples: misleading advertisements, catalogue item unavailable'
desc: 'Examples: misleading advertisements, catalogue item unavailable'
subcategory: Publicite
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: The company would not accept payment in cash
title: The company would not accept payment in cash
subcategory: Le_commercant_refuse_que_je_paie_en_especes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: The company would not accept payment by cheque, credit card or debit card
title: The company would not accept payment by cheque, credit card or debit card
subcategory: Le_commercant_refuse_que_je_paie_par_carte_bancaire_ou_cheque
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: Other payment or price-related issue
title: Other payment or price-related issue
subcategory: Autre_probleme_de_prix_ou_paiement
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
title: Payment methods
desc: 'Example: credit or debit card declined'
subcategory: Moyens_de_paiement
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: Other
title: Other
subcategory: Autre
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
title: A general issue with the store
desc: 'Examples: missing prices, wrong price applied at checkout, unclean store'
companyKind: SIRET
companyKind: SIRET
subcategory: Le_magasin_de_facon_generale
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitAlimentaire
subcategories:
customimport: _imports/subcategories/nourriture
subcategory: Cest_un_aliment
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/objet
subcategory: Cest_un_objet
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
title: An issue with a specific product
desc: 'Examples: lack of information on the packaging, suspicious product'
companyKind: SIRET
companyKind: SIRET
subcategory: Un_produit_en_particulier
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tags:
- ProduitAlimentaire
subcategories:
customimport: _imports/subcategories/produit-alimentaire
subcategory: Produit_alimentaire
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: It is an object, a cosmetic product, furniture, fireworks, etc.
title: Toys, childcare, school supplies
subcategoriesTitle: What is the risk ?
tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Jouet_puericulture_materiel_scolaire
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags:
subcategoriesTitle: What is the risk ?
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Cosmetique_produit_dhygiene_produit_de_tatouage
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Vetement_textile_sac_a_main_bijou
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Equipement_de_protection
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Feu_dartifice
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Meuble
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Produit_dentretien_produit_chimique_engrais
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Appareil_electrique
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Outil
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ title: Other
subcategoriesTitle: What is the risk ?
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Autre
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ title: Dangerous product
desc: 'Examples: toy, cosmetics'
tags:
- ProduitDangereux
companyKind: SIRET
companyKind: SIRET
subcategory: Un_produit_dangereux
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ desc: >-
ccrfCode:
- 23B
reponseconsoCode: '210'
subcategory: Publicite_trompeuse_ou_mensongere
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ desc: >-
ccrfCode:
- '220'
- 21A
subcategory: Absence_dinformations_obligatoires_avant_de_commander
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: Other
subcategory: Autre
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
title: The website itself
desc: 'Examples: misleading advertisements, mandatory information missing'
companyKind: WEBSITE
subcategory: Le_site_internet_en_luimeme
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ detailInputs:
defaultValue: SYSDATE
- label: Description
type: TEXTAREA
subcategory: Il_manque_des_prix_les_prix_sont_illisibles
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ blockingInfo:
<br/> For example, the price of books is regulated.
<br/><br/> A merchant does not have the right to sell at too low a price: he cannot sell a product cheaper than what it cost him. There are a few situations where he has the right to sell below the purchase price, such as the
sales period.
subcategory: Les_prix_sont_plus_eleves_quailleurs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ detailInputs:
defaultValue: SYSDATE
- label: Description
type: TEXTAREA
subcategory: Fausse_reduction_de_prix
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ desc: >-
ccrfCode:
- '271'
reponseconsoCode: '210'
subcategory: Abonnement_ou_frais_caches
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ desc: 'Examples: no price information given, false price discounts, sales, promo
companyKind: WEBSITE
tags:
- ReponseConso
subcategory: Le_prix
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ desc: >-
Example: I placed the order a month ago and I get no update on the site.
ccrfCode:
- '23B'
subcategory: Commande_jamais_livree_et_le_site_est_toujours_ouvert
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ desc: >-
Example: I ordered two phones, but I only received one and the company refuses to l the delivery.
ccrfCode:
- '23B'
subcategory: Commande_incomplete
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ title: >-
Late delivery or lost parcel
desc: >-
Example: I was promised delivery in 10 days or less, I got my item six months later.
subcategory: Livraison_en_retard_ou_colis_perdu
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ title: Item damaged in transit
desc: 'Example: I received a broken chair in a parcel that had been ripped open.'
ccrfCode:
- '23B'
subcategory: Produit_endommage_lors_du_transport
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ desc: >-
Example: customer services promised a refund, I did not receive anything and customer services insist that the payment went through.
ccrfCode:
- '23B'
subcategory: Le_service_apresvente_ne_me_repond_plus_SAV
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ title: Placed order
desc: >-
Examples: order never arrives, delivery delay, incomplete order or damaged items.
companyKind: WEBSITE
subcategory: Une_commande_effectuee
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ title: >-
ccrfCode:
- '23B'
- '271'
subcategory: >-
Le_produit_est_different_de_la_description_ou_jai_recu_un_autre_produit_a_la_place
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title: Quality issue
title: Quality issue
subcategory: Probleme_de_qualite
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
title: Quantity or volume issue
desc: 'Example: I ordered 500 gr of chocolate, I receive 300 gr'
reponseconsoCode: '210'
subcategory: Une_quantite_annoncee_non_conforme
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ title: Product
desc: >-
Examples: product does not match the description, issue with quality or quantity / volume
companyKind: WEBSITE
subcategory: Un_produit
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tags:
- ProduitAlimentaire
subcategories:
customimport: _imports/subcategories/produit-alimentaire
subcategory: Produit_alimentaire
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: It is an object, a cosmetic product, furniture, fireworks, etc.
title: Toys, childcare, school supplies
subcategoriesTitle: What is the risk ?
tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Jouet_puericulture_materiel_scolaire

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags:
subcategoriesTitle: What is the risk ?
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Cosmetique_produit_dhygiene_produit_de_tatouage
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Vetement_textile_sac_a_main_bijou
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Equipement_de_protection
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Feu_dartifice
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Meuble
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Produit_dentretien_produit_chimique_engrais
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Appareil_electrique
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tags:
- ProduitIndustriel
subcategories:
customimport: _imports/subcategories/produit-dangereux
subcategory: Outil
Loading

0 comments on commit 5cc9640

Please sign in to comment.