Refactor controllers
This commit is contained in:
parent
be1f02e1d9
commit
15b4cee75e
|
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using zotanpw.Backend.database;
|
using zotanpw.Backend.database;
|
||||||
using zotanpw.Backend.database.Tables;
|
using zotanpw.Backend.database.Tables;
|
||||||
|
|
||||||
namespace zotanpw.Controllers.PlaybackHistory;
|
namespace zotanpw.Controllers;
|
||||||
|
|
||||||
[ApiController, Route("/np/log")]
|
[ApiController, Route("/np/log")]
|
||||||
public class LogPlayback : Controller {
|
public class LogPlayback : Controller {
|
|
@ -1,7 +1,7 @@
|
||||||
// Auto-generated JSON mapping
|
// Auto-generated JSON mapping
|
||||||
// ReSharper disable All
|
// ReSharper disable All
|
||||||
|
|
||||||
namespace zotanpw.Controllers.PlaybackHistory;
|
namespace zotanpw.Controllers;
|
||||||
|
|
||||||
public class LogPlaybackRequest {
|
public class LogPlaybackRequest {
|
||||||
public string? Artist { get; set; }
|
public string? Artist { get; set; }
|
|
@ -1,6 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace zotanpw.Controllers.well_known;
|
namespace zotanpw.Controllers;
|
||||||
|
|
||||||
[ApiController, Route("/.well-known/pronouns")]
|
[ApiController, Route("/.well-known/pronouns")]
|
||||||
public class Pronouns : Controller {
|
public class Pronouns : Controller {
|
|
@ -3,14 +3,14 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using zotanpw.Backend.database;
|
using zotanpw.Backend.database;
|
||||||
using zotanpw.Backend.database.Tables;
|
using zotanpw.Backend.database.Tables;
|
||||||
|
|
||||||
namespace zotanpw.Controllers.Travelynx;
|
namespace zotanpw.Controllers;
|
||||||
|
|
||||||
[ApiController, Route("/travelynx")]
|
[ApiController, Route("/travelynx")]
|
||||||
public class Travelynx : Controller {
|
public class Travelynx : Controller {
|
||||||
private static readonly string TravelynxSecret = System.IO.File.ReadAllLines(".bearer_token")[0];
|
private static readonly string TravelynxSecret = System.IO.File.ReadAllLines(".bearer_token")[0];
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public TravelynxInfo Update([FromBody] TravelynxWebhookRequest rq) {
|
public TravelynxInfo Update([FromBody] TravelynxRequest rq) {
|
||||||
var token = Request.Headers.Authorization;
|
var token = Request.Headers.Authorization;
|
||||||
if (token == TravelynxSecret) {
|
if (token == TravelynxSecret) {
|
||||||
var db = new Database.DbConn();
|
var db = new Database.DbConn();
|
|
@ -1,9 +1,9 @@
|
||||||
// Auto-generated JSON mapping
|
// Auto-generated JSON mapping
|
||||||
// ReSharper disable All
|
// ReSharper disable All
|
||||||
|
|
||||||
namespace zotanpw.Controllers.Travelynx;
|
namespace zotanpw.Controllers;
|
||||||
|
|
||||||
public class TravelynxWebhookRequest {
|
public class TravelynxRequest {
|
||||||
public string? Reason { get; set; }
|
public string? Reason { get; set; }
|
||||||
public Status? Status { get; set; }
|
public Status? Status { get; set; }
|
||||||
}
|
}
|
Loading…
Reference in a new issue