<commit_before>﻿using Api.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Text;

namespace Api.Controllers
{
    /// <summary>
    /// A base controller for handling requests and routes to other controllers
    /// </summary>    
    /// <response code="401">User is denied</response>
    [Produces("application/json")]
    [Route("Api/[controller]")]
    [Authorize]
    [ProducesResponseType(typeof(void), 401)]
    public class ApiController : Controller
    {
        protected readonly CmsDbContext dbContext;
        protected readonly ILogger _logger;

        public ApiController(CmsDbContext dbContext, ILoggerFactory loggerFactory)
        {
            this.dbContext = dbContext;
            _logger = loggerFactory.CreateLogger<ApiController>();
        }

        protected static String ToBase64String(string source)
        {
            return Convert.ToBase64String(System.IO.File.ReadAllBytes(source));
        }

        public static StatusCodeResult Forbidden() { return new StatusCodeResult(403); }
        public static StatusCodeResult Conflict() { return new StatusCodeResult(409); }
        public static StatusCodeResult Gone() { return new StatusCodeResult(410); }
        public static StatusCodeResult ServiceUnavailable() { return new StatusCodeResult(503); }
        public static ObjectResult InternalServerError(Object error) { return new ObjectResult(error) { StatusCode = 500 }; }

<commit_msg>HIPCMS-473<commit_after>﻿using Api.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Text;

namespace Api.Controllers
{
    /// <summary>
    /// A base controller for handling user requests
    /// </summary>    
    /// <response code="401">User is denied</response>
    [Produces("application/json")]
    [Route("Api/[controller]")]
    [Authorize]
    [ProducesResponseType(typeof(void), 401)]
    public class ApiController : Controller
    {
        protected readonly CmsDbContext dbContext;
        protected readonly ILogger _logger;

        public ApiController(CmsDbContext dbContext, ILoggerFactory loggerFactory)
        {
            this.dbContext = dbContext;
            _logger = loggerFactory.CreateLogger<ApiController>();
        }

        protected static String ToBase64String(string source)
        {
            return Convert.ToBase64String(System.IO.File.ReadAllBytes(source));
        }

        public static StatusCodeResult Forbidden() { return new StatusCodeResult(403); }
        public static StatusCodeResult Conflict() { return new StatusCodeResult(409); }
        public static StatusCodeResult Gone() { return new StatusCodeResult(410); }
        public static StatusCodeResult ServiceUnavailable() { return new StatusCodeResult(503); }
        public static ObjectResult InternalServerError(Object error) { return new ObjectResult(error) { StatusCode = 500 }; }


{'fraction_non_alphanumeric': 0.09292328042328042, 'fraction_numerical': 0.017526455026455025, 'mean_word_length': 3.3587896253602305, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3852078', 'n_tokens_mistral': 793, 'n_tokens_neox': 773, 'n_words': 200}