-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(contenus): ajout d'une date #1458
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Quality Gate passedIssues Measures |
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
🎉 Deployment for commit 7780c80 : Docker images
|
@@ -8,6 +8,7 @@ export const getContributionAnswerById = gql` | |||
description | |||
content_type | |||
updatedAt: updated_at | |||
display_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionnel mais ca serais pas plus sympa en camelcase ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il serait même top de le mettre en camelCase directement dans Hasura :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouaip, c'est ce que j'ai fait côté model
et information
, mais globalement, côté contribution
, on a tout en snake_case, donc ça risque de tout mélanger. Il faudrait limite faire un ticket pour refacto toutes les contributions en camelCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Et cela bien évidemment, directement côté Hasura
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "information"."informations" add column "display_date" date | ||
-- null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il faudrait mettre un down ici vu que le up alter le schéma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouaip, mais bon, on l'a fait nul part.... puis après faut le tester, etc. est-ce worth it ?
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "contribution"."answers" add column "display_date" date | ||
-- null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "model"."models" add column "display_date" date | ||
-- null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
|
||
docker compose up --wait -d hasura elasticsearch | ||
docker compose up --wait -d hasura elasticsearch minio createbuckets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
render={({ field: { onChange, value } }) => ( | ||
<DatePicker | ||
label={label} | ||
value={formatDate(value)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca ne semble pas trop être ce que la doc préconise pour le formatage https://mui.com/x/react-date-pickers/adapters-locale/
Est ce qu'il ya une raison de ne pas faire avec la método de date-fns ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'utilise bien date-fns
comme dans la documentation pour formater mon input.
Le paramètre d'entrée est une date
, or nous notre input issue de la DB est un string
. D'où le fait que je sois obligé de le formater afin de lui renvoyer une date
.
Pour la sortie, c'est un peu la même, car le DatePicker
renvoie (du fait que je l'ai initialisé avec adapter
) une valeur en string de type dd/MM/yyyy
. Or de notre côté, ce qu'on veut sauvegarder côté DB est de format date
en yyyy-MM-dd
. Afin d'éviter de le formater plus haut, je le fais directement dans le onChange
du composant. Ca simplifie la gestion du formattage à un niveau local :)
@@ -8,6 +8,7 @@ export const getContributionAnswerById = gql` | |||
description | |||
content_type | |||
updatedAt: updated_at | |||
display_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il serait même top de le mettre en camelCase directement dans Hasura :)
@@ -237,7 +52,7 @@ export class DocumentsService { | |||
cause: null, | |||
}); | |||
} | |||
document = await this.mapInformationToDocument(information, document); | |||
document = await mapInformationToDocument(information, document); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Très bonne idée d'extraire ces méthodes du fichier. Ca devenait un trop gros fichier
} | ||
const source = getRouteBySource(doc.source); | ||
const priority = | ||
source === SOURCES.EDITORIAL_CONTENT || | ||
source === "information" || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi ne pas utiliser les constantes SOURCES.INFORMATION
et SOURCE.MODELES
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Car les valeurs sont différentes, en fait la valeur derrière la source est celle ci :
export type Document = { updated_at: string; slug: string; source: SourceRoute; document: any; };
SourceRoute
sont les valeurs des keys SOURCES.INFORMATION
, etc.
Donc les deux valeurs sont différentes, le type précédent était faux...
fix #1453
fix SocialGouv/code-du-travail-numerique#6042