sozsoft-platform/api/src/Sozsoft.Platform.Application.Contracts/Forum/ForumDtos.cs

204 lines
5.1 KiB
C#
Raw Normal View History

2026-02-24 20:44:16 +00:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
namespace Sozsoft.Platform.Forum;
// Search DTOs
public class SearchForumInput
{
[Required]
public string Query { get; set; }
public Guid? CategoryId { get; set; }
public Guid? TopicId { get; set; }
public bool SearchInCategories { get; set; } = true;
public bool SearchInTopics { get; set; } = true;
public bool SearchInPosts { get; set; } = true;
public int Page { get; set; } = 1;
public int PageSize { get; set; } = 20;
}
public class ForumSearchResultDto
{
public List<ForumCategoryDto> Categories { get; set; } = new();
public List<ForumTopicDto> Topics { get; set; } = new();
public List<ForumPostDto> Posts { get; set; } = new();
public int TotalCount { get; set; }
}
// Category DTOs
public class ForumCategoryDto : FullAuditedEntityDto<Guid>
{
public Guid? TenantId { get; set; }
public string Name { get; set; }
public string Slug { get; set; }
public string Description { get; set; }
public string Icon { get; set; }
public int DisplayOrder { get; set; }
public bool IsActive { get; set; }
public bool IsLocked { get; set; }
public int TopicCount { get; set; }
public int PostCount { get; set; }
public DateTime? LastPostDate { get; set; }
public Guid? LastPostUserId { get; set; }
}
public class CreateForumCategoryDto
{
public Guid? TenantId { get; set; }
[Required]
[StringLength(100)]
public string Name { get; set; }
[Required]
[StringLength(100)]
public string Slug { get; set; }
[Required]
[StringLength(500)]
public string Description { get; set; }
[StringLength(10)]
public string Icon { get; set; }
public int DisplayOrder { get; set; }
public bool IsActive { get; set; } = true;
public bool IsLocked { get; set; } = false;
}
public class UpdateForumCategoryDto : CreateForumCategoryDto
{
}
public class GetCategoriesInput : PagedAndSortedResultRequestDto
{
public bool? IsActive { get; set; }
public string Search { get; set; }
public GetCategoriesInput()
{
MaxResultCount = 10;
SkipCount = 0;
}
}
// Topic DTOs
public class ForumTopicDto : FullAuditedEntityDto<Guid>
{
public Guid? TenantId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public Guid CategoryId { get; set; }
public Guid AuthorId { get; set; }
public string AuthorName { get; set; }
public int ViewCount { get; set; }
public int ReplyCount { get; set; }
public int LikeCount { get; set; }
public bool IsPinned { get; set; }
public bool IsLocked { get; set; }
public bool IsSolved { get; set; }
public Guid? LastPostId { get; set; }
public DateTime? LastPostDate { get; set; }
public Guid? LastPostUserId { get; set; }
public string LastPostUserName { get; set; }
}
public class CreateForumTopicDto
{
public Guid? TenantId { get; set; }
[Required]
[StringLength(200)]
public string Title { get; set; }
[Required]
public string Content { get; set; }
[Required]
public Guid CategoryId { get; set; }
public bool IsPinned { get; set; } = false;
public bool IsLocked { get; set; } = false;
}
public class UpdateForumTopicDto
{
public Guid? TenantId { get; set; }
[Required]
[StringLength(200)]
public string Title { get; set; }
[Required]
public string Content { get; set; }
public bool IsPinned { get; set; }
public bool IsLocked { get; set; }
public bool IsSolved { get; set; }
}
public class GetTopicsInput : PagedAndSortedResultRequestDto
{
public Guid? CategoryId { get; set; }
public bool? IsPinned { get; set; }
public bool? IsSolved { get; set; }
public string Search { get; set; }
}
// Post DTOs
public class ForumPostDto : FullAuditedEntityDto<Guid>
{
public Guid? TenantId { get; set; }
public Guid TopicId { get; set; }
public string Content { get; set; }
public Guid AuthorId { get; set; }
public string AuthorName { get; set; }
public int LikeCount { get; set; }
public bool IsAcceptedAnswer { get; set; }
public Guid? ParentPostId { get; set; }
}
public class CreateForumPostDto
{
public Guid? TenantId { get; set; }
[Required]
public Guid TopicId { get; set; }
[Required]
public string Content { get; set; }
public Guid? ParentPostId { get; set; }
}
public class UpdateForumPostDto
{
public Guid? TenantId { get; set; }
[Required]
public string Content { get; set; }
public bool IsAcceptedAnswer { get; set; }
}
public class GetPostsInput : PagedAndSortedResultRequestDto
{
public Guid? TopicId { get; set; }
public bool? IsAcceptedAnswer { get; set; }
public string Search { get; set; }
}
// Statistics DTO
public class ForumStatsDto
{
public int TotalCategories { get; set; }
public int TotalTopics { get; set; }
public int TotalPosts { get; set; }
public long TotalUsers { get; set; }
public long ActiveUsers { get; set; }
}