-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,887 additions
and
909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using SnackTime.Core.Database; | ||
using SnackTime.Core.Session; | ||
|
||
namespace SnackTime.Core | ||
{ | ||
public class LocalSessionRepo : ILocalSessionRepo, IRemoteSessionRepo | ||
{ | ||
private readonly DatabaseFactory _databaseFactory; | ||
|
||
public LocalSessionRepo(DatabaseFactory databaseFactory) | ||
{ | ||
_databaseFactory = databaseFactory; | ||
} | ||
|
||
public Task UpsertSession(MediaServer.Storage.ProtoGenerated.Session session) | ||
{ | ||
using (var db = _databaseFactory.GetRepository()) | ||
{ | ||
db.Upsert(session); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public Task<List<MediaServer.Storage.ProtoGenerated.Session>> GetAll() | ||
{ | ||
using (var db = _databaseFactory.GetRepository()) | ||
{ | ||
var sessions = db.Fetch<MediaServer.Storage.ProtoGenerated.Session>(); | ||
return Task.FromResult(sessions); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace SnackTime.Core.Session | ||
{ | ||
public interface ISessionRepo | ||
{ | ||
Task UpsertSession(MediaServer.Storage.ProtoGenerated.Session session); | ||
Task<List<MediaServer.Storage.ProtoGenerated.Session>> GetAll(); | ||
} | ||
|
||
public interface ILocalSessionRepo : ISessionRepo | ||
{ | ||
} | ||
|
||
public interface IRemoteSessionRepo : ISessionRepo | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace SnackTime.Core.Session | ||
{ | ||
public interface ISessionRepoFactory | ||
{ | ||
Task<ISessionRepo> GetRepo(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.