-
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(frontend): update change on master #162
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Client } from "@elastic/elasticsearch"; | ||
|
||
export default async function (req, res) { | ||
if (!process.env.ELASTICSEARCH_API_KEY || !process.env.ELASTICSEARCH_URL) { | ||
res.status(304).json({ message: "not modified" }); | ||
} | ||
|
||
const client = new Client({ | ||
auth: { | ||
apiKey: process.env.ELASTICSEARCH_API_KEY, | ||
}, | ||
node: `${process.env.ELASTICSEARCH_URL}`, | ||
}); | ||
|
||
const { cdtnId, document } = req.body; | ||
try { | ||
await client.update({ | ||
body: { | ||
doc: document, | ||
}, | ||
id: cdtnId, | ||
index: `cdtn_master_documents`, | ||
}); | ||
res.json({ message: "doc updated!" }); | ||
} catch (response) { | ||
console.error(response.body.error); | ||
res.status(response.statusCode).json({ message: response.body.error }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 pense que ce serait plus safe d'aller récup le nom de l'index plutôt que de le mettre en dur ici
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.
oui on peut récupérer les index après on fait comment pour choisir ?
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.
En fait je pensais juste à aller le récupérer le suffix de l'index du côté de cdtn data dans le fichier
esIndexName
, le préfixe est dynamique, my bad. Mais je sais plus trop pourquoi on a deux indexes et qu'on change les alias plutôt qu'update directement les indexes ? Il y a une logique côté cdtn - data qu'on zappe un peu ici je sais pas si c'est volontaire c'est assez flou dans ma mémoireThere 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 a variabilisé
esIndexName
, car on l'utilise a plusieurs endroits dans cdtn. la on l'utilise qu'une fois mais oui ca crée une adhérence entre les 2 projets. je pense qu'on peut pour l'instant rester comme ça, et plutard, exporter un nouveau package cdtn-config pour partager certaines conig entre les 2 projetsPour l'histoire d'avoir 2 index, en fait on utilise un système d'alias qui permet d'éviter d'avoir un index vide / qui se remploi lorsqu'on lance l'indexation des document (qui prend un bonne dizaine de minute)
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.
Oui pas soucis laissons ça comme ça pour le moment, ce n'est absolument pas problématique pour l'instant