first commit
This commit is contained in:
23
backend/Models/AppConfig.cs
Normal file
23
backend/Models/AppConfig.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace backend.Models;
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
public string SiteTitle { get; set; } = string.Empty;
|
||||
public string Subtitle { get; set; } = string.Empty;
|
||||
public List<ChannelInfo> Channels { get; set; } = new();
|
||||
public string ShortText { get; set; } = string.Empty;
|
||||
public QuizConfig Quiz { get; set; } = new();
|
||||
public string AdminPassword { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ChannelInfo
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Url { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class QuizConfig
|
||||
{
|
||||
public int ParticipationPoints { get; set; }
|
||||
public int CorrectAnswerPoints { get; set; }
|
||||
}
|
||||
24
backend/Models/KhatmItem.cs
Normal file
24
backend/Models/KhatmItem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class KhatmItem
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Url { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Points { get; set; }
|
||||
|
||||
// Navigation
|
||||
public ICollection<UserKhatmSelection> UserSelections { get; set; } = new List<UserKhatmSelection>();
|
||||
}
|
||||
37
backend/Models/QuizQuestion.cs
Normal file
37
backend/Models/QuizQuestion.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class QuizQuestion
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(500)]
|
||||
public string QuestionText { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Option1 { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Option2 { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Option3 { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Option4 { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public int CorrectOption { get; set; } // 1-4
|
||||
|
||||
// Navigation
|
||||
public ICollection<UserQuizAnswer> Answers { get; set; } = new List<UserQuizAnswer>();
|
||||
}
|
||||
28
backend/Models/User.cs
Normal file
28
backend/Models/User.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class User
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Contact { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(4)]
|
||||
public string TrackingCode { get; set; } = string.Empty;
|
||||
|
||||
// Navigation properties
|
||||
public UserQuizAttempt? QuizAttempt { get; set; }
|
||||
public ICollection<UserKhatmSelection> KhatmSelections { get; set; } = new List<UserKhatmSelection>();
|
||||
public UserTotalScore? TotalScore { get; set; }
|
||||
}
|
||||
28
backend/Models/UserKhatmSelection.cs
Normal file
28
backend/Models/UserKhatmSelection.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class UserKhatmSelection
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int KhatmItemId { get; set; }
|
||||
|
||||
public bool IsSelected { get; set; }
|
||||
|
||||
public DateTime LastModified { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(KhatmItemId))]
|
||||
public KhatmItem KhatmItem { get; set; } = null!;
|
||||
}
|
||||
29
backend/Models/UserQuizAnswer.cs
Normal file
29
backend/Models/UserQuizAnswer.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class UserQuizAnswer
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserQuizAttemptId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int QuestionId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int SelectedOption { get; set; }
|
||||
|
||||
public bool IsCorrect { get; set; }
|
||||
|
||||
// Navigation
|
||||
[ForeignKey(nameof(UserQuizAttemptId))]
|
||||
public UserQuizAttempt QuizAttempt { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(QuestionId))]
|
||||
public QuizQuestion Question { get; set; } = null!;
|
||||
}
|
||||
28
backend/Models/UserQuizAttempt.cs
Normal file
28
backend/Models/UserQuizAttempt.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class UserQuizAttempt
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int ParticipationPoints { get; set; }
|
||||
|
||||
public int CorrectAnswersCount { get; set; }
|
||||
|
||||
public int TotalQuizPoints { get; set; }
|
||||
|
||||
public DateTime CompletedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public ICollection<UserQuizAnswer> Answers { get; set; } = new List<UserQuizAnswer>();
|
||||
}
|
||||
20
backend/Models/UserTotalScore.cs
Normal file
20
backend/Models/UserTotalScore.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace backend.Models;
|
||||
|
||||
public class UserTotalScore
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int TotalPoints { get; set; }
|
||||
|
||||
// Navigation
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
Reference in New Issue
Block a user