Projects may have got many repositories

even local ones
main
Paul Schneider 8 years ago
parent 2ef940e383
commit fea84e2df7
9 changed files with 100 additions and 90 deletions

@ -1,11 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.DNX.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.DNX.props')" />
<PropertyGroup> <PropertyGroup>
<Description>Yavsc Client&amp;Server Api</Description> <Description>Yavsc Client&amp;Server Api</Description>
<AssemblyTitle>Yavsc - l'abstrait</AssemblyTitle> <AssemblyTitle>Yavsc - l'abstrait</AssemblyTitle>
<VersionPrefix>1.0.5</VersionPrefix> <VersionPrefix>1.0.5</VersionPrefix>
<Authors>Paul Schneider &lt;paul@pschneider.fr&gt;</Authors> <Authors>Paul Schneider &lt;paul@pschneider.fr&gt;</Authors>
<TargetFrameworks>dnx451;net46;net451</TargetFrameworks> <TargetFrameworkProfiles>dnx451,net46,Profile111</TargetFrameworkProfiles>
<TargetFrameworks>net46;net45;net451;net452;net461;net462</TargetFrameworks>
<AssemblyName>Yavsc.Abstract</AssemblyName> <AssemblyName>Yavsc.Abstract</AssemblyName>
<PackageId>Yavsc.Abstract</PackageId> <PackageId>Yavsc.Abstract</PackageId>
<PackageTags>Blog;Blog;PoS;Chat</PackageTags> <PackageTags>Blog;Blog;PoS;Chat</PackageTags>

