mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Remotely.Server.Auth;
|
|
using Remotely.Shared.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Remotely.Server.API
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[ServiceFilter(typeof(ApiAuthorizationFilter))]
|
|
public class AlertsController : ControllerBase
|
|
{
|
|
[HttpPost("Create")]
|
|
public async Task<IActionResult> Create(AlertOptions alertOptions)
|
|
{
|
|
Request.Headers.TryGetValue("OrganizationID", out var orgID);
|
|
|
|
if (alertOptions.ShouldAlert)
|
|
{
|
|
var alert = new Alert()
|
|
{
|
|
CreatedOn = DateTimeOffset.Now,
|
|
DeviceID = alertOptions.AlertDeviceID,
|
|
Message = alertOptions.AlertMessage
|
|
};
|
|
// TODO: Add alert.
|
|
}
|
|
|
|
// TODO: Email.
|
|
|
|
// TODO: API request.
|
|
|
|
return Ok();
|
|
}
|
|
}
|
|
}
|