feat(ktb): add delete example and definition buttons; add pagination
This commit is contained in:
parent
6873a8d920
commit
c1afb0aa2c
4 changed files with 148 additions and 33 deletions
|
|
@ -167,6 +167,19 @@ function initExpress() {
|
|||
res.status(200).send({lemma_detail});
|
||||
});
|
||||
|
||||
app.delete("/definition/:definition_id", async (_req, res) =>{
|
||||
const definition_id:number = parseInt(_req.params.definition_id);
|
||||
|
||||
if(!definition_id){
|
||||
console.error(`Error: Could not find word form ${JSON.stringify({definition_id:definition_id})}`);
|
||||
return void res.status(400).send();
|
||||
}
|
||||
|
||||
Definition.delete({definition_id: definition_id});
|
||||
|
||||
res.status(200).send();
|
||||
});
|
||||
|
||||
/* examples */
|
||||
|
||||
app.put("/example", async (_req, res) => {
|
||||
|
|
@ -214,6 +227,19 @@ function initExpress() {
|
|||
res.status(200).send({lemma_detail});
|
||||
});
|
||||
|
||||
app.delete("/example/:example_id", async (_req, res) =>{
|
||||
const example_id:number = parseInt(_req.params.example_id);
|
||||
|
||||
if(!example_id){
|
||||
console.error(`Error: Could not find word form ${JSON.stringify({example_id:example_id})}`);
|
||||
return void res.status(400).send();
|
||||
}
|
||||
|
||||
Example.delete({example_id: example_id});
|
||||
|
||||
res.status(200).send();
|
||||
});
|
||||
|
||||
/* word forms */
|
||||
|
||||
app.put("/word-form", async (_req, res) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue