ChatRecord.cs 1001 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.ComponentModel.DataAnnotations;
  2. using System.ComponentModel.DataAnnotations.Schema;
  3. using Microsoft.EntityFrameworkCore;
  4. using PCC2.Data.Enums;
  5. namespace PCC2.Data.Entity;
  6. [Index(nameof(LocalPeerId),nameof(RemotePeerId),nameof(SenderTime))]
  7. public class ChatRecord
  8. {
  9. [Key]
  10. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  11. public int Id { get; set; }
  12. [Required] public int LocalPeerId { get; set; }
  13. public LocalPeer? LocalPeer { get; set; }
  14. [Required] public int RemotePeerId { get; set; }
  15. public RemotePeer? RemotePeer { get; set; }
  16. [Required] public ChatDirection Direction { get; set; }
  17. [Required] public ChatRecordKind Kind { get; set; }
  18. [Required] public DateTimeOffset SenderTime { get; set; }
  19. [Required][Column(TypeName = "TEXT")] public string? Content { get; set; }
  20. public DateTimeOffset? TargetAckTime { get; set; }
  21. public int? MediaRecordId { get; set; }
  22. public MediaRecord? MediaRecord { get; set; }
  23. }