Fixed a bug in ScanLibrary that caused duplicated Volumes. Implemented APIs for navigating down to Volume for webui.

This is rough code and needs to be polished and refactored.
This commit is contained in:
Joseph Milazzo 2021-01-01 14:04:31 -06:00
parent 380c3e7b3c
commit c429c50ba2
18 changed files with 709 additions and 58 deletions

View file

@ -6,6 +6,7 @@ using API.Entities;
using API.Interfaces;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace API.Data
@ -45,6 +46,14 @@ namespace API.Data
.Single();
}
public async Task<IEnumerable<LibraryDto>> GetLibrariesForUsernameAysnc(string userName)
{
return await _context.Library
.Include(l => l.AppUsers)
.Where(library => library.AppUsers.Any(x => x.UserName == userName))
.ProjectTo<LibraryDto>(_mapper.ConfigurationProvider).ToListAsync();
}
public async Task<IEnumerable<LibraryDto>> GetLibrariesAsync()
{
return await _context.Library