Files
draletaha/DrSousan.Api/Models/Models.cs
T
soroush.asadi 96e73bf633
CI/CD / CI · dotnet build (push) Failing after 0s
CI/CD / Deploy · drsousan (push) Has been skipped
first commit
2026-05-31 00:42:08 +03:30

138 lines
6.4 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace DrSousan.Api.Models;
// ─── Site Settings (key-value store per section) ─────────────────────────────
public class SiteSetting
{
public int Id { get; set; }
[MaxLength(100)] public string Key { get; set; } = "";
public string Value { get; set; } = "";
[MaxLength(50)] public string Section { get; set; } = "";
}
// ─── Service card ─────────────────────────────────────────────────────────────
public class Service
{
public int Id { get; set; }
[MaxLength(200)] public string Title { get; set; } = "";
public string Description { get; set; } = "";
[MaxLength(500)] public string IconSvg { get; set; } = "";
[MaxLength(500)] public string BeforeImageUrl { get; set; } = "";
[MaxLength(500)] public string AfterImageUrl { get; set; } = "";
public int Order { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Gallery item ─────────────────────────────────────────────────────────────
public class GalleryItem
{
public int Id { get; set; }
[MaxLength(500)] public string ImageUrl { get; set; } = "";
[MaxLength(500)] public string BeforeImageUrl { get; set; } = "";
[MaxLength(500)] public string AfterImageUrl { get; set; } = "";
[MaxLength(100)] public string Category { get; set; } = "";
[MaxLength(300)] public string Caption { get; set; } = "";
public int Order { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Testimonial ──────────────────────────────────────────────────────────────
public class Testimonial
{
public int Id { get; set; }
[MaxLength(100)] public string AuthorName { get; set; } = "";
[MaxLength(10)] public string AuthorEmoji { get; set; } = "👩";
public string Text { get; set; } = "";
public int Rating { get; set; } = 5;
[MaxLength(50)] public string Date { get; set; } = "";
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Blog category ────────────────────────────────────────────────────────────
public class BlogCategory
{
public int Id { get; set; }
[MaxLength(100)] public string Name { get; set; } = "";
[MaxLength(120)] public string Slug { get; set; } = "";
public string Description { get; set; } = "";
public ICollection<BlogPost> Posts { get; set; } = new List<BlogPost>();
}
// ─── Blog post ────────────────────────────────────────────────────────────────
public class BlogPost
{
public int Id { get; set; }
// Content
[MaxLength(300)] public string Title { get; set; } = "";
[MaxLength(320)] public string Slug { get; set; } = "";
public string Excerpt { get; set; } = "";
public string Content { get; set; } = "";
[MaxLength(500)] public string FeaturedImage { get; set; } = "";
[MaxLength(100)] public string Author { get; set; } = "دکتر سوسن آل‌طه";
// SEO
[MaxLength(70)] public string MetaTitle { get; set; } = "";
[MaxLength(160)] public string MetaDescription { get; set; } = "";
[MaxLength(100)] public string FocusKeyword { get; set; } = "";
public string Keywords { get; set; } = ""; // comma-separated
[MaxLength(500)] public string OgImage { get; set; } = "";
// Schema.org
[MaxLength(50)] public string ArticleType { get; set; } = "MedicalWebPage";
// Status
public bool IsPublished { get; set; } = false;
public DateTime? PublishedAt { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Metrics
public int ViewCount { get; set; } = 0;
public int ReadingTimeMinutes { get; set; } = 5;
// Relations
public int? CategoryId { get; set; }
public BlogCategory? Category { get; set; }
}
// ─── Blog comment ────────────────────────────────────────────────────────────
public class Comment
{
public int Id { get; set; }
[MaxLength(100)] public string AuthorName { get; set; } = "";
[MaxLength(200)] public string AuthorEmail { get; set; } = "";
public string Body { get; set; } = "";
public bool IsApproved { get; set; } = false;
public bool IsAdminReply { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Post relation
public int BlogPostId { get; set; }
public BlogPost? Post { get; set; }
// Self-referential reply
public int? ParentId { get; set; }
public Comment? Parent { get; set; }
public ICollection<Comment> Replies { get; set; } = new List<Comment>();
}
// ─── FAQ ─────────────────────────────────────────────────────────────────────
public class Faq
{
public int Id { get; set; }
public string Question { get; set; } = "";
public string Answer { get; set; } = "";
public int Order { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── DTOs ─────────────────────────────────────────────────────────────────────
public record LoginRequest(string Username, string Password);
public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
public record SettingDto(string Key, string Value);
public record BulkSettingsDto(Dictionary<string, string> Settings);