thm-mni-ii / feedbacksystem

Intelligent, personalized feedback for students using artificial intelligence
https://frits.mni.thm.de/
Other
19 stars 9 forks source link

add templates to API #1011

Open Medienkunzt opened 1 year ago

Medienkunzt commented 1 year ago

SQL-Templates will be integrated into SQL Playground to allow students to automatically integrate tables and data into their database. ref #1003 To be able to save the templates, we need several API routes.

GET
/api/v2/playground/templates                    Get all SqlTemplates

POST/UPDATE/DELETE
/api/v2/playground/template/{templateId}        Create/Update/Delete SqlTemplates (Nur als Admin)

GET
/api/v2/playground/templates/category           Get all TemplateCategories

POST/UPDATE/DELETE
/api/v2/playground/templates/category/{tcatId}  Create/Update/Delete SqlTemplates (Nur als Admin)

The required data structure:

interface SqlTemplates {
    id: number
    name: string,
    category: TemplateCategory,
    templateQuery: text
}

interface TemplateCategory {
    id: number,
    name: string,
}
pdrtzk commented 1 year ago

Minor change: The POST routes are the same as the GET routes, since the ids are not generated until the template (category) is created.