Major database refactor (again)

This commit is contained in:
Ske
2020-08-29 13:46:27 +02:00
parent 3996cd48c7
commit c7612df37e
55 changed files with 1014 additions and 1100 deletions

View File

@@ -28,17 +28,19 @@ namespace PluralKit.API
[Route( "v{version:apiVersion}/msg" )]
public class MessageController: ControllerBase
{
private IDataStore _data;
private readonly IDatabase _db;
private readonly ModelRepository _repo;
public MessageController(IDataStore _data)
public MessageController(ModelRepository repo, IDatabase db)
{
this._data = _data;
_repo = repo;
_db = db;
}
[HttpGet("{mid}")]
public async Task<ActionResult<MessageReturn>> GetMessage(ulong mid)
{
var msg = await _data.GetMessage(mid);
var msg = await _db.Execute(c => _repo.GetMessage(c, mid));
if (msg == null) return NotFound("Message not found.");
return new MessageReturn