mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-03 20:12:58 +00:00
first test
This commit is contained in:
@@ -2,7 +2,9 @@ package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/trackeep/backend/config"
|
||||
@@ -11,6 +13,79 @@ import (
|
||||
|
||||
// GetTasks handles GET /api/v1/tasks
|
||||
func GetTasks(c *gin.Context) {
|
||||
// Check if demo mode is enabled
|
||||
if os.Getenv("VITE_DEMO_MODE") == "true" {
|
||||
// Parse dates for demo mode
|
||||
dueDate1, _ := time.Parse("2006-01-02", "2024-02-15")
|
||||
dueDate2, _ := time.Parse("2006-01-02", "2024-02-10")
|
||||
dueDate3, _ := time.Parse("2006-01-02", "2024-02-01")
|
||||
dueDate4, _ := time.Parse("2006-01-02", "2024-02-08")
|
||||
dueDate5, _ := time.Parse("2006-01-02", "2024-02-20")
|
||||
completedAt := time.Now().AddDate(0, 0, -1)
|
||||
|
||||
// Return mock tasks for demo mode
|
||||
mockTasks := []models.Task{
|
||||
{
|
||||
ID: 1,
|
||||
Title: "Complete API documentation",
|
||||
Description: "Write comprehensive documentation for all API endpoints",
|
||||
Status: "in_progress",
|
||||
Priority: "high",
|
||||
DueDate: &dueDate1,
|
||||
UserID: 1,
|
||||
CreatedAt: time.Now().AddDate(0, 0, -7),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
{
|
||||
ID: 2,
|
||||
Title: "Fix responsive design issues",
|
||||
Description: "Resolve mobile layout problems on dashboard",
|
||||
Status: "pending",
|
||||
Priority: "medium",
|
||||
DueDate: &dueDate2,
|
||||
UserID: 1,
|
||||
CreatedAt: time.Now().AddDate(0, 0, -3),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
{
|
||||
ID: 3,
|
||||
Title: "Deploy to production",
|
||||
Description: "Deploy latest changes to production environment",
|
||||
Status: "completed",
|
||||
Priority: "high",
|
||||
DueDate: &dueDate3,
|
||||
UserID: 1,
|
||||
CreatedAt: time.Now().AddDate(0, 0, -14),
|
||||
UpdatedAt: time.Now().AddDate(0, 0, -1),
|
||||
CompletedAt: &completedAt,
|
||||
},
|
||||
{
|
||||
ID: 4,
|
||||
Title: "Review pull requests",
|
||||
Description: "Review and merge pending pull requests",
|
||||
Status: "pending",
|
||||
Priority: "medium",
|
||||
DueDate: &dueDate4,
|
||||
UserID: 1,
|
||||
CreatedAt: time.Now().AddDate(0, 0, -1),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
{
|
||||
ID: 5,
|
||||
Title: "Update dependencies",
|
||||
Description: "Update all npm packages to latest stable versions",
|
||||
Status: "pending",
|
||||
Priority: "low",
|
||||
DueDate: &dueDate5,
|
||||
UserID: 1,
|
||||
CreatedAt: time.Now().AddDate(0, 0, -5),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
}
|
||||
c.JSON(http.StatusOK, mockTasks)
|
||||
return
|
||||
}
|
||||
|
||||
db := config.GetDB()
|
||||
var tasks []models.Task
|
||||
|
||||
|
||||
Reference in New Issue
Block a user