using System; using System.Threading.Tasks; using DevHive.Data.Interfaces.Repositories; using DevHive.Data.Models; using Microsoft.EntityFrameworkCore; namespace DevHive.Data.Repositories { public class RatingRepository : BaseRepository, IRatingRepository { private readonly DevHiveContext _context; public RatingRepository(DevHiveContext context) : base(context) { this._context = context; } public async Task GetByPostId(Guid postId) { return await this._context.Rating .FirstOrDefaultAsync(x => x.Post.Id == postId); } public async Task> GetRating(Guid postId) { Rating rating = await this.GetByPostId(postId); return new Tuple(rating.Likes, rating.Dislikes); } public async Task HasUserRatedThisPost(Guid userId, Guid postId) { throw new NotImplementedException(); } } }