Cleaning up

This commit is contained in:
Zoe Roux 2020-07-05 23:20:43 +02:00
parent 6bdd363b7b
commit aa63c9e8f2
4 changed files with 5 additions and 6 deletions

View File

@ -277,7 +277,7 @@ namespace Kyoo
? null
: Convert.ChangeType(value, propertyType);
ConstantExpression valueExpr = Expression.Constant(val, property.PropertyType);
Expression condition = operand switch
{
"eq" => Expression.Equal(propertyExpr, valueExpr),
@ -286,8 +286,6 @@ namespace Kyoo
"lte" => StringCompatibleExpression(Expression.LessThanOrEqual, propertyExpr, valueExpr),
"gt" => StringCompatibleExpression(Expression.GreaterThan, propertyExpr, valueExpr),
"gte" => StringCompatibleExpression(Expression.GreaterThanOrEqual, propertyExpr, valueExpr),
// TODO Implement the Like expression
"like" => throw new NotImplementedException("Like not implemented yet"),
_ => throw new ArgumentException($"Invalid operand: {operand}")
};

View File

@ -92,7 +92,8 @@ namespace Kyoo.Controllers
(ParameterExpression)((MemberExpression)sortKey.Body).Expression
));
}
query = query.Take(page.Count);
if (page.Count > 0)
query = query.Take(page.Count);
return await query.ToListAsync();
}

View File

@ -48,7 +48,7 @@ namespace Kyoo
options.UseLazyLoadingProxies()
.UseNpgsql(_configuration.GetConnectionString("Database"));
// .EnableSensitiveDataLogging()
// .UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
//.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
}, ServiceLifetime.Transient);
services.AddDbContext<IdentityDatabase>(options =>

View File

@ -48,7 +48,7 @@ namespace Kyoo.Api
where.Remove("sortBy");
where.Remove("limit");
where.Remove("afterID");
if (limit <= 0)
if (limit == 0)
limit = 20;
ICollection<Show> shows;