Changeset f554983 for Farmatiko


Ignore:
Timestamp:
02/14/21 17:54:35 (4 years ago)
Author:
Dimitar Slezenkovski <dslezenkovski@…>
Branches:
master
Children:
472dd7e
Parents:
6e6f04b
Message:

Add cron job for updating data, with Quartz.NET

Location:
Farmatiko
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/Controllers/FarmatikoController.cs

    r6e6f04b rf554983  
    2626            //_JSONservice.DownloadPharmaciesExcel();
    2727            //_JSONservice.GetProcessedHealthcareWorkersFromJSON();
    28             //_JSONservice.GetProcessedHealthFacilitiesFromJSON();
    29             //_JSONservice.GetProcessedMedicinesFromJSON();
    30             //_JSONservice.GetProcessedPandemicsFromJSONApi();
     28            //await _JSONservice.GetProcessedHealthFacilitiesFromJSON();
     29            //await _JSONservice.GetProcessedMedicinesFromJSON();
    3130        }
    3231        [HttpGet]
  • Farmatiko/Program.cs

    r6e6f04b rf554983  
    33using System.Linq;
    44using System.Threading.Tasks;
     5using FarmatikoServices.Services;
    56using Microsoft.AspNetCore.Hosting;
    67using Microsoft.Extensions.Configuration;
     8using Microsoft.Extensions.DependencyInjection;
    79using Microsoft.Extensions.Hosting;
    810using Microsoft.Extensions.Logging;
     
    2224                {
    2325                    webBuilder.UseStartup<Startup>();
     26                   
    2427                });
    2528    }
  • Farmatiko/Startup.cs

    r6e6f04b rf554983  
    1818using FarmatikoServices.Infrastructure;
    1919using System;
     20using Quartz;
     21using Quartz.Impl;
     22using Quartz.Spi;
     23using FarmatikoServices.Services.JobDTO;
     24
    2025namespace Farmatiko
    2126{
     
    2328    {
    2429        readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
    25 
    2630        public Startup(IConfiguration configuration)
    2731        {
     
    5357            services.AddEntityFrameworkNpgsql().AddDbContext<FarmatikoDataContext>(opt => opt.UseNpgsql(connectionString));
    5458
     59
     60
    5561            services.AddScoped<IPHRepo, PHRepo>();
    5662            services.AddScoped<IRepository, Repository>();
    5763            services.AddScoped<IAdminRepo, AdminRepo>();
     64            services.AddTransient<IUpdateDataRepo, UpdateDataRepo>();
    5865
    59             services.AddScoped<IPHService, PHService>();
     66            services.AddTransient<IPHService, PHService>();
    6067            services.AddTransient<IAdminService, AdminService>();
    6168            services.AddTransient<IService, Service>();
     
    6471
    6572            services.AddTransient<ILogger, Logger<ProcessJSONService>>();
    66 
    67             // services.AddTransient<ISystemService, SystemService>();
    6873
    6974
     
    116121                o.MemoryBufferThreshold = int.MaxValue;
    117122            });*/
     123
     124            services.AddSingleton<IJobFactory, SingletonUpdateDataJobFactory>();
     125            services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
     126
     127            services.AddTransient<UpdateDataJob>();
     128            services.AddSingleton(new JobSchedule(
     129            jobType: typeof(UpdateDataJob),
     130            cronExpression: "0/30 * * * * ?"));
     131
     132
     133            // "0 0 12 */7 * ?"
     134
     135
     136            services.AddHostedService<UpdateDataHostedService>();
    118137
    119138        }
  • Farmatiko/appsettings.json

    r6e6f04b rf554983  
    2424  },
    2525  "SecretKey": "PEJcK2bD4E2BKdNmAlUl",
    26   "TokenIssuer": "FARMATIKOISSUER"
     26  "TokenIssuer": "FARMATIKOISSUER",
     27  "ifStartup": "true"
    2728}
Note: See TracChangeset for help on using the changeset viewer.