using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Wabbajack.BuildServer.Model.Models; using Wabbajack.BuildServer.Models; using Wabbajack.Common; namespace Wabbajack.BuildServer.Controllers { [ApiController] public abstract class AControllerBase : ControllerBase { protected readonly ILogger Logger; protected readonly SqlService SQL; protected AControllerBase(ILogger logger, SqlService sql) { Logger = logger; SQL = sql; } protected async Task Metric(string verb, string subject) { await SQL.IngestMetric(new Metric { MetricsKey = Request.Headers[Consts.MetricsKeyHeader].FirstOrDefault(), Subject = subject, Action = verb, Timestamp = DateTime.UtcNow }); } } }