Fix BASE_URL config loading, add tasks/projects; robust .env path resolution
- Config: try ENV_FILE, .env, ../.env for loading; trim trailing slash from BaseURL - Log BASE_URL at server startup for verification - .env.example: document BASE_URL - Tasks, projects, tags, migrations and related API/handlers Made-with: Cursor
This commit is contained in:
@@ -95,3 +95,37 @@ func ValidateRecurrenceRangeLimit(start, end time.Time) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateTaskTitle(title string) error {
|
||||
if len(title) < 1 || len(title) > 500 {
|
||||
return models.NewValidationError("task title must be 1-500 characters")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateTaskStatus(status string) error {
|
||||
valid := map[string]bool{"todo": true, "in_progress": true, "done": true, "archived": true}
|
||||
if !valid[status] {
|
||||
return models.NewValidationError("invalid task status")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ParseTime(s string) (time.Time, error) {
|
||||
t, err := time.Parse(time.RFC3339, s)
|
||||
if err != nil {
|
||||
t, err = time.Parse("2006-01-02T15:04:05Z07:00", s)
|
||||
}
|
||||
if err != nil {
|
||||
t, err = time.Parse("2006-01-02", s)
|
||||
}
|
||||
return t, err
|
||||
}
|
||||
|
||||
func ValidateTaskPriority(priority string) error {
|
||||
valid := map[string]bool{"low": true, "medium": true, "high": true, "critical": true}
|
||||
if !valid[priority] {
|
||||
return models.NewValidationError("invalid task priority")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user