portfolio/store.go (818 LOC) → store_portfolio.go, store_items.go, store_metrics.go workshop/store.go (793 LOC) → store_sessions.go, store_participants.go, store_responses.go training/models.go (757 LOC) → models_enums.go, models_core.go, models_api.go, models_blocks.go roadmap/store.go (757 LOC) → store_roadmap.go, store_items.go, store_import.go All files under 350 LOC. Zero behavior changes, same package declarations. go vet passes on all five packages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
142 lines
5.3 KiB
Go
142 lines
5.3 KiB
Go
package training
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// ============================================================================
|
|
// API Request/Response Types
|
|
// ============================================================================
|
|
|
|
// CreateModuleRequest is the API request for creating a training module
|
|
type CreateModuleRequest struct {
|
|
ModuleCode string `json:"module_code" binding:"required"`
|
|
Title string `json:"title" binding:"required"`
|
|
Description string `json:"description,omitempty"`
|
|
RegulationArea RegulationArea `json:"regulation_area" binding:"required"`
|
|
NIS2Relevant bool `json:"nis2_relevant"`
|
|
ISOControls []string `json:"iso_controls,omitempty"`
|
|
FrequencyType FrequencyType `json:"frequency_type" binding:"required"`
|
|
ValidityDays int `json:"validity_days"`
|
|
RiskWeight float64 `json:"risk_weight"`
|
|
ContentType string `json:"content_type"`
|
|
DurationMinutes int `json:"duration_minutes"`
|
|
PassThreshold int `json:"pass_threshold"`
|
|
}
|
|
|
|
// UpdateModuleRequest is the API request for updating a training module
|
|
type UpdateModuleRequest struct {
|
|
Title *string `json:"title,omitempty"`
|
|
Description *string `json:"description,omitempty"`
|
|
NIS2Relevant *bool `json:"nis2_relevant,omitempty"`
|
|
ISOControls []string `json:"iso_controls,omitempty"`
|
|
ValidityDays *int `json:"validity_days,omitempty"`
|
|
RiskWeight *float64 `json:"risk_weight,omitempty"`
|
|
DurationMinutes *int `json:"duration_minutes,omitempty"`
|
|
PassThreshold *int `json:"pass_threshold,omitempty"`
|
|
IsActive *bool `json:"is_active,omitempty"`
|
|
}
|
|
|
|
// SetMatrixEntryRequest is the API request for setting a CTM entry
|
|
type SetMatrixEntryRequest struct {
|
|
RoleCode string `json:"role_code" binding:"required"`
|
|
ModuleID uuid.UUID `json:"module_id" binding:"required"`
|
|
IsMandatory bool `json:"is_mandatory"`
|
|
Priority int `json:"priority"`
|
|
}
|
|
|
|
// ComputeAssignmentsRequest is the API request for computing assignments
|
|
type ComputeAssignmentsRequest struct {
|
|
UserID uuid.UUID `json:"user_id" binding:"required"`
|
|
UserName string `json:"user_name" binding:"required"`
|
|
UserEmail string `json:"user_email" binding:"required"`
|
|
Roles []string `json:"roles" binding:"required"`
|
|
Trigger string `json:"trigger"`
|
|
}
|
|
|
|
// UpdateAssignmentProgressRequest updates progress on an assignment
|
|
type UpdateAssignmentProgressRequest struct {
|
|
Progress int `json:"progress" binding:"required"`
|
|
}
|
|
|
|
// SubmitTrainingQuizRequest is the API request for submitting a quiz
|
|
type SubmitTrainingQuizRequest struct {
|
|
AssignmentID uuid.UUID `json:"assignment_id" binding:"required"`
|
|
Answers []QuizAnswer `json:"answers" binding:"required"`
|
|
DurationSeconds *int `json:"duration_seconds,omitempty"`
|
|
}
|
|
|
|
// SubmitTrainingQuizResponse is the API response for quiz submission
|
|
type SubmitTrainingQuizResponse struct {
|
|
AttemptID uuid.UUID `json:"attempt_id"`
|
|
Score float64 `json:"score"`
|
|
Passed bool `json:"passed"`
|
|
CorrectCount int `json:"correct_count"`
|
|
TotalCount int `json:"total_count"`
|
|
Threshold int `json:"threshold"`
|
|
}
|
|
|
|
// GenerateContentRequest is the API request for LLM content generation
|
|
type GenerateContentRequest struct {
|
|
ModuleID uuid.UUID `json:"module_id" binding:"required"`
|
|
Language string `json:"language"`
|
|
}
|
|
|
|
// GenerateQuizRequest is the API request for LLM quiz generation
|
|
type GenerateQuizRequest struct {
|
|
ModuleID uuid.UUID `json:"module_id" binding:"required"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
// PublishContentRequest is the API request for publishing content
|
|
type PublishContentRequest struct {
|
|
ReviewedBy uuid.UUID `json:"reviewed_by"`
|
|
}
|
|
|
|
// BulkAssignRequest is the API request for bulk assigning a module
|
|
type BulkAssignRequest struct {
|
|
ModuleID uuid.UUID `json:"module_id" binding:"required"`
|
|
RoleCodes []string `json:"role_codes" binding:"required"`
|
|
Trigger string `json:"trigger"`
|
|
Deadline time.Time `json:"deadline" binding:"required"`
|
|
}
|
|
|
|
// ModuleListResponse is the API response for listing modules
|
|
type ModuleListResponse struct {
|
|
Modules []TrainingModule `json:"modules"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
// AssignmentListResponse is the API response for listing assignments
|
|
type AssignmentListResponse struct {
|
|
Assignments []TrainingAssignment `json:"assignments"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
// MatrixResponse is the API response for the full training matrix
|
|
type MatrixResponse struct {
|
|
Entries map[string][]TrainingMatrixEntry `json:"entries"` // role_code -> entries
|
|
Roles map[string]string `json:"roles"` // role_code -> label
|
|
}
|
|
|
|
// AuditLogResponse is the API response for listing audit log entries
|
|
type AuditLogResponse struct {
|
|
Entries []AuditLogEntry `json:"entries"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
// EscalationResponse is the API response for escalation check
|
|
type EscalationResponse struct {
|
|
Results []EscalationResult `json:"results"`
|
|
TotalChecked int `json:"total_checked"`
|
|
Escalated int `json:"escalated"`
|
|
}
|
|
|
|
// DeadlineListResponse is the API response for listing deadlines
|
|
type DeadlineListResponse struct {
|
|
Deadlines []DeadlineInfo `json:"deadlines"`
|
|
Total int `json:"total"`
|
|
}
|