@ -47,33 +47,33 @@ namespace Yavsc.Models
// For example, you can rename the ASP.NET Identity table names and more. // For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder); // Add your customizations after calling base.OnModelCreating(builder);
builder.Entity<Relationship.Contact>().HasKey(x => new { x.OwnerId, x.UserId }); builder.Entity<Relationship.Contact>().HasKey(x => new { x.OwnerId, x.UserId });
builder.Entity<GoogleCloudMobileDeclaration>().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP"); builder.Entity<GoogleCloudMobileDeclaration>().Property(x => x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
builder.Entity<BlogTag>().HasKey(x=>new { x.PostId, x.TagId}); builder.Entity<BlogTag>().HasKey(x => new { x.PostId, x.TagId });
builder.Entity<ApplicationUser>().HasMany<ChatConnection>( c=>c.Connections ); builder.Entity<ApplicationUser>().HasMany<ChatConnection>(c => c.Connections);
builder.Entity<ApplicationUser>().Property(u=>u.Avatar).HasDefaultValue(Constants.DefaultAvatar); builder.Entity<ApplicationUser>().Property(u => u.Avatar).HasDefaultValue(Constants.DefaultAvatar);
builder.Entity<ApplicationUser>().Property(u=>u.DiskQuota).HasDefaultValue(Constants.DefaultFSQ); builder.Entity<ApplicationUser>().Property(u => u.DiskQuota).HasDefaultValue(Constants.DefaultFSQ);
builder.Entity<UserActivity>().HasKey(u=> new { u.DoesCode, u.UserId}); builder.Entity<UserActivity>().HasKey(u => new { u.DoesCode, u.UserId });
builder.Entity<Instrumentation>().HasKey(u=> new { u.InstrumentId, u.UserId}); builder.Entity<Instrumentation>().HasKey(u => new { u.InstrumentId, u.UserId });
builder.Entity<CircleAuthorizationToBlogPost>().HasKey(a=> new { a.CircleId, a.BlogPostId}); builder.Entity<CircleAuthorizationToBlogPost>().HasKey(a => new { a.CircleId, a.BlogPostId });
builder.Entity<CircleMember>().HasKey(c=> new { MemberId = c.MemberId, CircleId = c.CircleId }); builder.Entity<CircleMember>().HasKey(c => new { MemberId = c.MemberId, CircleId = c.CircleId });
builder.Entity<DimissClicked>().HasKey(c=>new { uid = c.UserId, notid = c.NotificationId}); builder.Entity<DimissClicked>().HasKey(c => new { uid = c.UserId, notid = c.NotificationId });
builder.Entity<HairTaintInstance>().HasKey(ti=>new { ti.TaintId, ti.PrestationId } ); builder.Entity<HairTaintInstance>().HasKey(ti => new { ti.TaintId, ti.PrestationId });
builder.Entity<HyperLink>().HasKey(l=>new { l.HRef, l.Method }); builder.Entity<HyperLink>().HasKey(l => new { l.HRef, l.Method });
builder.Entity<Period>().HasKey(l=>new { l.Start, l.End }); builder.Entity<Period>().HasKey(l => new { l.Start, l.End });
builder.Entity<Models.Cratie.Option>().HasKey( o => new { o.Code, o.CodeScrutin }); builder.Entity<Models.Cratie.Option>().HasKey(o => new { o.Code, o.CodeScrutin });
builder.Entity<Notification>().Property(n=> n.icon).HasDefaultValue("exclam"); builder.Entity<Notification>().Property(n => n.icon).HasDefaultValue("exclam");
builder.Entity<ChatRoomPresence>().HasKey(p=>new { room = p.ChannelName, user = p.ChatUserConnectionId }); builder.Entity<ChatRoomPresence>().HasKey(p => new { room = p.ChannelName, user = p.ChatUserConnectionId });
foreach (var et in builder.Model.GetEntityTypes()) { foreach (var et in builder.Model.GetEntityTypes())
if (et.ClrType.GetInterface("IBaseTrackedEntity")!=null) {
if (et.ClrType.GetInterface("IBaseTrackedEntity") != null)
et.FindProperty("DateCreated").IsReadOnlyAfterSave = true; et.FindProperty("DateCreated").IsReadOnlyAfterSave = true;
} }
} }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
optionsBuilder.UseNpgsql(Startup.ConnectionString); optionsBuilder.UseNpgsql((string) AppDomain.CurrentDomain.GetData("YAVSC_CONNECTION"));
} }
public DbSet<Client> Applications { get; set; } public DbSet<Client> Applications { get; set; }
public DbSet<RefreshToken> RefreshTokens { get; set; } public DbSet<RefreshToken> RefreshTokens { get; set; }
@ -128,10 +128,10 @@ namespace Yavsc.Models
/// References all declared external GCM devices /// References all declared external GCM devices
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DbSet<GoogleCloudMobileDeclaration> GCMDevices { get; set; } public DbSet<GoogleCloudMobileDeclaration> GCMDevices { get; set; }
public DbSet<Service> Services { get; set; } public DbSet<Service> Services { get; set; }
public DbSet<Product> Products { get; set; } public DbSet<Product> Products { get; set; }
public Task<OAuth2Tokens> GetTokensAsync(string googleUserId) public Task<OAuth2Tokens> GetTokensAsync(string googleUserId)
@ -186,12 +186,12 @@ namespace Yavsc.Models
Client FindApplication(string clientId) Client FindApplication(string clientId)
{ {
return Applications.FirstOrDefault( return Applications.FirstOrDefault(
app=>app.Id == clientId); app => app.Id == clientId);
} }
public DbSet<ExceptionSIREN> ExceptionsSIREN { get; set; } public DbSet<ExceptionSIREN> ExceptionsSIREN { get; set; }
public DbSet<Location> Locations { get; set; } public DbSet<Location> Locations { get; set; }
public DbSet<Tag> Tags { get; set; } public DbSet<Tag> Tags { get; set; }
@ -203,7 +203,7 @@ namespace Yavsc.Models
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; } public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
public DbSet<ChatConnection> Connections { get; set; } public DbSet<ChatConnection> Connections { get; set; }
public DbSet<BlackListed> BlackListed { get; set; } public DbSet<BlackListed> BlackListed { get; set; }
@ -214,23 +214,23 @@ namespace Yavsc.Models
public DbSet<Instrument> Instrument { get; set; } public DbSet<Instrument> Instrument { get; set; }
[ActivitySettings] [ActivitySettings]
public DbSet<DjSettings> DjSettings { get; set; } public DbSet<DjSettings> DjSettings { get; set; }
[ActivitySettings] [ActivitySettings]
public DbSet<Instrumentation> Instrumentation { get; set; } public DbSet<Instrumentation> Instrumentation { get; set; }
[ActivitySettings] [ActivitySettings]
public DbSet<FormationSettings> FormationSettings { get; set; } public DbSet<FormationSettings> FormationSettings { get; set; }
[ActivitySettings] [ActivitySettings]
public DbSet<GeneralSettings> GeneralSettings { get; set; } public DbSet<GeneralSettings> GeneralSettings { get; set; }
public DbSet<CoWorking> WorkflowProviders { get; set; } public DbSet<CoWorking> WorkflowProviders { get; set; }
private void AddTimestamps(string currentUsername) private void AddTimestamps(string currentUsername)
{ {
var entities = var entities =
ChangeTracker.Entries() ChangeTracker.Entries()
.Where(x => x.Entity.GetType().GetInterface("IBaseTrackedEntity")!=null .Where(x => x.Entity.GetType().GetInterface("IBaseTrackedEntity") != null
&& (x.State == EntityState.Added || x.State == EntityState.Modified)); && (x.State == EntityState.Added || x.State == EntityState.Modified));
@ -246,25 +246,27 @@ namespace Yavsc.Models
((IBaseTrackedEntity)entity.Entity).UserModified = currentUsername; ((IBaseTrackedEntity)entity.Entity).UserModified = currentUsername;
} }
} }
public int SaveChanges(string userId) { public int SaveChanges(string userId)
{
AddTimestamps(userId); AddTimestamps(userId);
return base.SaveChanges(); return base.SaveChanges();
} }
public async Task<int> SaveChangesAsync(string userId, CancellationToken ctoken = default(CancellationToken)) { public async Task<int> SaveChangesAsync(string userId, CancellationToken ctoken = default(CancellationToken))
{
AddTimestamps(userId); AddTimestamps(userId);
return await base.SaveChangesAsync(); return await base.SaveChangesAsync();
} }
public DbSet<Circle> Circle { get; set; } public DbSet<Circle> Circle { get; set; }
public DbSet<CircleAuthorizationToBlogPost> BlogACL { get; set; } public DbSet<CircleAuthorizationToBlogPost> BlogACL { get; set; }
public DbSet<CommandForm> CommandForm { get; set; } public DbSet<CommandForm> CommandForm { get; set; }
public DbSet<Form> Form { get; set; } public DbSet<Form> Form { get; set; }
public DbSet<Ban> Banlist { get ; set; } public DbSet<Ban> Banlist { get; set; }
public DbSet<HairTaint> HairTaint { get; set; } public DbSet<HairTaint> HairTaint { get; set; }

