add v2 API routes for admin and bug report management with rate limiting
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 43s

This commit is contained in:
Flavio Fois
2026-03-23 21:29:50 +01:00
parent 9cc0f3157c
commit 576ce0b1b5
9 changed files with 195 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ package models
import (
"encoding/json"
"strings"
"time"
)
@@ -14,6 +15,23 @@ const (
BugReportStatusClosed BugReportStatus = "closed"
)
func (s BugReportStatus) IsValid() bool {
switch s {
case BugReportStatusNew, BugReportStatusInReview, BugReportStatusResolved, BugReportStatusClosed:
return true
default:
return false
}
}
func ParseBugReportStatus(value string) (BugReportStatus, bool) {
status := BugReportStatus(strings.ToLower(strings.TrimSpace(value)))
if status == "" {
return "", false
}
return status, status.IsValid()
}
type BugReportListItem struct {
BugReport
FileCount int `db:"file_count" json:"file_count"`

View File

@@ -5,9 +5,10 @@ import "time"
type FileRole string
const (
FileRoleAttachment FileRole = "attachment"
FileRoleScreenshot FileRole = "screenshot"
FileRoleLog FileRole = "log"
FileRoleScreenshot FileRole = "screenshot"
FileRoleMailFile FileRole = "mail_file"
FileRoleLocalStorage FileRole = "localstorage"
FileRoleConfig FileRole = "config"
)
type BugReportFile struct {