Initial commit: HelpDesk ICHN - .NET 10 backend + Next.js 16 frontend

This commit is contained in:
Nurfog committed 2026-09-10 10:20:51 -03:00
commit 359f0caf85
90 files changed
+13395

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
using HelpDesk.Models.Enums;
namespace HelpDesk.Models.DTOs;
public class LoginRequest
{
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
public class RegisterRequest
{
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
}
public class AuthResponse
{
public string Token { get; set; } = string.Empty;
public DateTime Expiration { get; set; }
public UserDto User { get; set; } = null!;
}
public class UserDto
{
public Guid Id { get; set; }
public string Email { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public UserRole Role { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public string? PhoneNumber { get; set; }
public string? AvatarUrl { get; set; }
}
public class UpdateUserRequest
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public string? AvatarUrl { get; set; }
public UserRole? Role { get; set; }
public bool? IsActive { get; set; }
}
@@ -0,0 +1,28 @@
using HelpDesk.Models.Enums;
namespace HelpDesk.Models.DTOs;
public class DashboardStatsDto
{
public int TotalTickets { get; set; }
public int OpenTickets { get; set; }
public int InProgressTickets { get; set; }
public int PendingTickets { get; set; }
public int ResolvedTickets { get; set; }
public int ClosedTickets { get; set; }
public int CriticalTickets { get; set; }
public int HighTickets { get; set; }
public int MediumTickets { get; set; }
public int LowTickets { get; set; }
public double AverageResponseTimeMinutes { get; set; }
public double AverageResolutionTimeMinutes { get; set; }
public List<AgentWorkloadDto> AgentWorkloads { get; set; } = new();
}
public class AgentWorkloadDto
{
public Guid UserId { get; set; }
public string UserName { get; set; } = string.Empty;
public int ActiveTickets { get; set; }
public int ResolvedThisWeek { get; set; }
}
+16
View File
@@ -0,0 +1,16 @@
namespace HelpDesk.Models.DTOs;
public class GroupDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
}
public class CreateGroupRequest
{
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
}
@@ -0,0 +1,49 @@
namespace HelpDesk.Models.DTOs;
public class ArticleDto
{
public Guid Id { get; set; }
public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public bool IsPublished { get; set; }
public Guid CategoryId { get; set; }
public string CategoryName { get; set; } = string.Empty;
public Guid AuthorId { get; set; }
public string AuthorName { get; set; } = string.Empty;
public int ViewCount { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}
public class CreateArticleRequest
{
public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public Guid CategoryId { get; set; }
public bool IsPublished { get; set; }
}
public class UpdateArticleRequest
{
public string? Title { get; set; }
public string? Content { get; set; }
public Guid? CategoryId { get; set; }
public bool? IsPublished { get; set; }
}
public class CategoryDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public int SortOrder { get; set; }
public int ArticleCount { get; set; }
public DateTime CreatedAt { get; set; }
}
public class CreateCategoryRequest
{
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public int SortOrder { get; set; }
}
+29
View File
@@ -0,0 +1,29 @@
namespace HelpDesk.Models.DTOs;
public class SLADto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public int ResponseTimeHours { get; set; }
public int ResolutionTimeHours { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
}
public class CreateSLARequest
{
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public int ResponseTimeHours { get; set; }
public int ResolutionTimeHours { get; set; }
}
public class UpdateSLARequest
{
public string? Name { get; set; }
public string? Description { get; set; }
public int? ResponseTimeHours { get; set; }
public int? ResolutionTimeHours { get; set; }
public bool? IsActive { get; set; }
}
@@ -0,0 +1,86 @@
using HelpDesk.Models.Enums;
namespace HelpDesk.Models.DTOs;
public class CreateTicketRequest
{
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public TicketPriority Priority { get; set; } = TicketPriority.Medium;
public Guid? GroupId { get; set; }
public Guid? SlaPolicyId { get; set; }
}
public class UpdateTicketRequest
{
public string? Title { get; set; }
public string? Description { get; set; }
public TicketPriority? Priority { get; set; }
}
public class TicketDto
{
public Guid Id { get; set; }
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public TicketStatus Status { get; set; }
public TicketPriority Priority { get; set; }
public string TicketNumber { get; set; } = string.Empty;
public Guid RequesterId { get; set; }
public string RequesterName { get; set; } = string.Empty;
public Guid? AssigneeId { get; set; }
public string? AssigneeName { get; set; }
public Guid? GroupId { get; set; }
public string? GroupName { get; set; }
public Guid? SlaPolicyId { get; set; }
public string? SlaPolicyName { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public DateTime? ResolvedAt { get; set; }
public int CommentCount { get; set; }
}
public class TicketListResponse
{
public List<TicketDto> Items { get; set; } = new();
public int TotalCount { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
}
public class TicketStatsDto
{
public int TotalTickets { get; set; }
public int OpenTickets { get; set; }
public int InProgressTickets { get; set; }
public int PendingTickets { get; set; }
public int ResolvedTickets { get; set; }
public int ClosedTickets { get; set; }
}
public class AddCommentRequest
{
public string Content { get; set; } = string.Empty;
public bool IsInternal { get; set; }
}
public class CommentDto
{
public Guid Id { get; set; }
public Guid TicketId { get; set; }
public Guid UserId { get; set; }
public string UserName { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public bool IsInternal { get; set; }
public DateTime CreatedAt { get; set; }
}
public class UpdateStatusRequest
{
public TicketStatus Status { get; set; }
}
public class AssignTicketRequest
{
public Guid? AssigneeId { get; set; }
}
@@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HelpDesk.Models.Entities;
[Table("activity_logs")]
public class ActivityLog
{
[Key]
public Guid Id { get; set; }
public Guid? UserId { get; set; }
[Required]
[MaxLength(100)]
public string EntityType { get; set; } = string.Empty;
public int? EntityId { get; set; }
[Required]
[MaxLength(100)]
public string Action { get; set; } = string.Empty;
public string? Details { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public User? User { get; set; }
}
+25
View File
@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HelpDesk.Models.Entities;
[Table("groups")]
public class Group
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public ICollection<Ticket> Tickets { get; set; } = new List<Ticket>();
}
@@ -0,0 +1,31 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HelpDesk.Models.Entities;
[Table("knowledge_base_articles")]
public class KnowledgeBaseArticle
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(200)]
public string Title { get; set; } = string.Empty;
[Required]
public string Content { get; set; } = string.Empty;
public Guid CategoryId { get; set; }
public Guid AuthorId { get; set; }
public bool IsPublished { get; set; }
public int ViewCount { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public KnowledgeBaseCategory Category { get; set; } = null!;
public User Author { get; set; } = null!;
}
@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HelpDesk.Models.Entities;
[Table("knowledge_base_categories")]
public class KnowledgeBaseCategory
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
public int SortOrder { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public ICollection<KnowledgeBaseArticle> Articles { get; set; } = new List<KnowledgeBaseArticle>();
}
@@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HelpDesk.Models.Entities;
[Table("sla_policies")]
public class SLAPolicy
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
public int ResponseTimeHours { get; set; }
public int ResolutionTimeHours { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public ICollection<Ticket> Tickets { get; set; } = new List<Ticket>();
}
@@ -0,0 +1,49 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HelpDesk.Models.Enums;
namespace HelpDesk.Models.Entities;
[Table("tickets")]
public class Ticket
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(200)]
public string Title { get; set; } = string.Empty;
[Required]
public string Description { get; set; } = string.Empty;
[Required]
[MaxLength(50)]
public TicketStatus Status { get; set; } = TicketStatus.Open;
[Required]
[MaxLength(50)]
public TicketPriority Priority { get; set; } = TicketPriority.Medium;
[Required]
[MaxLength(50)]
public string TicketNumber { get; set; } = string.Empty;
public Guid RequesterId { get; set; }
public Guid? AssigneeId { get; set; }
public Guid? GroupId { get; set; }
public Guid? SlaPolicyId { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public DateTime? FirstResponseAt { get; set; }
public DateTime? ResolvedAt { get; set; }
public DateTime? ClosedAt { get; set; }
// Navigation
public User Requester { get; set; } = null!;
public User? Assignee { get; set; }
public Group? Group { get; set; }
public SLAPolicy? SlaPolicy { get; set; }
public ICollection<TicketComment> Comments { get; set; } = new List<TicketComment>();
}
@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HelpDesk.Models.Entities;
[Table("ticket_comments")]
public class TicketComment
{
[Key]
public Guid Id { get; set; }
public Guid TicketId { get; set; }
public Guid UserId { get; set; }
[Required]
public string Content { get; set; } = string.Empty;
public bool IsInternal { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public Ticket Ticket { get; set; } = null!;
public User User { get; set; } = null!;
}
+50
View File
@@ -0,0 +1,50 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HelpDesk.Models.Enums;
namespace HelpDesk.Models.Entities;
[Table("users")]
public class User
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(100)]
public string FirstName { get; set; } = string.Empty;
[Required]
[MaxLength(100)]
public string LastName { get; set; } = string.Empty;
[Required]
[MaxLength(256)]
public string Email { get; set; } = string.Empty;
[Required]
[MaxLength(500)]
public string PasswordHash { get; set; } = string.Empty;
[Required]
[MaxLength(50)]
public UserRole Role { get; set; } = UserRole.Customer;
public bool IsActive { get; set; } = true;
[MaxLength(50)]
public string? PhoneNumber { get; set; }
[MaxLength(500)]
public string? AvatarUrl { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation
public ICollection<Ticket> RequestedTickets { get; set; } = new List<Ticket>();
public ICollection<Ticket> AssignedTickets { get; set; } = new List<Ticket>();
public ICollection<TicketComment> Comments { get; set; } = new List<TicketComment>();
public ICollection<KnowledgeBaseArticle> Articles { get; set; } = new List<KnowledgeBaseArticle>();
public ICollection<ActivityLog> ActivityLogs { get; set; } = new List<ActivityLog>();
}
@@ -0,0 +1,9 @@
namespace HelpDesk.Models.Enums;
public enum TicketPriority
{
Low = 0,
Medium = 1,
High = 2,
Critical = 3
}
@@ -0,0 +1,10 @@
namespace HelpDesk.Models.Enums;
public enum TicketStatus
{
Open = 0,
InProgress = 1,
Pending = 2,
Resolved = 3,
Closed = 4
}
@@ -0,0 +1,9 @@
namespace HelpDesk.Models.Enums;
public enum UserRole
{
Customer = 0,
Agent = 1,
Admin = 2,
SuperAdmin = 3
}
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>