Feat/usage stats collection (#317)
* feat: implement anonymous usage data collection Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
This commit is contained in:
parent
b25335acbd
commit
1c9b2572ae
23 changed files with 613 additions and 17 deletions
|
@ -20,6 +20,7 @@ namespace API.Extensions
|
|||
public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config, IWebHostEnvironment env)
|
||||
{
|
||||
services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly);
|
||||
services.AddScoped<IStatsService, StatsService>();
|
||||
services.AddScoped<ITaskScheduler, TaskScheduler>();
|
||||
services.AddScoped<IDirectoryService, DirectoryService>();
|
||||
services.AddScoped<ITokenService, TokenService>();
|
||||
|
@ -32,12 +33,8 @@ namespace API.Extensions
|
|||
services.AddScoped<ICleanupService, CleanupService>();
|
||||
services.AddScoped<IBookService, BookService>();
|
||||
|
||||
|
||||
services.AddDbContext<DataContext>(options =>
|
||||
{
|
||||
options.UseSqlite(config.GetConnectionString("DefaultConnection"));
|
||||
options.EnableSensitiveDataLogging(env.IsDevelopment() || Configuration.GetLogLevel(Program.GetAppSettingFilename()).Equals("Debug"));
|
||||
});
|
||||
services.AddSqLite(config, env);
|
||||
services.ConfigRepositories();
|
||||
|
||||
services.AddLogging(loggingBuilder =>
|
||||
{
|
||||
|
@ -47,7 +44,27 @@ namespace API.Extensions
|
|||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
private static IServiceCollection AddSqLite(this IServiceCollection services, IConfiguration config,
|
||||
IWebHostEnvironment env)
|
||||
{
|
||||
services.AddDbContext<DataContext>(options =>
|
||||
{
|
||||
options.UseSqlite(config.GetConnectionString("DefaultConnection"));
|
||||
options.EnableSensitiveDataLogging(env.IsDevelopment() || Configuration.GetLogLevel(Program.GetAppSettingFilename()).Equals("Debug"));
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
private static IServiceCollection ConfigRepositories(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<ISettingsRepository, SettingsRepository>();
|
||||
services.AddScoped<IFileRepository, FileRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddStartupTask<T>(this IServiceCollection services)
|
||||
where T : class, IStartupTask
|
||||
=> services.AddTransient<IStartupTask, T>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue