diff --git a/targets/frontend/src/modules/documents/api/documents.service.ts b/targets/frontend/src/modules/documents/api/documents.service.ts index b35dabd3b..7fe475889 100644 --- a/targets/frontend/src/modules/documents/api/documents.service.ts +++ b/targets/frontend/src/modules/documents/api/documents.service.ts @@ -130,7 +130,7 @@ export class DocumentsService { source: "modeles_de_courriers", meta_description: data.metaDescription, title: data.title, - text: data.description, + text: data.intro, slug: document?.slug ?? slugify(data.title), is_searchable: document ? document.is_searchable : true, is_published: document ? document.is_published : true, @@ -153,7 +153,8 @@ export class DocumentsService { type: "external", })) ), - description: data.description, + description: data.metaDescription, + intro: data.intro, filename: data.file.url, filesize: parseInt(data.file.size ?? "0"), html: data.previewHTML, diff --git a/targets/frontend/src/modules/models/api/modelsQuery.ts b/targets/frontend/src/modules/models/api/modelsQuery.ts index cae5e1f21..e94be66d5 100644 --- a/targets/frontend/src/modules/models/api/modelsQuery.ts +++ b/targets/frontend/src/modules/models/api/modelsQuery.ts @@ -8,7 +8,7 @@ export const modelsQuery = gql` title metaTitle type - description + intro metaDescription previewHTML createdAt diff --git a/targets/frontend/src/modules/models/components/Common/Form.tsx b/targets/frontend/src/modules/models/components/Common/Form.tsx index 6e746db70..abde47b4f 100644 --- a/targets/frontend/src/modules/models/components/Common/Form.tsx +++ b/targets/frontend/src/modules/models/components/Common/Form.tsx @@ -40,7 +40,7 @@ type Props = { const defaultValues: FormData = { title: "", metaTitle: "", - description: "", + intro: "", metaDescription: "", type: undefined, previewHTML: "", @@ -115,7 +115,7 @@ export const ModelForm = ({ id: newData.id!, title: newData.title!, metaTitle: newData.metaTitle!, - description: newData.description!, + intro: newData.intro!, metaDescription: newData.metaDescription!, type: newData.type!, file: newData.newFile @@ -232,8 +232,8 @@ export const ModelForm = ({ diff --git a/targets/frontend/src/modules/models/components/Creation/model.mutation.ts b/targets/frontend/src/modules/models/components/Creation/model.mutation.ts index 06643e733..51e7e269b 100644 --- a/targets/frontend/src/modules/models/components/Creation/model.mutation.ts +++ b/targets/frontend/src/modules/models/components/Creation/model.mutation.ts @@ -34,7 +34,7 @@ export const useModelInsertMutation = (): MutationFn => { title: data.title, metaTitle: data.metaTitle, type: data.type, - description: data.description, + intro: data.intro, metaDescription: data.metaDescription, file: { data: data.file, diff --git a/targets/frontend/src/modules/models/components/Edition/model.mutation.ts b/targets/frontend/src/modules/models/components/Edition/model.mutation.ts index ae1e97510..6960c004a 100644 --- a/targets/frontend/src/modules/models/components/Edition/model.mutation.ts +++ b/targets/frontend/src/modules/models/components/Edition/model.mutation.ts @@ -23,7 +23,7 @@ const updateModelQuery = gql` update_columns: [ title metaTitle - description + intro metaDescription type previewHTML @@ -62,7 +62,7 @@ export const useModelUpdateMutation = (): MutationFn => { id: data.id, title: data.title, metaTitle: data.metaTitle, - description: data.description, + intro: data.intro, metaDescription: data.metaDescription, type: data.type, file: { diff --git a/targets/frontend/src/modules/models/components/Edition/model.query.ts b/targets/frontend/src/modules/models/components/Edition/model.query.ts index 213637447..c6a828fbb 100644 --- a/targets/frontend/src/modules/models/components/Edition/model.query.ts +++ b/targets/frontend/src/modules/models/components/Edition/model.query.ts @@ -9,7 +9,7 @@ export const listModelsQuery = gql` title metaTitle type - description + intro metaDescription previewHTML createdAt diff --git a/targets/frontend/src/modules/models/components/graphql.type.ts b/targets/frontend/src/modules/models/components/graphql.type.ts index 3384a2bec..58d06c6b4 100644 --- a/targets/frontend/src/modules/models/components/graphql.type.ts +++ b/targets/frontend/src/modules/models/components/graphql.type.ts @@ -48,7 +48,7 @@ export type ModelModelsOtherReferencesArrRelInsertInput = { export type ModelModelsInsertInput = { createdAt?: string; - description?: string; + intro?: string; file?: FilesObjRelInsertInput; fileId?: string; id?: string; diff --git a/targets/frontend/src/modules/models/type.ts b/targets/frontend/src/modules/models/type.ts index a5a4bfe74..463c29abd 100644 --- a/targets/frontend/src/modules/models/type.ts +++ b/targets/frontend/src/modules/models/type.ts @@ -13,11 +13,11 @@ export const modelSchema = z.object({ metaTitle: z .string({ required_error: "Un titre meta doit être renseigné" }) .min(1, "Un titre meta doit être renseigné"), - description: z + intro: z .string({ - required_error: "Une description doit être renseignée", + required_error: "Une introduction doit être renseignée", }) - .min(1, "Une description doit être renseignée"), + .min(1, "Une introduction doit être renseignée"), metaDescription: z .string({ required_error: "Une description meta doit être renseignée", diff --git a/targets/hasura/metadata/databases/default/tables/model_models.yaml b/targets/hasura/metadata/databases/default/tables/model_models.yaml index 6fd4de1b0..688b14683 100644 --- a/targets/hasura/metadata/databases/default/tables/model_models.yaml +++ b/targets/hasura/metadata/databases/default/tables/model_models.yaml @@ -51,7 +51,7 @@ insert_permissions: - created_at - updated_at - title - - description + - intro - meta_title - meta_description - type @@ -61,7 +61,7 @@ select_permissions: - role: super permission: columns: - - description + - intro - meta_description - meta_title - preview_html @@ -77,7 +77,7 @@ update_permissions: permission: columns: - created_at - - description + - intro - file_id - meta_description - meta_title diff --git a/targets/hasura/migrations/default/1716296327667_alter_table_model_models_alter_column_description/down.sql b/targets/hasura/migrations/default/1716296327667_alter_table_model_models_alter_column_description/down.sql new file mode 100644 index 000000000..044d003ed --- /dev/null +++ b/targets/hasura/migrations/default/1716296327667_alter_table_model_models_alter_column_description/down.sql @@ -0,0 +1 @@ +alter table "model"."models" rename column "intro" to "description"; diff --git a/targets/hasura/migrations/default/1716296327667_alter_table_model_models_alter_column_description/up.sql b/targets/hasura/migrations/default/1716296327667_alter_table_model_models_alter_column_description/up.sql new file mode 100644 index 000000000..6f7598f13 --- /dev/null +++ b/targets/hasura/migrations/default/1716296327667_alter_table_model_models_alter_column_description/up.sql @@ -0,0 +1 @@ +alter table "model"."models" rename column "description" to "intro"; diff --git a/targets/hasura/migrations/default/1716301694848_rename-document-modele-description-intro/down.sql b/targets/hasura/migrations/default/1716301694848_rename-document-modele-description-intro/down.sql new file mode 100644 index 000000000..10f669fcf --- /dev/null +++ b/targets/hasura/migrations/default/1716301694848_rename-document-modele-description-intro/down.sql @@ -0,0 +1,5 @@ +-- On renomme intro en description +update documents set document = jsonb_set(document #- '{intro}', + '{description}', + document#>'{intro}') +where source = 'modeles_de_courriers'; diff --git a/targets/hasura/migrations/default/1716301694848_rename-document-modele-description-intro/up.sql b/targets/hasura/migrations/default/1716301694848_rename-document-modele-description-intro/up.sql new file mode 100644 index 000000000..12876da03 --- /dev/null +++ b/targets/hasura/migrations/default/1716301694848_rename-document-modele-description-intro/up.sql @@ -0,0 +1,9 @@ +-- On renomme description en intro +update documents set document = jsonb_set(document #- '{description}', + '{intro}', + document#>'{description}') +where source = 'modeles_de_courriers'; + +--On Remet un champs description avec le contenu de la meta_description +update documents set document = jsonb_set(document, '{description}', to_jsonb(meta_description)) +where source = 'modeles_de_courriers';