@ -78,6 +78,7 @@ namespace Yavsc
var auth = Configuration["Site:Authority"]; var auth = Configuration["Site:Authority"];
var cxstr = Configuration["Data:DefaultConnection:ConnectionString"]; var cxstr = Configuration["Data:DefaultConnection:ConnectionString"];
ConnectionString = cxstr; ConnectionString = cxstr;
AppDomain.CurrentDomain.SetData("YAVSC_CONNECTION", ConnectionString);
} }
public static string ConnectionString { get; set; } public static string ConnectionString { get; set; }
public static GoogleAuthSettings GoogleSettings { get; set; } public static GoogleAuthSettings GoogleSettings { get; set; }

@ -14,7 +14,8 @@
<div class="form-group"> <div class="form-group">
<label asp-for="Body" class="col-md-2 control-label"></label> <label asp-for="Body" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<textarea asp-for="Body" class="form-control" /> <textarea asp-for="Body" class="form-control" >
</textarea>
<span asp-validation-for="Body" class="text-danger" /> <span asp-validation-for="Body" class="text-danger" />
</div> </div>
</div> </div>

@ -40,7 +40,7 @@ namespace cli
var mailer = app.Services.GetService<EMailer>(); var mailer = app.Services.GetService<EMailer>();
var loggerFactory = app.Services.GetService<ILoggerFactory>(); var loggerFactory = app.Services.GetService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<Program>(); var logger = loggerFactory.CreateLogger<Program>();
mailer.SendMonthlyEmail(2,"UserOrientedTemplate"); mailer.SendMonthlyEmail(1,"UserOrientedTemplate");
logger.LogInformation("Finished"); logger.LogInformation("Finished");
} }
} }

@ -83,6 +83,7 @@ namespace cli.Services
var templateInfo = dbContext.MailingTemplate.FirstOrDefault(t => t.Id == templateCode); var templateInfo = dbContext.MailingTemplate.FirstOrDefault(t => t.Id == templateCode);
if (templateInfo==null) throw new Exception($"No template found under id {templateCode}.");
logger.LogInformation($"Using code: {templateCode}, subject: {subtemp} "); logger.LogInformation($"Using code: {templateCode}, subject: {subtemp} ");
logger.LogInformation("And body:\n"+templateInfo.Body); logger.LogInformation("And body:\n"+templateInfo.Body);
using (StringReader reader = new StringReader(templateInfo.Body)) using (StringReader reader = new StringReader(templateInfo.Body))
@ -104,7 +105,8 @@ namespace cli.Services
typeof(IdentityUser), typeof(IdentityUser),
typeof(ApplicationUser), typeof(ApplicationUser),
typeof(Template), typeof(Template),
typeof(UserOrientedTemplate) typeof(UserOrientedTemplate),
typeof(System.Threading.Tasks.TaskExtensions)
} ) } )
{ {
var location = type.Assembly.Location; var location = type.Assembly.Location;

@ -58,7 +58,8 @@ namespace cli
.AddJsonFile("appsettings.json") .AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
Configuration = builder.Build(); Configuration = builder.Build();
ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"];
AppDomain.CurrentDomain.SetData("YAVSC_CONNECTION", ConnectionString);
} }
public void ConfigureServices (IServiceCollection services) public void ConfigureServices (IServiceCollection services)
@ -79,7 +80,6 @@ namespace cli
{ {
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}); });
ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"];
services.AddEntityFramework() services.AddEntityFramework()
.AddNpgsql() .AddNpgsql()

@ -44,9 +44,9 @@
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8", "Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4", "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Newtonsoft.Json": "9.0.1", "Newtonsoft.Json": "9.0.1",
"Yavsc": { "version": "1.0.5-rc21-beta2", "target": "package" }, "Yavsc": { "version": "1.0.5-rc21-beta4", "target": "package" },
"Yavsc.Abstract": { "version": "1.0.5-rc21-beta2", "target": "package" }, "Yavsc.Abstract": { "version": "1.0.5-rc21-beta4", "target": "package" },
"Yavsc.Server": { "version": "1.0.5-rc21-beta2", "target": "package" } "Yavsc.Server": { "version": "1.0.5-rc21-beta4", "target": "package" }
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {

@ -1 +1 @@
21-beta2 21-beta4

Loading…