Update department etc
This commit is contained in:
@@ -16,18 +16,18 @@ type AnalyticsDashboardRequest struct {
|
||||
|
||||
// AnalyticsDashboardResponse represents the complete analytics dashboard
|
||||
type AnalyticsDashboardResponse struct {
|
||||
Summary LetterSummaryStats `json:"summary"`
|
||||
PriorityDistribution []PriorityDistribution `json:"priority_distribution"`
|
||||
DepartmentStats []DepartmentStats `json:"department_stats"`
|
||||
MonthlyTrend []MonthlyTrend `json:"monthly_trend"`
|
||||
DepartmentsStats []SimpleDepartmentStats `json:"departments_stats,omitempty"`
|
||||
InstitutionStats []InstitutionStats `json:"institution_stats"`
|
||||
DailyActivity []DailyActivity `json:"daily_activity"`
|
||||
StatusDistribution []StatusDistribution `json:"status_distribution,omitempty"`
|
||||
TopSenders []TopUserStats `json:"top_senders,omitempty"`
|
||||
TopRecipients []TopUserStats `json:"top_recipients,omitempty"`
|
||||
ApprovalMetrics *ApprovalMetrics `json:"approval_metrics,omitempty"`
|
||||
ResponseTimeStats *ResponseTimeStats `json:"response_time_stats,omitempty"`
|
||||
Summary LetterSummaryStats `json:"summary"`
|
||||
PriorityDistribution []PriorityDistribution `json:"priority_distribution"`
|
||||
DepartmentStats []DepartmentStats `json:"department_stats"`
|
||||
MonthlyTrend []MonthlyTrend `json:"monthly_trend"`
|
||||
DepartmentsStats []SimpleDepartmentStats `json:"departments_stats,omitempty"`
|
||||
InstitutionStats []InstitutionStats `json:"institution_stats"`
|
||||
DailyActivity []DailyActivity `json:"daily_activity"`
|
||||
StatusDistribution []StatusDistribution `json:"status_distribution,omitempty"`
|
||||
TopSenders []TopUserStats `json:"top_senders,omitempty"`
|
||||
TopRecipients []TopUserStats `json:"top_recipients,omitempty"`
|
||||
ApprovalMetrics *ApprovalMetrics `json:"approval_metrics,omitempty"`
|
||||
ResponseTimeStats *ResponseTimeStats `json:"response_time_stats,omitempty"`
|
||||
}
|
||||
|
||||
// LetterSummaryStats represents overall summary statistics
|
||||
@@ -36,6 +36,7 @@ type LetterSummaryStats struct {
|
||||
TotalOutgoing int64 `json:"total_outgoing"`
|
||||
WeekOverWeekGrowth float64 `json:"week_over_week_growth"`
|
||||
MonthOverMonthGrowth float64 `json:"month_over_month_growth"`
|
||||
TotalThisWeek float64 `json:"total_this_week"`
|
||||
TotalPending int64 `json:"total_pending,omitempty"`
|
||||
TotalApproved int64 `json:"total_approved,omitempty"`
|
||||
TotalRejected int64 `json:"total_rejected,omitempty"`
|
||||
@@ -54,24 +55,24 @@ type StatusDistribution struct {
|
||||
|
||||
// PriorityDistribution represents letter distribution by priority
|
||||
type PriorityDistribution struct {
|
||||
PriorityID string `json:"priority_id"`
|
||||
PriorityName string `json:"priority_name"`
|
||||
Level int `json:"level"`
|
||||
Count int64 `json:"count"`
|
||||
Percentage float64 `json:"percentage"`
|
||||
PriorityID string `json:"priority_id"`
|
||||
PriorityName string `json:"priority_name"`
|
||||
Level int `json:"level"`
|
||||
Count int64 `json:"count"`
|
||||
Percentage float64 `json:"percentage"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
}
|
||||
|
||||
// DepartmentStats represents statistics per department
|
||||
type DepartmentStats struct {
|
||||
DepartmentID uuid.UUID `json:"department_id"`
|
||||
DepartmentName string `json:"department_name"`
|
||||
DepartmentCode string `json:"department_code"`
|
||||
IncomingCount int64 `json:"incoming_count"`
|
||||
OutgoingCount int64 `json:"outgoing_count"`
|
||||
PendingCount int64 `json:"pending_count"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
CompletionRate float64 `json:"completion_rate"`
|
||||
DepartmentID uuid.UUID `json:"department_id"`
|
||||
DepartmentName string `json:"department_name"`
|
||||
DepartmentCode string `json:"department_code"`
|
||||
IncomingCount int64 `json:"incoming_count"`
|
||||
OutgoingCount int64 `json:"outgoing_count"`
|
||||
PendingCount int64 `json:"pending_count"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
CompletionRate float64 `json:"completion_rate"`
|
||||
}
|
||||
|
||||
// MonthlyTrend represents monthly trend data
|
||||
@@ -86,12 +87,12 @@ type MonthlyTrend struct {
|
||||
|
||||
// TopUserStats represents top users by letter activity
|
||||
type TopUserStats struct {
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
UserName string `json:"user_name"`
|
||||
UserEmail string `json:"user_email"`
|
||||
Department string `json:"department"`
|
||||
LetterCount int64 `json:"letter_count"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
UserName string `json:"user_name"`
|
||||
UserEmail string `json:"user_email"`
|
||||
Department string `json:"department"`
|
||||
LetterCount int64 `json:"letter_count"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
}
|
||||
|
||||
// InstitutionStats represents statistics per institution
|
||||
@@ -107,50 +108,50 @@ type InstitutionStats struct {
|
||||
|
||||
// ApprovalMetrics represents approval-related metrics
|
||||
type ApprovalMetrics struct {
|
||||
TotalSubmitted int64 `json:"total_submitted"`
|
||||
TotalApproved int64 `json:"total_approved"`
|
||||
TotalRejected int64 `json:"total_rejected"`
|
||||
TotalPending int64 `json:"total_pending"`
|
||||
ApprovalRate float64 `json:"approval_rate"`
|
||||
RejectionRate float64 `json:"rejection_rate"`
|
||||
AvgApprovalTime float64 `json:"avg_approval_time_hours"`
|
||||
AvgApprovalSteps float64 `json:"avg_approval_steps"`
|
||||
BottleneckSteps []BottleneckStep `json:"bottleneck_steps"`
|
||||
TotalSubmitted int64 `json:"total_submitted"`
|
||||
TotalApproved int64 `json:"total_approved"`
|
||||
TotalRejected int64 `json:"total_rejected"`
|
||||
TotalPending int64 `json:"total_pending"`
|
||||
ApprovalRate float64 `json:"approval_rate"`
|
||||
RejectionRate float64 `json:"rejection_rate"`
|
||||
AvgApprovalTime float64 `json:"avg_approval_time_hours"`
|
||||
AvgApprovalSteps float64 `json:"avg_approval_steps"`
|
||||
BottleneckSteps []BottleneckStep `json:"bottleneck_steps"`
|
||||
}
|
||||
|
||||
// BottleneckStep represents approval steps that cause delays
|
||||
type BottleneckStep struct {
|
||||
StepOrder int `json:"step_order"`
|
||||
ApproverName string `json:"approver_name"`
|
||||
AvgProcessTime float64 `json:"avg_process_time_hours"`
|
||||
PendingCount int64 `json:"pending_count"`
|
||||
StepOrder int `json:"step_order"`
|
||||
ApproverName string `json:"approver_name"`
|
||||
AvgProcessTime float64 `json:"avg_process_time_hours"`
|
||||
PendingCount int64 `json:"pending_count"`
|
||||
}
|
||||
|
||||
// ResponseTimeStats represents response time statistics
|
||||
type ResponseTimeStats struct {
|
||||
MinResponseTime float64 `json:"min_response_time_hours"`
|
||||
MaxResponseTime float64 `json:"max_response_time_hours"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
MinResponseTime float64 `json:"min_response_time_hours"`
|
||||
MaxResponseTime float64 `json:"max_response_time_hours"`
|
||||
AvgResponseTime float64 `json:"avg_response_time_hours"`
|
||||
MedianResponseTime float64 `json:"median_response_time_hours"`
|
||||
P95ResponseTime float64 `json:"p95_response_time_hours"`
|
||||
P99ResponseTime float64 `json:"p99_response_time_hours"`
|
||||
P95ResponseTime float64 `json:"p95_response_time_hours"`
|
||||
P99ResponseTime float64 `json:"p99_response_time_hours"`
|
||||
}
|
||||
|
||||
// SimpleDepartmentStats represents simplified department statistics
|
||||
type SimpleDepartmentStats struct {
|
||||
DepartmentID uuid.UUID `json:"department_id"`
|
||||
Department string `json:"department"`
|
||||
LetterCount int64 `json:"letter_count"`
|
||||
DepartmentID uuid.UUID `json:"department_id"`
|
||||
Department string `json:"department"`
|
||||
LetterCount int64 `json:"letter_count"`
|
||||
}
|
||||
|
||||
// DailyActivity represents daily activity data
|
||||
type DailyActivity struct {
|
||||
Date string `json:"date"`
|
||||
DayOfWeek string `json:"day_of_week"`
|
||||
IncomingCount int64 `json:"incoming_count"`
|
||||
OutgoingCount int64 `json:"outgoing_count"`
|
||||
ApprovedCount int64 `json:"approved_count,omitempty"`
|
||||
RejectedCount int64 `json:"rejected_count,omitempty"`
|
||||
Date string `json:"date"`
|
||||
DayOfWeek string `json:"day_of_week"`
|
||||
IncomingCount int64 `json:"incoming_count"`
|
||||
OutgoingCount int64 `json:"outgoing_count"`
|
||||
ApprovedCount int64 `json:"approved_count,omitempty"`
|
||||
RejectedCount int64 `json:"rejected_count,omitempty"`
|
||||
HourlyDistribution []HourlyActivity `json:"hourly_distribution,omitempty"`
|
||||
}
|
||||
|
||||
@@ -182,4 +183,4 @@ type OutgoingLetterVolume struct {
|
||||
ThisMonth int64 `json:"this_month"`
|
||||
ThisYear int64 `json:"this_year"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,18 +7,20 @@ import (
|
||||
)
|
||||
|
||||
type CreateUserRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
Password string `json:"password" validate:"required,min=6"`
|
||||
RoleID *uuid.UUID `json:"role_id,omitempty" validate:"required"`
|
||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
Password string `json:"password" validate:"required,min=6"`
|
||||
RoleID *uuid.UUID `json:"role_id,omitempty" validate:"required"`
|
||||
DepartmentIDs []uuid.UUID `json:"department_ids,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateUserRequest struct {
|
||||
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
|
||||
Email *string `json:"email,omitempty" validate:"omitempty,email"`
|
||||
Role *string `json:"role,omitempty" validate:"omitempty,oneof=admin manager cashier waiter"`
|
||||
IsActive *bool `json:"is_active,omitempty"`
|
||||
Permissions *map[string]interface{} `json:"permissions,omitempty"`
|
||||
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
|
||||
Email *string `json:"email,omitempty" validate:"omitempty,email"`
|
||||
Role *string `json:"role,omitempty" validate:"omitempty,oneof=admin manager cashier waiter"`
|
||||
IsActive *bool `json:"is_active,omitempty"`
|
||||
Permissions *map[string]interface{} `json:"permissions,omitempty"`
|
||||
DepartmentIDs *[]uuid.UUID `json:"department_ids,omitempty"`
|
||||
}
|
||||
|
||||
type ChangePasswordRequest struct {
|
||||
@@ -96,6 +98,43 @@ type ListDepartmentsResponse struct {
|
||||
Limit int `json:"limit"`
|
||||
}
|
||||
|
||||
type CreateDepartmentRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||
Code string `json:"code" validate:"required,min=1,max=50"`
|
||||
ParentID *uuid.UUID `json:"parent_id,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateDepartmentRequest struct {
|
||||
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
|
||||
Code *string `json:"code,omitempty" validate:"omitempty,min=1,max=50"`
|
||||
ParentID *uuid.UUID `json:"parent_id,omitempty"`
|
||||
}
|
||||
|
||||
type GetDepartmentResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Path string `json:"path"`
|
||||
ParentID *uuid.UUID `json:"parent_id,omitempty"`
|
||||
ParentName *string `json:"parent_name,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type DepartmentNode struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Path string `json:"path"`
|
||||
Level int `json:"level"`
|
||||
Children []*DepartmentNode `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
type OrganizationalChartResponse struct {
|
||||
Chart []*DepartmentNode `json:"chart"`
|
||||
TotalNodes int `json:"total_nodes"`
|
||||
}
|
||||
|
||||
type UserProfileResponse struct {
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
FullName string `json:"full_name"`
|
||||
|
||||
Reference in New Issue
Block a user