Polls persist restarts now.
This commit is contained in:
@ -3,15 +3,16 @@ using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Core.Services.Database.Models
|
||||
{
|
||||
public class Poll
|
||||
public class Poll : DbEntity
|
||||
{
|
||||
public ulong GuildId { get; set; }
|
||||
public ulong ChannelId { get; set; }
|
||||
public string Question { get; set; }
|
||||
public IndexedCollection<PollAnswer> Answers { get; set; }
|
||||
public HashSet<PollVote> Votes { get; set; }
|
||||
public HashSet<PollVote> Votes { get; set; } = new HashSet<PollVote>();
|
||||
}
|
||||
|
||||
public class PollAnswer : IIndexed
|
||||
public class PollAnswer : DbEntity, IIndexed
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public string Text { get; set; }
|
||||
|
@ -1,13 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Core.Services.Database.Models
|
||||
namespace NadekoBot.Core.Services.Database.Models
|
||||
{
|
||||
public class PollVote
|
||||
public class PollVote : DbEntity
|
||||
{
|
||||
|
||||
public ulong UserId { get; set; }
|
||||
public int VoteIndex { get; set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return UserId.GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is PollVote p
|
||||
? p.UserId == UserId
|
||||
: false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user