Skip to content

Commit

Permalink
Rename node state events API endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Jun 4, 2024
1 parent 3e2c276 commit 7617a73
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 55 deletions.
18 changes: 0 additions & 18 deletions OrcanodeMonitor/Api/MonitorController.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@ namespace OrcanodeMonitor.Api
{
[Route("api/ifttt/v1/triggers/[controller]")]
[ApiController]
public class TestController : ControllerBase
public class NodeStateEventsController : ControllerBase
{
#if false
// GET: api/ifttt/v1/triggers/test
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
#endif
private JsonResult GetEvents(int limit)
{
List<Core.OrcanodeEvent> latestEvents = Core.State.GetEvents(limit);
Expand Down Expand Up @@ -68,32 +60,5 @@ public IActionResult Post([FromBody] string value)
return BadRequest("Invalid JSON data.");
}
}

#if false
// GET api/ifttt/v1/triggers/<TestController>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}

// POST api/ifttt/v1/triggers/<TestController>
[HttpPost]
public void Post([FromBody] string value)
{
}

// PUT api/ifttt/v1/triggers/<TestController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}

// DELETE api/ifttt/v1/triggers/<TestController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
#endif
}
}
2 changes: 2 additions & 0 deletions OrcanodeMonitor/Core/OrcanodeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public override string ToString()
{
return String.Format("{0} {1} at {2}", Slug, Status, Fetcher.UnixTimeStampToDateTime(Meta.UnixTimestamp));
}
[JsonPropertyName("timestamp")]
public DateTime? DateTime => Core.Fetcher.UnixTimeStampToDateTime(Meta.UnixTimestamp)?.ToLocalTime();
[JsonPropertyName("description")]
public string Description { get
{
string nodeName = State.GetNode(Slug)?.Name ?? "<Unknown>";
Expand Down
2 changes: 1 addition & 1 deletion OrcanodeMonitor/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</tr>
}
</table>
<h1 class="display-4">Recent Events</h1>
<h1 class="display-4"><a href="/api/ifttt/v1/triggers/nodestateevents">Recent Events</a></h1>
<table>
<tr>
<th>Timestamp</th>
Expand Down

0 comments on commit 7617a73

Please sign in to comment.