Skip to content

Commit

Permalink
Merge pull request #75 from strem-app/tech-debt/update-data-infrastru…
Browse files Browse the repository at this point in the history
…cture

Updated query approach to allow LiteDB SQL too
  • Loading branch information
grofit authored Dec 28, 2022
2 parents 094cd0d + a810e7e commit 3fc6fda
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Strem.Data/IBsonQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ namespace Strem.Data;

public interface IBsonQuery
{
ILiteQueryable<BsonDocument> Query(ILiteQueryable<BsonDocument> queryableDocuments);
IEnumerable<BsonDocument> Query(ILiteQueryable<BsonDocument> queryableDocuments);
}
10 changes: 7 additions & 3 deletions src/Strem.Data/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ public bool Upsert(TK id, TE entity)
public IEnumerable<TE?> Query(IBsonQuery query)
{
var queryCollection = Collection.Query();
return query.Query(queryCollection)
.ToEnumerable()
.Select(GetEntity);
return query.Query(queryCollection).Select(GetEntity);
}

public IEnumerable<TE?> Query(string query)
{
using var reader = Connection.Execute(query);
return reader.ToEnumerable().Select(x => GetEntity(x.AsDocument));
}
}
5 changes: 2 additions & 3 deletions src/Strem.Infrastructure/Services/Api/InternalWebHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,14 @@ public void StartHost()
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
ServeUnknownFileTypes = true,
ServeUnknownFileTypes = true
});

app.UseStaticFiles(new StaticFileOptions
{
RequestPath = new PathString("/Plugins"),
FileProvider = new PhysicalFileProvider(StremPathHelper.PluginPath),
ServeUnknownFileTypes = true,

ServeUnknownFileTypes = true
});

app.UseEndpoints(endpoints =>
Expand Down

0 comments on commit 3fc6fda

Please sign in to comment.