-
Notifications
You must be signed in to change notification settings - Fork 0
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
Récupération des avis depuis la db #5
base: rat-component
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Pas de magic string, ni de magic number, ça suit l'idiome DRY, le naming est bon, quelques petites remarques en commentaire
J'aurais aimé avoir un screen du résultat dans la PRR pour voir que ça marche vraiment :p
src/core/avis/getAllAvis.tsx
Outdated
): header is GoogleSheetsExpectedColumnNames[] { | ||
const expectedHeader = Object.keys(sheetsColumnsToTechnicalName); | ||
return header.every((col) => expectedHeader.includes(col)); | ||
} |
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.
La fonction existe déjà dans ce qu'avais fait corentin il me semble
src/core/avis/getAllAvis.tsx
Outdated
return avisStringKeys.includes(key); | ||
} | ||
|
||
const arrayToAvisInfos = (data: string[][]): AvisInfos[] => { |
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 mélanger du français et de l'anglais ? On pouvait pas traduire aussi "Avis" en anglais avec "Review" pour rester cohérent ?
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.
Je suis d'accord
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.
ça tombe bien moi aussi !
src/core/avis/getAllAvis.tsx
Outdated
keyof typeof sheetsColumnsToTechnicalName; | ||
|
||
// Correct header type guard | ||
function isCorrectHeader( |
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.
Le naming est trop vague ici, c'est quoi un header correct ?
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'ai remplacé par IsReviewInfoHeader :)
src/core/avis/interface.ts
Outdated
enum Evaluation { | ||
BAD_EVALUATION, | ||
MEDIUM_EVALUATION, | ||
GOOD_EVALUATION, | ||
} |
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.
enum Evaluation { | |
BAD_EVALUATION, | |
MEDIUM_EVALUATION, | |
GOOD_EVALUATION, | |
} | |
enum Evaluation { | |
BAD_EVALUATION = "BAD_EVALUATION", | |
MEDIUM_EVALUATION, | |
GOOD_EVALUATION, | |
} |
Pareil pour les autres
src/core/avis/getAllAvis.tsx
Outdated
return avisStringKeys.includes(key); | ||
} | ||
|
||
const arrayToAvisInfos = (data: string[][]): AvisInfos[] => { |
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.
Je suis d'accord
src/core/avis/getAllAvis.tsx
Outdated
const AvisTable = await reponse.json(); | ||
const data = AvisTable.values; | ||
|
||
const AvisInfoTable = arrayToAvisInfos(data); |
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.
Utiliser le bon casing ;)
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.
ok, c'est réparé !
{} as Record<TGroupByIndex, TInput[]> | ||
); | ||
|
||
const getAllAvisByAllRestaurant = async () => { |
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.
const getAllAvisByAllRestaurant = async () => { | |
const getRestaurantNameToAvis = async () => { |
return allAvisByAllRestaurant; | ||
}; | ||
|
||
export const getAllAvisbyRestaurant = async (restaurantName: string) => { |
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.
export const getAllAvisbyRestaurant = async (restaurantName: string) => { | |
export const getAvisForRestaurant = async (restaurantName: string) => { |
src/core/avis/interface.ts
Outdated
@@ -0,0 +1,53 @@ | |||
export interface AvisInfos { |
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.
Plutôt séparer en 3 fichiers pour bien compartimenter :
- Un commun avec les types
- 2 pour les type guards
src/core/sheetMethods.tsx
Outdated
documentID: string | undefined, | ||
valuesRange: string | undefined, | ||
googleSheetsAPIKey: string | undefined |
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.
On veut pas que ça soit undefined là, sinon on peut pas faire le call
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.
Gérer le cas undefined le plus proche possible de la source
8b4286a
to
407f326
Compare
Ajout d'une fonction dans le back permettant l’accès à la liste des avis du restaurant voulu