feat(api): create template

Add template table to the database
Create controller function to check if user has template, and create it
in the database
Made universal jwt.Claims of user data retrieval function
This commit is contained in:
Leons Aleksandrovs
2025-07-09 23:19:31 +03:00
parent 3376043428
commit 938c9a66e5
10 changed files with 209 additions and 14 deletions
+10 -1
View File
@@ -1,6 +1,7 @@
package routes
import (
"backend/controllers/template"
"backend/controllers/user"
"backend/middleware"
@@ -18,7 +19,15 @@ func SetupRoutes() *gin.Engine {
auth := r.Group("/")
auth.Use(middleware.IsAuthenticated())
auth.GET("/info", user.TokenInfo) // Route to check if user is authenticated
// Route to check if user is authenticated
auth.GET("/info", user.TokenInfo)
// Template routes (REST FUCKING GOOOOO)
templates := auth.Group("/templates")
// GET (Gets all templates)
templates.POST("", template.Create)
// PUT (Edit)
// DELETE (Delete)
return r
}