37 lines
No EOL
1.2 KiB
C#
37 lines
No EOL
1.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
|
|
|
[Table("poll_vote")]
|
|
[Index("CreatedAt", Name = "IDX_0fb627e1c2f753262a74f0562d")]
|
|
[Index("UserId", "NoteId", "Choice", Name = "IDX_50bd7164c5b78f1f4a42c4d21f", IsUnique = true)]
|
|
[Index("UserId", Name = "IDX_66d2bd2ee31d14bcc23069a89f")]
|
|
[Index("NoteId", Name = "IDX_aecfbd5ef60374918e63ee95fa")]
|
|
public class PollVote {
|
|
[Key]
|
|
[Column("id")]
|
|
[StringLength(32)]
|
|
public string Id { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// The created date of the PollVote.
|
|
/// </summary>
|
|
[Column("createdAt")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
|
|
|
|
[Column("noteId")] [StringLength(32)] public string NoteId { get; set; } = null!;
|
|
|
|
[Column("choice")] public int Choice { get; set; }
|
|
|
|
[ForeignKey("NoteId")]
|
|
[InverseProperty("PollVotes")]
|
|
public virtual Note Note { get; set; } = null!;
|
|
|
|
[ForeignKey("UserId")]
|
|
[InverseProperty("PollVotes")]
|
|
public virtual User User { get; set; } = null!;
|
|
} |