Server gets created at registration now
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using watcher_monitoring.Payloads;
|
using watcher_monitoring.Payloads;
|
||||||
using watcher_monitoring.Data;
|
using watcher_monitoring.Data;
|
||||||
using watcher_monitoring.Models;
|
using watcher_monitoring.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization.Infrastructure;
|
||||||
|
|
||||||
namespace watcher_monitoring.Controllers;
|
namespace watcher_monitoring.Controllers;
|
||||||
|
|
||||||
@@ -35,7 +36,22 @@ public class MonitoringController : Controller
|
|||||||
return BadRequest(new { error = "Invalid registration payload", details = errors });
|
return BadRequest(new { error = "Invalid registration payload", details = errors });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Server server = new Server
|
||||||
|
{
|
||||||
|
Name = "test",
|
||||||
|
IPAddress = dto.IpAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
_context.Servers.Add(server);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
return Ok();
|
return Ok();
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return BadRequest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hardware Configuration Endpoint for watcher-agent
|
// Hardware Configuration Endpoint for watcher-agent
|
||||||
|
|||||||
Reference in New Issue
Block a user