Compare commits
No commits in common. "47069f5ece85b76685c933cc9c4d11c87c5afb2f" and "5b862eeb8898e3495b2887189c83f2d81d8110af" have entirely different histories.
47069f5ece
...
5b862eeb88
@ -3,7 +3,7 @@ WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM node:20-alpine as build-deps
|
||||
FROM node:alpine as build-deps
|
||||
WORKDIR /src
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm i -g gulp-cli
|
||||
|
@ -1,16 +0,0 @@
|
||||
using OliverBooth.Data.Web;
|
||||
|
||||
namespace OliverBooth.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a service which fetches books from the reading list.
|
||||
/// </summary>
|
||||
public interface IReadingListService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the books in the reading list with the specified state.
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <returns>A collection of books in the specified state.</returns>
|
||||
IReadOnlyCollection<IBook> GetBooks(BookState state);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using OliverBooth.Data.Web;
|
||||
|
||||
namespace OliverBooth.Services;
|
||||
|
||||
internal sealed class ReadingListService : IReadingListService
|
||||
{
|
||||
private readonly IDbContextFactory<WebContext> _dbContextFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReadingListService" /> class.
|
||||
/// </summary>
|
||||
/// <param name="dbContextFactory">The database context factory.</param>
|
||||
public ReadingListService(IDbContextFactory<WebContext> dbContextFactory)
|
||||
{
|
||||
_dbContextFactory = dbContextFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the books in the reading list with the specified state.
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <returns>A collection of books in the specified state.</returns>
|
||||
public IReadOnlyCollection<IBook> GetBooks(BookState state)
|
||||
{
|
||||
using WebContext context = _dbContextFactory.CreateDbContext();
|
||||
return state == (BookState)(-1)
|
||||
? context.Books.ToArray()
|
||||
: context.Books.Where(b => b.State == state).ToArray();
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2022", "DOM"],
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext"
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user