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
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 43s
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user