- Add TaskTemplate model with category and frequency support - Add task template repository with CRUD and search operations - Add task template service layer - Add public API endpoints for templates (no auth required): - GET /api/tasks/templates/ - list all templates - GET /api/tasks/templates/grouped/ - templates grouped by category - GET /api/tasks/templates/search/?q= - search templates - GET /api/tasks/templates/by-category/:id/ - templates by category - GET /api/tasks/templates/:id/ - single template - Add admin panel for task template management (CRUD) - Add admin API endpoints for templates - Add seed file with predefined task templates - Add i18n translations for template errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
1.2 KiB
Go
23 lines
1.2 KiB
Go
package models
|
|
|
|
// TaskTemplate represents a predefined task template that users can select when creating tasks
|
|
type TaskTemplate struct {
|
|
BaseModel
|
|
Title string `gorm:"column:title;size:200;not null" json:"title"`
|
|
Description string `gorm:"column:description;type:text" json:"description"`
|
|
CategoryID *uint `gorm:"column:category_id;index" json:"category_id"`
|
|
Category *TaskCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
|
FrequencyID *uint `gorm:"column:frequency_id;index" json:"frequency_id"`
|
|
Frequency *TaskFrequency `gorm:"foreignKey:FrequencyID" json:"frequency,omitempty"`
|
|
IconIOS string `gorm:"column:icon_ios;size:100" json:"icon_ios"`
|
|
IconAndroid string `gorm:"column:icon_android;size:100" json:"icon_android"`
|
|
Tags string `gorm:"column:tags;type:text" json:"tags"` // Comma-separated tags for search
|
|
DisplayOrder int `gorm:"column:display_order;default:0" json:"display_order"`
|
|
IsActive bool `gorm:"column:is_active;default:true;index" json:"is_active"`
|
|
}
|
|
|
|
// TableName returns the table name for GORM
|
|
func (TaskTemplate) TableName() string {
|
|
return "task_tasktemplate"
|
|
}
|