diff --git a/Yavsc.Server/Helpers/ApplicationUser.cs b/Yavsc.Server/Helpers/ApplicationUser.cs deleted file mode 100644 index 81d17d61..00000000 --- a/Yavsc.Server/Helpers/ApplicationUser.cs +++ /dev/null @@ -1,105 +0,0 @@ - -using System.Collections.Generic; -using Microsoft.AspNet.Identity.EntityFramework; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Yavsc.Models -{ - using Models.Relationship; - using Models.Identity; - using Models.Chat; - using Models.Bank; - using Models.Access; - using Newtonsoft.Json; - - public class ApplicationUser : IdentityUser - { - /// - /// Another me, as a byte array. - /// This value points a picture that may be used - /// to present the user - /// - /// the path to an user's image, relative to it's user dir - /// Startup.UserFilesOptions - /// - /// - [MaxLength(512)] - public string Avatar { get; set; } - - [MaxLength(512)] - public string FullName { get; set; } - - - /// - /// WIP Paypal - /// - /// - [Display(Name="Account balance")] - public virtual AccountBalance AccountBalance { get; set; } - - /// - /// User's posts - /// - /// - [InverseProperty("Author"),JsonIgnore] - public virtual List Posts { get; set; } - - /// - /// User's contact list - /// - /// - [InverseProperty("Owner"),JsonIgnore] - public virtual List Book { get; set; } - - /// - /// External devices using the API - /// - /// - [InverseProperty("DeviceOwner"),JsonIgnore] - public virtual List Devices { get; set; } - - [InverseProperty("Owner"),JsonIgnore] - public virtual List Connections { get; set; } - - - /// - /// User's circles - /// - /// - [InverseProperty("Owner"),JsonIgnore] - - public virtual List Circles { get; set; } - - /// - /// Billing postal address - /// - /// - [ForeignKeyAttribute("PostalAddressId")] - public virtual Location PostalAddress { get; set; } - public long? PostalAddressId { get; set; } - - /// - /// User's Google calendar - /// - /// - [MaxLength(512)] - public string DedicatedGoogleCalendar { get; set; } - - public override string ToString() { - return this.Id+" "+this.AccountBalance?.Credits.ToString()+this.Email+" "+this.UserName+" $"+this.AccountBalance?.Credits.ToString(); - } - - public BankIdentity BankInfo { get; set; } - - public long DiskQuota { get; set; } = 512*1024*1024; - public long DiskUsage { get; set; } = 0; - - public long MaxFileSize { get; set; } = 512*1024*1024; - - [JsonIgnore][InverseProperty("Owner")] - public virtual List BlackList { get; set; } - - public bool AllowMonthlyEmail { get; set; } = false; - } -} diff --git a/test/Startup.cs b/test/Startup.cs deleted file mode 100644 index 82a5cf2d..00000000 --- a/test/Startup.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.OptionsModel; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Hosting; -using Microsoft.AspNet.Razor; -using Microsoft.Extensions.PlatformAbstractions; -using Yavsc; -using Yavsc.Models; -using Yavsc.Services; -using Microsoft.Data.Entity; -using Microsoft.AspNet.Authentication; -using Microsoft.Extensions.WebEncoders; -using Yavsc.Lib; - -namespace test -{ - public class Startup - { - public string ConnectionString - { - get ; set; - } - - public static SiteSettings SiteSetup { get; private set; } - public static SmtpSettings SmtpSettup { get; private set; } - public static IConfiguration Configuration { get; set; } - - public static string HostingFullName { get; private set; } - - ILogger logger; - public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) - { - var devtag = env.IsDevelopment()?"D":""; - var prodtag = env.IsProduction()?"P":""; - var stagetag = env.IsStaging()?"S":""; - - HostingFullName = $"{appEnv.RuntimeFramework.FullName} [{env.EnvironmentName}:{prodtag}{devtag}{stagetag}]"; - // Set up configuration sources. - - var builder = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddJsonFile("appsettings.json") - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); - Configuration = builder.Build(); - ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"]; - AppDomain.CurrentDomain.SetData("YAVSC_CONNECTION", ConnectionString); - } - - public void ConfigureServices (IServiceCollection services) - { - services.AddOptions(); - var siteSettingsconf = Configuration.GetSection("Site"); - services.Configure(siteSettingsconf); - var smtpSettingsconf = Configuration.GetSection("Smtp"); - services.Configure(smtpSettingsconf); - services.AddInstance(typeof(ILoggerFactory), new LoggerFactory()); - services.AddTransient(typeof(IEmailSender), typeof(MailSender)); - services.AddEntityFramework().AddNpgsql().AddDbContext(); - services.AddTransient((s) => new RazorTemplateEngine(s.GetService())); - services.AddLogging(); - services.AddTransient(); - services.AddLocalization(options => - { - options.ResourcesPath = "Resources"; - }); - - services.AddEntityFramework() - .AddNpgsql() - .AddDbContext( - db => db.UseNpgsql(ConnectionString) - ); - services.Configure(options => - { - options.SignInScheme = "Bearer"; - }); - - services.AddTransient(); - - services.AddAuthentication(); - - } - - public void Configure (IApplicationBuilder app, IHostingEnvironment env, - IOptions siteSettings, ILoggerFactory loggerFactory) - { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - logger = loggerFactory.CreateLogger(); - logger.LogInformation(env.EnvironmentName); - var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc"); - var clientId = authConf.GetSection("ClientId").Value; - var clientSecret = authConf.GetSection("ClientSecret").Value; - - } - - } -} diff --git a/test/src/Startup.cs b/test/src/Startup.cs index 106671dc..82a5cf2d 100644 --- a/test/src/Startup.cs +++ b/test/src/Startup.cs @@ -15,7 +15,7 @@ using Microsoft.AspNet.Authentication; using Microsoft.Extensions.WebEncoders; using Yavsc.Lib; -namespace Yavsc.test +namespace test { public class Startup { diff --git a/test/YavscServerFactory.cs b/test/src/YavscServerFactory.cs similarity index 100% rename from test/YavscServerFactory.cs rename to test/src/YavscServerFactory.cs