mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Major database refactor (again)
This commit is contained in:
parent
3996cd48c7
commit
c7612df37e
55 changed files with 1014 additions and 1100 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue