diff --git a/src/Yavsc.Abstract/Blogspot/IBlog.cs b/src/Yavsc.Abstract/Blogspot/IBlog.cs index 26e174d9..9cc121a1 100644 --- a/src/Yavsc.Abstract/Blogspot/IBlog.cs +++ b/src/Yavsc.Abstract/Blogspot/IBlog.cs @@ -3,7 +3,7 @@ namespace Yavsc { - public interface IBlogPost : ITrackedEntity, IIdentified, IRating, ITitle + public interface IBlogPost : ITrackedEntity, IIdentified, ITitle { string AuthorId { get; set; } string Content { get; set; } diff --git a/src/Yavsc.Abstract/Identity/Security/ICircleAuthorized.cs b/src/Yavsc.Abstract/Identity/Security/ICircleAuthorized.cs index 7efd00ef..eb153ec2 100644 --- a/src/Yavsc.Abstract/Identity/Security/ICircleAuthorized.cs +++ b/src/Yavsc.Abstract/Identity/Security/ICircleAuthorized.cs @@ -3,7 +3,7 @@ namespace Yavsc.Abstract.Identity.Security public interface ICircleAuthorized { long Id { get; set; } - string GetOwnerId (); + string OwnerId { get; } bool AuthorizeCircle(long circleId); ICircleAuthorization [] GetACL(); diff --git a/src/Yavsc.Abstract/Workflow/IRating.cs b/src/Yavsc.Abstract/Workflow/IRating.cs deleted file mode 100644 index bc45f9a9..00000000 --- a/src/Yavsc.Abstract/Workflow/IRating.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// IIdentified.cs -// -// Author: -// Paul Schneider -// -// Copyright (c) 2015 GNU GPL -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see . - -namespace Yavsc -{ - - /// - /// I rating. - /// - public interface IRating: IIdentified - { - /// - /// Gets or sets the rate. - /// - /// The rate. - int Rate { get; set; } - } -} - diff --git a/src/Yavsc.Server/Models/Blog/BlogPost.cs b/src/Yavsc.Server/Models/Blog/BlogPost.cs index f5d55d21..1725678f 100644 --- a/src/Yavsc.Server/Models/Blog/BlogPost.cs +++ b/src/Yavsc.Server/Models/Blog/BlogPost.cs @@ -20,10 +20,6 @@ namespace Yavsc.Models.Blog [Display(Name="Identifiant du post")] public long Id { get; set; } - [Display(Name="Indice de qualité")] - public int Rate { get; set; } - - [Display(Name="Identifiant de l'auteur")] [ForeignKey("Author")] public string AuthorId { get; set; } @@ -60,11 +56,6 @@ namespace Yavsc.Models.Blog { return ACL?.Any( i=>i.CircleId == circleId) ?? true; } - - public string GetOwnerId() - { - return AuthorId; - } public ICircleAuthorization[] GetACL() { @@ -93,5 +84,8 @@ namespace Yavsc.Models.Blog [InverseProperty("Post")] public virtual List Comments { get; set; } + + [NotMapped] + public string OwnerId => AuthorId; } } diff --git a/src/Yavsc.Server/ViewModels/BlogSpot/NewPost.cs b/src/Yavsc.Server/ViewModels/BlogSpot/NewPost.cs new file mode 100644 index 00000000..dc0d7842 --- /dev/null +++ b/src/Yavsc.Server/ViewModels/BlogSpot/NewPost.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace Yavsc.ViewModels.BlogSpot +{ + public class NewPost + { + [Required] + public string Title{ get; set; } + + [Required] + public string Content { get; set; } + } +} diff --git a/src/Yavsc/ApiControllers/Blogspot/BlogApiController.cs b/src/Yavsc/ApiControllers/Blogspot/BlogApiController.cs index 6df54178..66389352 100644 --- a/src/Yavsc/ApiControllers/Blogspot/BlogApiController.cs +++ b/src/Yavsc/ApiControllers/Blogspot/BlogApiController.cs @@ -27,7 +27,7 @@ namespace Yavsc.Controllers [HttpGet] public IEnumerable GetBlogspot() { - return _context.Blogspot.Where(b => b.Visible).OrderByDescending(b => b.UserModified); + return _context.BlogSpot.Where(b => b.Visible).OrderByDescending(b => b.UserModified); } // GET: api/BlogApi/5 @@ -39,7 +39,7 @@ namespace Yavsc.Controllers return BadRequest(ModelState); } - BlogPost blog = _context.Blogspot.Single(m => m.Id == id); + BlogPost blog = _context.BlogSpot.Single(m => m.Id == id); if (blog == null) { @@ -93,7 +93,7 @@ namespace Yavsc.Controllers return BadRequest(ModelState); } - _context.Blogspot.Add(blog); + _context.BlogSpot.Add(blog); try { _context.SaveChanges(User.GetUserId()); @@ -122,13 +122,13 @@ namespace Yavsc.Controllers return BadRequest(ModelState); } - BlogPost blog = _context.Blogspot.Single(m => m.Id == id); + BlogPost blog = _context.BlogSpot.Single(m => m.Id == id); if (blog == null) { return NotFound(); } - _context.Blogspot.Remove(blog); + _context.BlogSpot.Remove(blog); _context.SaveChanges(User.GetUserId()); return Ok(blog); @@ -145,7 +145,7 @@ namespace Yavsc.Controllers private bool BlogExists(long id) { - return _context.Blogspot.Count(e => e.Id == id) > 0; + return _context.BlogSpot.Count(e => e.Id == id) > 0; } } } diff --git a/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs b/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs index 01c3d774..41cdd95c 100644 --- a/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs +++ b/src/Yavsc/ApiControllers/Blogspot/CommentsApiController.cs @@ -45,7 +45,7 @@ namespace Yavsc.Controllers { return new BadRequestObjectResult(ModelState); } - var article = await _context.Blogspot.FirstOrDefaultAsync + var article = await _context.BlogSpot.FirstOrDefaultAsync (p=> p.Id == post.ReceiverId); if (article==null) { diff --git a/src/Yavsc/ApiControllers/PostRateApiController.cs b/src/Yavsc/ApiControllers/PostRateApiController.cs index 25bb4341..a989587d 100644 --- a/src/Yavsc/ApiControllers/PostRateApiController.cs +++ b/src/Yavsc/ApiControllers/PostRateApiController.cs @@ -27,7 +27,7 @@ namespace Yavsc.Controllers return BadRequest(ModelState); } - Models.Blog.BlogPost blogpost = _context.Blogspot.Single(x=>x.Id == id); + Models.Blog.BlogPost blogpost = _context.BlogSpot.Single(x=>x.Id == id); if (blogpost == null) { @@ -39,7 +39,6 @@ namespace Yavsc.Controllers if (!User.IsInRole(Constants.AdminGroupName)) return BadRequest(); - blogpost.Rate = rate; _context.SaveChanges(User.GetUserId()); return Ok(); diff --git a/src/Yavsc/ApiControllers/accounting/AccountController.cs b/src/Yavsc/ApiControllers/accounting/AccountController.cs index a9934a2b..2058e484 100644 --- a/src/Yavsc/ApiControllers/accounting/AccountController.cs +++ b/src/Yavsc/ApiControllers/accounting/AccountController.cs @@ -9,6 +9,7 @@ using Yavsc.Models.Account; using Yavsc.ViewModels.Account; using Yavsc.Helpers; using Yavsc.Abstract.Identity; +using System.Diagnostics; namespace Yavsc.WebApi.Controllers { @@ -129,7 +130,7 @@ namespace Yavsc.WebApi.Controllers return new BadRequestObjectResult( new { error = "user not found" }); var uid = User.FindFirstValue(ClaimTypes.NameIdentifier); - + var uuid = User.GetUserId(); var userData = await _dbContext.Users .Include(u=>u.PostalAddress) .Include(u=>u.AccountBalance) diff --git a/src/Yavsc/Config.cs b/src/Yavsc/Config.cs index 938a9c1a..484c09e3 100644 --- a/src/Yavsc/Config.cs +++ b/src/Yavsc/Config.cs @@ -1,5 +1,6 @@  -using IdentityServer4.Models; +using IdentityServer8; +using IdentityServer8.Models; using Yavsc.Settings; namespace Yavsc; @@ -65,17 +66,20 @@ public static class Config // interactive client using code flow + pkce new Client { - ClientId = "interactive", + ClientId = "mvc", ClientSecrets = { new Secret("49C1A7E1-0C79-4A89-A3D6-A37998FB86B0".Sha256()) }, AllowedGrantTypes = GrantTypes.Code, - RedirectUris = { "https://localhost:5003/signin-oidc" }, - FrontChannelLogoutUri = "https://localhost:5003/signout-oidc", + RedirectUris = { "https://localhost:5003/signin-oidc", + "http://localhost:5002/signin-oidc" }, PostLogoutRedirectUris = { "https://localhost:5003/signout-callback-oidc" }, AllowOfflineAccess = true, - AllowedScopes = { "openid", "profile", "scope2" } + AllowedScopes = { + IdentityServerConstants.StandardScopes.OpenId, + IdentityServerConstants.StandardScopes.Profile, + "scope2" } }, }; diff --git a/src/Yavsc/Controllers/Accounting/AccountController.cs b/src/Yavsc/Controllers/Accounting/AccountController.cs index 000a8138..12f56967 100644 --- a/src/Yavsc/Controllers/Accounting/AccountController.cs +++ b/src/Yavsc/Controllers/Accounting/AccountController.cs @@ -13,16 +13,16 @@ using Yavsc.ViewModels.Account; using Yavsc.Helpers; using Yavsc.Abstract.Manage; using Yavsc.Interface; -using IdentityServer4.Test; -using IdentityServer4.Services; -using IdentityServer4.Stores; +using IdentityServer8.Test; +using IdentityServer8.Services; +using IdentityServer8.Stores; using Microsoft.AspNetCore.Authentication; using Yavsc.Models.Access; -using IdentityServer4.Models; +using IdentityServer8.Models; using Yavsc.Extensions; -using IdentityServer4.Events; -using IdentityServer4.Extensions; -using IdentityServer4; +using IdentityServer8.Events; +using IdentityServer8.Extensions; +using IdentityServer8; using IdentityModel; using System.Security.Cryptography; using System.Text.Unicode; @@ -278,7 +278,7 @@ namespace Yavsc.Controllers var context = await _interaction.GetAuthorizationContextAsync(returnUrl); if (context?.IdP != null && await _schemeProvider.GetSchemeAsync(context.IdP) != null) { - var local = context.IdP == IdentityServer4.IdentityServerConstants.LocalIdentityProvider; + var local = context.IdP == IdentityServer8.IdentityServerConstants.LocalIdentityProvider; // this is meant to short circuit the UI and only trigger the one external IdP var vm = new LoginViewModel @@ -380,7 +380,7 @@ namespace Yavsc.Controllers if (User?.Identity.IsAuthenticated == true) { var idp = User.FindFirst(JwtClaimTypes.IdentityProvider)?.Value; - if (idp != null && idp != IdentityServer4.IdentityServerConstants.LocalIdentityProvider) + if (idp != null && idp != IdentityServer8.IdentityServerConstants.LocalIdentityProvider) { var providerSupportsSignout = await HttpContext.GetSchemeSupportsSignOutAsync(idp); if (providerSupportsSignout) diff --git a/src/Yavsc/Controllers/Accounting/ManageController.cs b/src/Yavsc/Controllers/Accounting/ManageController.cs index 24c3f8fa..d0f9dc01 100644 --- a/src/Yavsc/Controllers/Accounting/ManageController.cs +++ b/src/Yavsc/Controllers/Accounting/ManageController.cs @@ -93,7 +93,7 @@ namespace Yavsc.Controllers var user = await GetCurrentUserAsync(); - long pc = _dbContext.Blogspot.Count(x => x.AuthorId == user.Id); + long pc = _dbContext.BlogSpot.Count(x => x.AuthorId == user.Id); diff --git a/src/Yavsc/Controllers/Communicating/BlogspotController.cs b/src/Yavsc/Controllers/Communicating/BlogspotController.cs index 4c4e2cf9..a3eb627e 100644 --- a/src/Yavsc/Controllers/Communicating/BlogspotController.cs +++ b/src/Yavsc/Controllers/Communicating/BlogspotController.cs @@ -57,7 +57,7 @@ namespace Yavsc.Controllers { var uid = User.FindFirstValue(ClaimTypes.NameIdentifier); ViewData["Title"] = id; - return View("Title", _context.Blogspot.Include( + return View("Title", _context.BlogSpot.Include( b => b.Author ).Where(x => x.Title == id && (x.Visible || x.AuthorId == uid )).OrderByDescending( x => x.DateCreated @@ -78,7 +78,7 @@ namespace Yavsc.Controllers return NotFound(); } - BlogPost blog = _context.Blogspot + BlogPost blog = _context.BlogSpot .Include(p => p.Author) .Include(p => p.Tags) .Include(p => p.Comments) @@ -128,10 +128,9 @@ namespace Yavsc.Controllers Title = blogInput.Title, Content = blogInput.Content, Photo = blogInput.Photo, - Rate = 0, AuthorId = User.GetUserId() }; - _context.Blogspot.Add(post); + _context.BlogSpot.Add(post); _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } @@ -150,7 +149,7 @@ namespace Yavsc.Controllers } ViewData["PostTarget"]="Edit"; - BlogPost blog = _context.Blogspot.Include(x => x.Author).Include(x => x.ACL).Single(m => m.Id == id); + BlogPost blog = _context.BlogSpot.Include(x => x.Author).Include(x => x.ACL).Single(m => m.Id == id); if (blog == null) { @@ -212,7 +211,7 @@ namespace Yavsc.Controllers return NotFound(); } - BlogPost blog = _context.Blogspot.Include( + BlogPost blog = _context.BlogSpot.Include( b => b.Author ).Single(m => m.Id == id); if (blog == null) @@ -229,9 +228,9 @@ namespace Yavsc.Controllers public IActionResult DeleteConfirmed(long id) { var uid = User.GetUserId(); - BlogPost blog = _context.Blogspot.Single(m => m.Id == id && m.AuthorId == uid ); + BlogPost blog = _context.BlogSpot.Single(m => m.Id == id && m.AuthorId == uid ); - _context.Blogspot.Remove(blog); + _context.BlogSpot.Remove(blog); _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); diff --git a/src/Yavsc/Controllers/Communicating/CommentsController.cs b/src/Yavsc/Controllers/Communicating/CommentsController.cs index 2f1371b7..6c535fe8 100644 --- a/src/Yavsc/Controllers/Communicating/CommentsController.cs +++ b/src/Yavsc/Controllers/Communicating/CommentsController.cs @@ -47,7 +47,7 @@ namespace Yavsc.Controllers // GET: Comments/Create public IActionResult Create() { - ViewData["ReceiverId"] = new SelectList(_context.Blogspot, "Id", "Post"); + ViewData["ReceiverId"] = new SelectList(_context.BlogSpot, "Id", "Post"); return View(); } @@ -64,7 +64,7 @@ namespace Yavsc.Controllers await _context.SaveChangesAsync(); return RedirectToAction("Index"); } - ViewData["ReceiverId"] = new SelectList(_context.Blogspot, "Id", "Post", comment.ReceiverId); + ViewData["ReceiverId"] = new SelectList(_context.BlogSpot, "Id", "Post", comment.ReceiverId); return View(comment); } @@ -81,7 +81,7 @@ namespace Yavsc.Controllers { return NotFound(); } - ViewData["ReceiverId"] = new SelectList(_context.Blogspot, "Id", "Post", comment.ReceiverId); + ViewData["ReceiverId"] = new SelectList(_context.BlogSpot, "Id", "Post", comment.ReceiverId); return View(comment); } @@ -96,7 +96,7 @@ namespace Yavsc.Controllers await _context.SaveChangesAsync(); return RedirectToAction("Index"); } - ViewData["ReceiverId"] = new SelectList(_context.Blogspot, "Id", "Post", comment.ReceiverId); + ViewData["ReceiverId"] = new SelectList(_context.BlogSpot, "Id", "Post", comment.ReceiverId); return View(comment); } diff --git a/src/Yavsc/Controllers/Consent/ConsentController.cs b/src/Yavsc/Controllers/Consent/ConsentController.cs index e597380f..15c4a93b 100644 --- a/src/Yavsc/Controllers/Consent/ConsentController.cs +++ b/src/Yavsc/Controllers/Consent/ConsentController.cs @@ -2,16 +2,16 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Events; -using IdentityServer4.Models; -using IdentityServer4.Services; -using IdentityServer4.Extensions; +using IdentityServer8.Events; +using IdentityServer8.Models; +using IdentityServer8.Services; +using IdentityServer8.Extensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System.Linq; using System.Threading.Tasks; -using IdentityServer4.Validation; +using IdentityServer8.Validation; using System.Collections.Generic; using System; using Yavsc; @@ -122,7 +122,7 @@ namespace IdentityServerHost.Quickstart.UI var scopes = model.ScopesConsented; if (ConsentOptions.EnableOfflineAccess == false) { - scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess); + scopes = scopes.Where(x => x != IdentityServer8.IdentityServerConstants.StandardScopes.OfflineAccess); } grantedConsent = new ConsentResponse @@ -210,7 +210,7 @@ namespace IdentityServerHost.Quickstart.UI } if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) { - apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); + apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer8.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); } vm.ApiScopes = apiScopes; @@ -253,7 +253,7 @@ namespace IdentityServerHost.Quickstart.UI { return new ScopeViewModel { - Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + Value = IdentityServer8.IdentityServerConstants.StandardScopes.OfflineAccess, DisplayName = ConsentOptions.OfflineAccessDisplayName, Description = ConsentOptions.OfflineAccessDescription, Emphasize = true, diff --git a/src/Yavsc/Controllers/Consent/ProcessConsentResult.cs b/src/Yavsc/Controllers/Consent/ProcessConsentResult.cs index 1d331df0..179d00c4 100644 --- a/src/Yavsc/Controllers/Consent/ProcessConsentResult.cs +++ b/src/Yavsc/Controllers/Consent/ProcessConsentResult.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; +using IdentityServer8.Models; namespace IdentityServerHost.Quickstart.UI { diff --git a/src/Yavsc/Controllers/Device/DeviceController.cs b/src/Yavsc/Controllers/Device/DeviceController.cs index 2e69b95a..5e0c7780 100644 --- a/src/Yavsc/Controllers/Device/DeviceController.cs +++ b/src/Yavsc/Controllers/Device/DeviceController.cs @@ -6,12 +6,12 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using IdentityServer4.Configuration; -using IdentityServer4.Events; -using IdentityServer4.Extensions; -using IdentityServer4.Models; -using IdentityServer4.Services; -using IdentityServer4.Validation; +using IdentityServer8.Configuration; +using IdentityServer8.Events; +using IdentityServer8.Extensions; +using IdentityServer8.Models; +using IdentityServer8.Services; +using IdentityServer8.Validation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -103,7 +103,7 @@ namespace Yavsc.Controllers var scopes = model.ScopesConsented; if (ConsentOptions.EnableOfflineAccess == false) { - scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess); + scopes = scopes.Where(x => x != IdentityServer8.IdentityServerConstants.StandardScopes.OfflineAccess); } grantedConsent = new ConsentResponse @@ -185,7 +185,7 @@ namespace Yavsc.Controllers } if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) { - apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); + apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer8.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); } vm.ApiScopes = apiScopes; @@ -222,7 +222,7 @@ namespace Yavsc.Controllers { return new ScopeViewModel { - Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + Value = IdentityServer8.IdentityServerConstants.StandardScopes.OfflineAccess, DisplayName = ConsentOptions.OfflineAccessDisplayName, Description = ConsentOptions.OfflineAccessDescription, Emphasize = true, diff --git a/src/Yavsc/Controllers/GrantsController.cs b/src/Yavsc/Controllers/GrantsController.cs index 852f438c..225b7f5b 100644 --- a/src/Yavsc/Controllers/GrantsController.cs +++ b/src/Yavsc/Controllers/GrantsController.cs @@ -2,15 +2,15 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Services; -using IdentityServer4.Stores; +using IdentityServer8.Services; +using IdentityServer8.Stores; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using IdentityServer4.Events; -using IdentityServer4.Extensions; +using IdentityServer8.Events; +using IdentityServer8.Extensions; using Yavsc; using Yavsc.Models.Access; diff --git a/src/Yavsc/Controllers/SecurityHeadersAttribute.cs b/src/Yavsc/Controllers/SecurityHeadersAttribute.cs index a82ed1f2..db979c70 100644 --- a/src/Yavsc/Controllers/SecurityHeadersAttribute.cs +++ b/src/Yavsc/Controllers/SecurityHeadersAttribute.cs @@ -14,7 +14,8 @@ namespace Yavsc var result = context.Result; if (result is ViewResult) { - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options +#pragma warning disable ASP0019 // Suggest using IHeaderDictionary.Append or the indexer + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options")) { context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff"); @@ -48,8 +49,10 @@ namespace Yavsc var referrer_policy = "no-referrer"; if (!context.HttpContext.Response.Headers.ContainsKey("Referrer-Policy")) { - context.HttpContext.Response.Headers.Add("Referrer-Policy", referrer_policy); + context.HttpContext.Response.Headers.Add("Referrer-Policy", referrer_policy); } +#pragma warning restore ASP0019 // Suggest using IHeaderDictionary.Append or the indexer + } } } diff --git a/src/Yavsc/Extensions/AppBuilderExtensions.cs b/src/Yavsc/Extensions/AppBuilderExtensions.cs deleted file mode 100644 index d04e1be7..00000000 --- a/src/Yavsc/Extensions/AppBuilderExtensions.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; - -namespace Yavsc.Extensions { - public static class AppBuilderExtensions { - public static IApplicationBuilder UseWhen(this IApplicationBuilder app, - Func condition, Action configuration) { - if (app == null) { - throw new ArgumentNullException(nameof(app)); - } - - if (condition == null) { - throw new ArgumentNullException(nameof(condition)); - } - - if (configuration == null) { - throw new ArgumentNullException(nameof(configuration)); - } - - var builder = app.New(); - configuration(builder); - - return app.Use(next => { - builder.Run(next); - - var branch = builder.Build(); - - return context => { - if (condition(context)) { - return branch(context); - } - - return next(context); - }; - }); - } - } -} diff --git a/src/Yavsc/Extensions/ControlerExtensions.cs b/src/Yavsc/Extensions/ControlerExtensions.cs index 0de88133..53e9b41a 100644 --- a/src/Yavsc/Extensions/ControlerExtensions.cs +++ b/src/Yavsc/Extensions/ControlerExtensions.cs @@ -1,4 +1,4 @@ -using IdentityServer4.Models; +using IdentityServer8.Models; using Microsoft.AspNetCore.Mvc; using Yavsc.Models.Access; diff --git a/src/Yavsc/Extensions/HostingExtensions.cs b/src/Yavsc/Extensions/HostingExtensions.cs index 493f84f3..3e0324ac 100644 --- a/src/Yavsc/Extensions/HostingExtensions.cs +++ b/src/Yavsc/Extensions/HostingExtensions.cs @@ -1,6 +1,7 @@ using System.Globalization; +using System.Security.Cryptography.X509Certificates; using Google.Apis.Util.Store; -using IdentityServer4; +using IdentityServer8; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.DataProtection; @@ -12,6 +13,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Options; +using Microsoft.IdentityModel.Tokens; using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using Yavsc.Abstract.Workflow; @@ -31,136 +33,136 @@ namespace Yavsc.Extensions; internal static class HostingExtensions { - public static IApplicationBuilder ConfigureFileServerApp(this IApplicationBuilder app, - bool enableDirectoryBrowsing = false) + public static IApplicationBuilder ConfigureFileServerApp(this IApplicationBuilder app, + bool enableDirectoryBrowsing = false) + { + + var userFilesDirInfo = new DirectoryInfo(Config.SiteSetup.Blog); + AbstractFileSystemHelpers.UserFilesDirName = userFilesDirInfo.FullName; + + if (!userFilesDirInfo.Exists) userFilesDirInfo.Create(); + + Config.UserFilesOptions = new FileServerOptions() { + FileProvider = new PhysicalFileProvider(AbstractFileSystemHelpers.UserFilesDirName), + RequestPath = PathString.FromUriComponent(Constants.UserFilesPath), + EnableDirectoryBrowsing = enableDirectoryBrowsing, + }; + Config.UserFilesOptions.EnableDefaultFiles = true; + Config.UserFilesOptions.StaticFileOptions.ServeUnknownFileTypes = true; - var userFilesDirInfo = new DirectoryInfo(Config.SiteSetup.Blog); - AbstractFileSystemHelpers.UserFilesDirName = userFilesDirInfo.FullName; + var avatarsDirInfo = new DirectoryInfo(Config.SiteSetup.Avatars); + if (!avatarsDirInfo.Exists) avatarsDirInfo.Create(); + Config.AvatarsDirName = avatarsDirInfo.FullName; - if (!userFilesDirInfo.Exists) userFilesDirInfo.Create(); - - Config.UserFilesOptions = new FileServerOptions() - { - FileProvider = new PhysicalFileProvider(AbstractFileSystemHelpers.UserFilesDirName), - RequestPath = PathString.FromUriComponent(Constants.UserFilesPath), - EnableDirectoryBrowsing = enableDirectoryBrowsing, - }; - Config.UserFilesOptions.EnableDefaultFiles = true; - Config.UserFilesOptions.StaticFileOptions.ServeUnknownFileTypes = true; - - var avatarsDirInfo = new DirectoryInfo(Config.SiteSetup.Avatars); - if (!avatarsDirInfo.Exists) avatarsDirInfo.Create(); - Config.AvatarsDirName = avatarsDirInfo.FullName; - - Config.AvatarsOptions = new FileServerOptions() - { - FileProvider = new PhysicalFileProvider(Config.AvatarsDirName), - RequestPath = PathString.FromUriComponent(Constants.AvatarsPath), - EnableDirectoryBrowsing = enableDirectoryBrowsing - }; + Config.AvatarsOptions = new FileServerOptions() + { + FileProvider = new PhysicalFileProvider(Config.AvatarsDirName), + RequestPath = PathString.FromUriComponent(Constants.AvatarsPath), + EnableDirectoryBrowsing = enableDirectoryBrowsing + }; - var gitdirinfo = new DirectoryInfo(Config.SiteSetup.GitRepository); - Config.GitDirName = gitdirinfo.FullName; - if (!gitdirinfo.Exists) gitdirinfo.Create(); - Config.GitOptions = new FileServerOptions() - { - FileProvider = new PhysicalFileProvider(Config.GitDirName), - RequestPath = PathString.FromUriComponent(Constants.GitPath), - EnableDirectoryBrowsing = enableDirectoryBrowsing, - }; - Config.GitOptions.DefaultFilesOptions.DefaultFileNames.Add("index.md"); - Config.GitOptions.StaticFileOptions.ServeUnknownFileTypes = true; + var gitdirinfo = new DirectoryInfo(Config.SiteSetup.GitRepository); + Config.GitDirName = gitdirinfo.FullName; + if (!gitdirinfo.Exists) gitdirinfo.Create(); + Config.GitOptions = new FileServerOptions() + { + FileProvider = new PhysicalFileProvider(Config.GitDirName), + RequestPath = PathString.FromUriComponent(Constants.GitPath), + EnableDirectoryBrowsing = enableDirectoryBrowsing, + }; + Config.GitOptions.DefaultFilesOptions.DefaultFileNames.Add("index.md"); + Config.GitOptions.StaticFileOptions.ServeUnknownFileTypes = true; - app.UseFileServer(Config.UserFilesOptions); + app.UseFileServer(Config.UserFilesOptions); - app.UseFileServer(Config.AvatarsOptions); - - app.UseFileServer(Config.GitOptions); - app.UseStaticFiles(); - return app; - } + app.UseFileServer(Config.AvatarsOptions); + + app.UseFileServer(Config.GitOptions); + app.UseStaticFiles(); + return app; + } public static void ConfigureWorkflow() + { + foreach (var a in System.AppDomain.CurrentDomain.GetAssemblies()) { - foreach (var a in System.AppDomain.CurrentDomain.GetAssemblies()) + foreach (var c in a.GetTypes()) { - foreach (var c in a.GetTypes()) + if (c.IsClass && !c.IsAbstract && + c.GetInterface("ISpecializationSettings") != null) { - if (c.IsClass && !c.IsAbstract && - c.GetInterface("ISpecializationSettings") != null) - { - Config.ProfileTypes.Add(c); - } + Config.ProfileTypes.Add(c); } } + } - foreach (var propertyInfo in typeof(ApplicationDbContext).GetProperties()) + foreach (var propertyInfo in typeof(ApplicationDbContext).GetProperties()) + { + foreach (var attr in propertyInfo.CustomAttributes) { - foreach (var attr in propertyInfo.CustomAttributes) + // something like a DbSet? + if (typeof(Yavsc.Attributes.ActivitySettingsAttribute).IsAssignableFrom(attr.AttributeType)) { - // something like a DbSet? - if (typeof(Yavsc.Attributes.ActivitySettingsAttribute).IsAssignableFrom(attr.AttributeType)) - { - BillingService.UserSettings.Add(propertyInfo); - } + BillingService.UserSettings.Add(propertyInfo); } } - - RegisterBilling(BillingCodes.Brush, new Func - ( ( db, id) => - { - var query = db.HairCutQueries.Include(q=>q.Prestation).Include(q=>q.Regularisation).Single(q=>q.Id == id) ; - query.SelectedProfile = db.BrusherProfile.Single(b=>b.UserId == query.PerformerId); - return query; - })) ; - - RegisterBilling(BillingCodes.MBrush,new Func - ( (db, id) => db.HairMultiCutQueries.Include(q=>q.Regularisation).Single(q=>q.Id == id))); - - RegisterBilling(BillingCodes.Rdv, new Func - ( (db, id) => db.RdvQueries.Include(q=>q.Regularisation).Single(q=>q.Id == id))); } - public static void RegisterBilling(string code, Func getter) where T : IBillable + + RegisterBilling(BillingCodes.Brush, new Func + ((db, id) => { - BillingService.Billing.Add(code,getter) ; - BillingService.GlobalBillingMap.Add(typeof(T).Name,code); - } + var query = db.HairCutQueries.Include(q => q.Prestation).Include(q => q.Regularisation).Single(q => q.Id == id); + query.SelectedProfile = db.BrusherProfile.Single(b => b.UserId == query.PerformerId); + return query; + })); + + RegisterBilling(BillingCodes.MBrush, new Func + ((db, id) => db.HairMultiCutQueries.Include(q => q.Regularisation).Single(q => q.Id == id))); + + RegisterBilling(BillingCodes.Rdv, new Func + ((db, id) => db.RdvQueries.Include(q => q.Regularisation).Single(q => q.Id == id))); + } + public static void RegisterBilling(string code, Func getter) where T : IBillable + { + BillingService.Billing.Add(code, getter); + BillingService.GlobalBillingMap.Add(typeof(T).Name, code); + } public static WebApplication ConfigureServices(this WebApplicationBuilder builder) { - - var siteSection = builder.Configuration.GetSection("Site"); - var smtpSection = builder.Configuration.GetSection("Smtp"); - var paypalSection = builder.Configuration.GetSection("Authentication:PayPal"); - // OAuth2AppSettings - var googleAuthSettings = builder.Configuration.GetSection("Authentication:Google"); - - string? googleClientFile = builder.Configuration["Authentication:Google:GoogleWebClientJson"]; - string? googleServiceAccountJsonFile = builder.Configuration["Authentication:Google:GoogleServiceAccountJson"]; - if (googleClientFile != null) - { - Config.GoogleWebClientConfiguration = new ConfigurationBuilder().AddJsonFile(googleClientFile).Build(); - } - if (googleServiceAccountJsonFile != null) - { - FileInfo safile = new FileInfo(googleServiceAccountJsonFile); - Config.GServiceAccount = JsonConvert.DeserializeObject(safile.OpenText().ReadToEnd()); - } - string? googleClientId = builder.Configuration["Authentication:Google:ClientId"]; - string? googleClientSecret = builder.Configuration["Authentication:Google:ClientSecret"]; + var siteSection = builder.Configuration.GetSection("Site"); + var smtpSection = builder.Configuration.GetSection("Smtp"); + var paypalSection = builder.Configuration.GetSection("Authentication:PayPal"); + // OAuth2AppSettings + var googleAuthSettings = builder.Configuration.GetSection("Authentication:Google"); + + string? googleClientFile = builder.Configuration["Authentication:Google:GoogleWebClientJson"]; + string? googleServiceAccountJsonFile = builder.Configuration["Authentication:Google:GoogleServiceAccountJson"]; + if (googleClientFile != null) + { + Config.GoogleWebClientConfiguration = new ConfigurationBuilder().AddJsonFile(googleClientFile).Build(); + } + + if (googleServiceAccountJsonFile != null) + { + FileInfo safile = new FileInfo(googleServiceAccountJsonFile); + Config.GServiceAccount = JsonConvert.DeserializeObject(safile.OpenText().ReadToEnd()); + } + string? googleClientId = builder.Configuration["Authentication:Google:ClientId"]; + string? googleClientSecret = builder.Configuration["Authentication:Google:ClientSecret"]; var services = builder.Services; _ = services.AddControllersWithViews() .AddNewtonsoftJson(); - LoadGoogleConfig(builder.Configuration); - + LoadGoogleConfig(builder.Configuration); + services.Configure(siteSection); services.Configure(smtpSection); services.Configure(paypalSection); services.Configure(googleAuthSettings); - + services.AddRazorPages(); services.AddSignalR(o => { @@ -174,9 +176,8 @@ internal static class HostingExtensions .AddEntityFrameworkStores() .AddDefaultTokenProviders(); - - services.AddIdentityServer(options => + var identityServerBuilder = services.AddIdentityServer(options => { options.Events.RaiseErrorEvents = true; options.Events.RaiseInformationEvents = true; @@ -187,152 +188,165 @@ internal static class HostingExtensions options.EmitStaticAudienceClaim = true; }) .AddInMemoryIdentityResources(Config.IdentityResources) - .AddInMemoryApiScopes(Config.ApiScopes) .AddInMemoryClients(Config.Clients) + .AddInMemoryApiScopes(Config.ApiScopes) .AddAspNetIdentity() ; + + if (builder.Environment.IsDevelopment()) + { + identityServerBuilder.AddDeveloperSigningCredential(); + } + else + { + var key = builder.Configuration["YOUR-KEY-NAME"]; + var pfxBytes = Convert.FromBase64String(key); + var cert = new X509Certificate2(pfxBytes, (string)null, X509KeyStorageFlags.MachineKeySet); + identityServerBuilder.AddSigningCredential(cert); + } services.AddSession(); - // TODO .AddServerSideSessionStore() - - - services.AddAuthentication() - .AddGoogle(options => - { - options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme; + // TODO .AddServerSideSessionStore() - // register your IdentityServer with Google at https://console.developers.google.com - // enable the Google+ API - // set the redirect URI to https://localhost:5001/signin-google - options.ClientId = googleClientId; - options.ClientSecret = googleClientSecret; - }); - services.Configure(options => + + var authenticationBuilder = services.AddAuthentication(); + authenticationBuilder.AddGoogle(options => + { + options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme; + + // register your IdentityServer with Google at https://console.developers.google.com + // enable the Google+ API + // set the redirect URI to https://localhost:5001/signin-google + options.ClientId = googleClientId; + options.ClientSecret = googleClientSecret; + }); + + services.Configure(options => + { + CultureInfo[] supportedCultures = new[] { - CultureInfo[] supportedCultures = new[] - { new CultureInfo("en"), new CultureInfo("fr"), new CultureInfo("pt") - }; + }; - CultureInfo[] supportedUICultures = new[] - { + CultureInfo[] supportedUICultures = new[] + { new CultureInfo("fr"), new CultureInfo("en"), new CultureInfo("pt") - }; + }; - // You must explicitly state which cultures your application supports. - // These are the cultures the app supports for formatting numbers, dates, etc. - options.SupportedCultures = supportedCultures; + // You must explicitly state which cultures your application supports. + // These are the cultures the app supports for formatting numbers, dates, etc. + options.SupportedCultures = supportedCultures; - // These are the cultures the app supports for UI strings, i.e. we have localized resources for. - options.SupportedUICultures = supportedUICultures; + // These are the cultures the app supports for UI strings, i.e. we have localized resources for. + options.SupportedUICultures = supportedUICultures; - options.RequestCultureProviders = new List - { + options.RequestCultureProviders = new List + { new QueryStringRequestCultureProvider { Options = options }, new CookieRequestCultureProvider { Options = options, CookieName="ASPNET_CULTURE" }, new AcceptLanguageHeaderRequestCultureProvider { Options = options } - }; + }; + }); + + services.AddCors(options => + { + options.AddPolicy("CorsPolicy", builder => + { + _ = builder.WithOrigins("*"); + }); + }); + + + // Add the system clock service + _ = services.AddSingleton(); + + _ = services.AddSingleton(); + _ = services.AddSingleton(); + _ = services.AddTransient(); + + services.AddMvc(config => + { + /* var policy = new AuthorizationPolicyBuilder() + .RequireAuthenticatedUser() + .Build(); + config.Filters.Add(new AuthorizeFilter(policy)); */ + config.Filters.Add(new ProducesAttribute("application/json")); + // config.ModelBinders.Insert(0,new MyDateTimeModelBinder()); + // config.ModelBinders.Insert(0,new MyDecimalModelBinder()); + config.EnableEndpointRouting = true; + }).AddFormatterMappings( + config => config.SetMediaTypeMappingForFormat("text/pdf", + new MediaTypeHeaderValue("text/pdf")) + ).AddFormatterMappings( + config => config.SetMediaTypeMappingForFormat("text/x-tex", + new MediaTypeHeaderValue("text/x-tex")) + ) + .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix, + options => + { + options.ResourcesPath = "Resources"; + }).AddDataAnnotationsLocalization(); + + + _ = services.AddTransient(); + _ = services.AddTransient(); + _ = services.AddTransient(); + _ = services.AddTransient(); + _ = services.AddTransient((sp) => new FileDataStore("googledatastore", false)); + _ = services.AddTransient(); + + + // TODO for SMS: services.AddTransient(); + + _ = services.AddLocalization(options => + { + options.ResourcesPath = "Resources"; + }); + var dataDir = new DirectoryInfo(builder.Configuration["Site:DataDir"]); + // Add session related services. + + services.AddDataProtection().PersistKeysToFileSystem(dataDir); + services.AddAuthorization(options => + { + + options.AddPolicy("AdministratorOnly", policy => + { + _ = policy.RequireClaim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role", Constants.AdminGroupName); }); - services.AddCors(options => - { - options.AddPolicy("CorsPolicy", builder => - { - _ = builder.WithOrigins("*"); - }); - }); + options.AddPolicy("FrontOffice", policy => policy.RequireRole(Constants.FrontOfficeGroupName)); + options.AddPolicy("Bearer", new AuthorizationPolicyBuilder() + .AddAuthenticationSchemes("Bearer") + .RequireAuthenticatedUser().Build()); + // options.AddPolicy("EmployeeId", policy => policy.RequireClaim("EmployeeId", "123", "456")); + // options.AddPolicy("BuildingEntry", policy => policy.Requirements.Add(new OfficeEntryRequirement())); + options.AddPolicy("Authenticated", policy => policy.RequireAuthenticatedUser()); + options.AddPolicy("IsTheAuthor", policy => + policy.Requirements.Add(new EditPermission())); + }); + + services.AddSingleton(); - // Add the system clock service - _ = services.AddSingleton(); - - _ = services.AddSingleton(); - _ = services.AddSingleton(); - _ = services.AddTransient(); - - services.AddMvc(config => - { - /* var policy = new AuthorizationPolicyBuilder() - .RequireAuthenticatedUser() - .Build(); - config.Filters.Add(new AuthorizeFilter(policy)); */ - config.Filters.Add(new ProducesAttribute("application/json")); - // config.ModelBinders.Insert(0,new MyDateTimeModelBinder()); - // config.ModelBinders.Insert(0,new MyDecimalModelBinder()); - config.EnableEndpointRouting = true; - }).AddFormatterMappings( - config => config.SetMediaTypeMappingForFormat("text/pdf", - new MediaTypeHeaderValue("text/pdf")) - ).AddFormatterMappings( - config => config.SetMediaTypeMappingForFormat("text/x-tex", - new MediaTypeHeaderValue("text/x-tex")) - ) - .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix, - options => - { - options.ResourcesPath = "Resources"; - }).AddDataAnnotationsLocalization(); - - - _ = services.AddTransient(); - _ = services.AddTransient(); - _ = services.AddTransient(); - _ = services.AddTransient(); - _ = services.AddTransient((sp) => new FileDataStore("googledatastore", false)); - _ = services.AddTransient(); - - - // TODO for SMS: services.AddTransient(); - - _ = services.AddLocalization(options => - { - options.ResourcesPath = "Resources"; - }); - var dataDir = new DirectoryInfo(builder.Configuration["Site:DataDir"]); - // Add session related services. - - services.AddDataProtection().PersistKeysToFileSystem(dataDir); - services.AddAuthorization(options => - { - - options.AddPolicy("AdministratorOnly", policy => - { - _ = policy.RequireClaim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role", Constants.AdminGroupName); - }); - - options.AddPolicy("FrontOffice", policy => policy.RequireRole(Constants.FrontOfficeGroupName)); - options.AddPolicy("Bearer", new AuthorizationPolicyBuilder() - .AddAuthenticationSchemes("Bearer") - .RequireAuthenticatedUser().Build()); - // options.AddPolicy("EmployeeId", policy => policy.RequireClaim("EmployeeId", "123", "456")); - // options.AddPolicy("BuildingEntry", policy => policy.Requirements.Add(new OfficeEntryRequirement())); - options.AddPolicy("Authenticated", policy => policy.RequireAuthenticatedUser()); - options.AddPolicy("IsTheAuthor", policy => - policy.Requirements.Add(new EditPermission())); - }); - - services.AddSingleton(); - - return builder.Build(); } public static WebApplication ConfigurePipeline(this WebApplication app) - { - + { + if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } - else + else { app.UseExceptionHandler("/Home/Error"); } - + app.UseStaticFiles(); app.UseRouting(); app.UseIdentityServer(); @@ -353,15 +367,15 @@ internal static class HostingExtensions var googleAuthSettings = services.GetRequiredService>(); var authorizationService = services.GetRequiredService(); var localization = services.GetRequiredService>(); - Startup.Configure(app, siteSettings, smtpSettings, authorizationService, + Startup.Configure(app, siteSettings, smtpSettings, authorizationService, payPalSettings, googleAuthSettings, localization, loggerFactory, - app.Environment.EnvironmentName ); + app.Environment.EnvironmentName); app.ConfigureFileServerApp(); - + return app; } - static void LoadGoogleConfig(IConfigurationRoot configuration) + static void LoadGoogleConfig(IConfigurationRoot configuration) { string? googleClientFile = configuration["Authentication:Google:GoogleWebClientJson"]; string? googleServiceAccountJsonFile = configuration["Authentication:Google:GoogleServiceAccountJson"]; diff --git a/src/Yavsc/Extensions/HttpContextExtensions.cs b/src/Yavsc/Extensions/HttpContextExtensions.cs index 235ec277..089d124a 100644 --- a/src/Yavsc/Extensions/HttpContextExtensions.cs +++ b/src/Yavsc/Extensions/HttpContextExtensions.cs @@ -1,6 +1,6 @@ using System.Security.Claims; -using IdentityServer4; +using IdentityServer8; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/src/Yavsc/Helpers/UserHelpers.cs b/src/Yavsc/Helpers/UserHelpers.cs index d4d5c229..e6db8313 100644 --- a/src/Yavsc/Helpers/UserHelpers.cs +++ b/src/Yavsc/Helpers/UserHelpers.cs @@ -29,7 +29,7 @@ namespace Yavsc.Helpers { if (readerId == null) { - var userPosts = dbContext.Blogspot.Include( + var userPosts = dbContext.BlogSpot.Include( b => b.Author ).Where(x => ((x.AuthorId == posterId) && (x.Visible))).ToArray(); return userPosts; @@ -40,7 +40,7 @@ namespace Yavsc.Helpers dbContext.Circle.Include(c => c.Members) .Where(c => c.Members.Any(m => m.MemberId == readerId)) .Select(c => c.Id).ToArray(); - return dbContext.Blogspot.Include( + return dbContext.BlogSpot.Include( b => b.Author ).Include(p => p.ACL).Where(x => x.Author.Id == posterId && (x.Visible && diff --git a/src/Yavsc/Migrations/20250208001037_blogspotcase.Designer.cs b/src/Yavsc/Migrations/20250208001037_blogspotcase.Designer.cs new file mode 100644 index 00000000..b6921b78 --- /dev/null +++ b/src/Yavsc/Migrations/20250208001037_blogspotcase.Designer.cs @@ -0,0 +1,3513 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Yavsc.Models; + +#nullable disable + +namespace Yavsc.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250208001037_blogspotcase")] + partial class blogspotcase + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("text"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Yavsc.Abstract.Identity.ClientProviderInfo", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("Avatar") + .IsRequired() + .HasColumnType("text"); + + b.Property("BillingAddressId") + .HasColumnType("bigint"); + + b.Property("EMail") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("UserId"); + + b.ToTable("ClientProviderInfo"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.Property("TargetId") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TargetId"); + + b.ToTable("Ban"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.HasIndex("UserId"); + + b.ToTable("BlackListed"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b => + { + b.Property("CircleId") + .HasColumnType("bigint"); + + b.Property("BlogPostId") + .HasColumnType("bigint"); + + b.HasKey("CircleId", "BlogPostId"); + + b.HasIndex("BlogPostId"); + + b.ToTable("CircleAuthorizationToBlogPost"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("ContactCredits") + .HasColumnType("bigint"); + + b.Property("Credits") + .HasColumnType("numeric"); + + b.HasKey("UserId"); + + b.ToTable("BankStatus"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("AllowMonthlyEmail") + .HasColumnType("boolean"); + + b.Property("Avatar") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasDefaultValue("/images/Users/icon_user.png"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("DedicatedGoogleCalendar") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("DiskQuota") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(524288000L); + + b.Property("DiskUsage") + .HasColumnType("bigint"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FullName") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("MaxFileSize") + .HasColumnType("bigint"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("PostalAddressId") + .HasColumnType("bigint"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasAlternateKey("Email"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.HasIndex("PostalAddressId"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("AccessTokenLifetime") + .HasColumnType("integer"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LogoutRedirectUri") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("RedirectUri") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("RefreshTokenLifeTime") + .HasColumnType("integer"); + + b.Property("Secret") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.OAuth2Tokens", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("AccessToken") + .IsRequired() + .HasColumnType("text"); + + b.Property("Expiration") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresIn") + .IsRequired() + .HasColumnType("text"); + + b.Property("RefreshToken") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenType") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("UserId"); + + b.ToTable("OAuth2Tokens"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ExpiresUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("IssuedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("ProtectedTicket") + .IsRequired() + .HasColumnType("text"); + + b.Property("Subject") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.Scope", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.HasKey("Id"); + + b.ToTable("Scopes"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BalanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExecDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Impact") + .HasColumnType("numeric"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BalanceId"); + + b.ToTable("BankBook"); + }); + + modelBuilder.Entity("Yavsc.Models.Bank.BankIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("BIC") + .IsRequired() + .HasColumnType("text"); + + b.Property("BankCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("BankedKey") + .HasColumnType("integer"); + + b.Property("IBAN") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WicketCode") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("BankIdentity"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("Currency") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("EstimateId") + .HasColumnType("bigint"); + + b.Property("EstimateTemplateId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("UnitaryCost") + .HasColumnType("numeric"); + + b.HasKey("Id"); + + b.HasIndex("EstimateId"); + + b.HasIndex("EstimateTemplateId"); + + b.ToTable("CommandLine"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttachedFilesString") + .IsRequired() + .HasColumnType("text"); + + b.Property("AttachedGraphicsString") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientValidationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CommandId") + .HasColumnType("bigint"); + + b.Property("CommandType") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderValidationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("CommandId"); + + b.HasIndex("OwnerId"); + + b.ToTable("Estimates"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EstimateTemplates"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => + { + b.Property("SIREN") + .HasColumnType("text"); + + b.HasKey("SIREN"); + + b.ToTable("ExceptionsSIREN"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(56224) + .HasColumnType("character varying(56224)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.Property("Visible") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.ToTable("BlogSpot"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogTag", b => + { + b.Property("PostId") + .HasColumnType("bigint"); + + b.Property("TagId") + .HasColumnType("bigint"); + + b.HasKey("PostId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("BlogTag"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("ReceiverId") + .HasColumnType("bigint"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.Property("Visible") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("ParentId"); + + b.HasIndex("ReceiverId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b => + { + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("OwnerId"); + + b.ToTable("Schedule"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.ScheduledEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("PeriodEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("PeriodStart") + .HasColumnType("timestamp with time zone"); + + b.Property("Reccurence") + .HasColumnType("integer"); + + b.Property("ScheduleOwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ScheduleOwnerId"); + + b.HasIndex("PeriodStart", "PeriodEnd"); + + b.ToTable("ScheduledEvent"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatConnection", b => + { + b.Property("ConnectionId") + .HasColumnType("text"); + + b.Property("ApplicationUserId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Connected") + .HasColumnType("boolean"); + + b.Property("UserAgent") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("ConnectionId"); + + b.HasIndex("ApplicationUserId"); + + b.ToTable("ChatConnection"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoom", b => + { + b.Property("Name") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("LatestJoinPart") + .HasColumnType("timestamp with time zone"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Topic") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Name"); + + b.HasIndex("OwnerId"); + + b.ToTable("ChatRoom"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoomAccess", b => + { + b.Property("ChannelName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Level") + .HasColumnType("integer"); + + b.HasKey("ChannelName", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("ChatRoomAccess"); + }); + + modelBuilder.Entity("Yavsc.Models.Cratie.Option", b => + { + b.Property("Code") + .HasColumnType("text"); + + b.Property("CodeScrutin") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code", "CodeScrutin"); + + b.ToTable("Option"); + }); + + modelBuilder.Entity("Yavsc.Models.Drawing.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Blue") + .HasColumnType("smallint"); + + b.Property("Green") + .HasColumnType("smallint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Red") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.ToTable("Color"); + }); + + modelBuilder.Entity("Yavsc.Models.Forms.Form", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Summary") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Form"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("ActionDistance") + .HasColumnType("integer"); + + b.Property("CarePrice") + .HasColumnType("numeric"); + + b.Property("FlatFeeDiscount") + .HasColumnType("numeric"); + + b.Property("HalfBalayagePrice") + .HasColumnType("numeric"); + + b.Property("HalfBrushingPrice") + .HasColumnType("numeric"); + + b.Property("HalfColorPrice") + .HasColumnType("numeric"); + + b.Property("HalfDefrisPrice") + .HasColumnType("numeric"); + + b.Property("HalfFoldingPrice") + .HasColumnType("numeric"); + + b.Property("HalfMechPrice") + .HasColumnType("numeric"); + + b.Property("HalfMultiColorPrice") + .HasColumnType("numeric"); + + b.Property("HalfPermanentPrice") + .HasColumnType("numeric"); + + b.Property("KidCutPrice") + .HasColumnType("numeric"); + + b.Property("LongBalayagePrice") + .HasColumnType("numeric"); + + b.Property("LongBrushingPrice") + .HasColumnType("numeric"); + + b.Property("LongColorPrice") + .HasColumnType("numeric"); + + b.Property("LongDefrisPrice") + .HasColumnType("numeric"); + + b.Property("LongFoldingPrice") + .HasColumnType("numeric"); + + b.Property("LongMechPrice") + .HasColumnType("numeric"); + + b.Property("LongMultiColorPrice") + .HasColumnType("numeric"); + + b.Property("LongPermanentPrice") + .HasColumnType("numeric"); + + b.Property("ManBrushPrice") + .HasColumnType("numeric"); + + b.Property("ManCutPrice") + .HasColumnType("numeric"); + + b.Property("ScheduleOwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShampooPrice") + .HasColumnType("numeric"); + + b.Property("ShortBalayagePrice") + .HasColumnType("numeric"); + + b.Property("ShortBrushingPrice") + .HasColumnType("numeric"); + + b.Property("ShortColorPrice") + .HasColumnType("numeric"); + + b.Property("ShortDefrisPrice") + .HasColumnType("numeric"); + + b.Property("ShortFoldingPrice") + .HasColumnType("numeric"); + + b.Property("ShortMechPrice") + .HasColumnType("numeric"); + + b.Property("ShortMultiColorPrice") + .HasColumnType("numeric"); + + b.Property("ShortPermanentPrice") + .HasColumnType("numeric"); + + b.Property("WomenHalfCutPrice") + .HasColumnType("numeric"); + + b.Property("WomenLongCutPrice") + .HasColumnType("numeric"); + + b.Property("WomenShortCutPrice") + .HasColumnType("numeric"); + + b.HasKey("UserId"); + + b.HasIndex("ScheduleOwnerId"); + + b.ToTable("BrusherProfile"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Accepted") + .HasColumnType("boolean"); + + b.Property("ActivityCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Consent") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Decided") + .HasColumnType("boolean"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EventDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("bigint"); + + b.Property("PaymentId") + .IsRequired() + .HasColumnType("text"); + + b.Property("PerformerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrestationId") + .HasColumnType("bigint"); + + b.Property("Previsional") + .HasColumnType("numeric"); + + b.Property("SelectedProfileUserId") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.Property("ValidationDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ActivityCode"); + + b.HasIndex("ClientId"); + + b.HasIndex("LocationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PerformerId"); + + b.HasIndex("PrestationId"); + + b.HasIndex("SelectedProfileUserId"); + + b.ToTable("HairCutQueries"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Accepted") + .HasColumnType("boolean"); + + b.Property("ActivityCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Consent") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Decided") + .HasColumnType("boolean"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EventDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("bigint"); + + b.Property("PaymentId") + .IsRequired() + .HasColumnType("text"); + + b.Property("PerformerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Previsional") + .HasColumnType("numeric"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.Property("ValidationDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ActivityCode"); + + b.HasIndex("ClientId"); + + b.HasIndex("LocationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PerformerId"); + + b.ToTable("HairMultiCutQueries"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cares") + .HasColumnType("boolean"); + + b.Property("Cut") + .HasColumnType("boolean"); + + b.Property("Dressing") + .HasColumnType("integer"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("Length") + .HasColumnType("integer"); + + b.Property("Shampoo") + .HasColumnType("boolean"); + + b.Property("Tech") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("HairPrestation"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("PrestationId") + .HasColumnType("bigint"); + + b.Property("QueryId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("PrestationId"); + + b.HasIndex("QueryId"); + + b.ToTable("HairPrestationCollectionItem"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Brand") + .IsRequired() + .HasColumnType("text"); + + b.Property("ColorId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ColorId"); + + b.ToTable("HairTaint"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaintInstance", b => + { + b.Property("TaintId") + .HasColumnType("bigint"); + + b.Property("PrestationId") + .HasColumnType("bigint"); + + b.HasKey("TaintId", "PrestationId"); + + b.HasIndex("PrestationId"); + + b.ToTable("HairTaintInstance"); + }); + + modelBuilder.Entity("Yavsc.Models.IT.Evolution.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Feature"); + }); + + modelBuilder.Entity("Yavsc.Models.IT.Fixing.Bug", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("FeatureId") + .HasColumnType("bigint"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("Bug"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.DeviceDeclaration", b => + { + b.Property("DeviceId") + .HasColumnType("text"); + + b.Property("DeclarationDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("LOCALTIMESTAMP"); + + b.Property("DeviceOwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("LatestActivityUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Model") + .IsRequired() + .HasColumnType("text"); + + b.Property("Platform") + .IsRequired() + .HasColumnType("text"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("DeviceId"); + + b.HasIndex("DeviceOwnerId"); + + b.ToTable("DeviceDeclaration"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Depth") + .HasColumnType("numeric"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Height") + .HasColumnType("numeric"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("numeric"); + + b.Property("Public") + .HasColumnType("boolean"); + + b.Property("Weight") + .HasColumnType("numeric"); + + b.Property("Width") + .HasColumnType("numeric"); + + b.HasKey("Id"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContextId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Public") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("ContextId"); + + b.ToTable("Services"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.Announce", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("For") + .HasColumnType("smallint"); + + b.Property("Message") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Sender") + .IsRequired() + .HasColumnType("text"); + + b.Property("Topic") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Announce"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.DismissClicked", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.HasKey("UserId", "NotificationId"); + + b.HasIndex("NotificationId"); + + b.ToTable("DismissClicked"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Target") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("body") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("click_action") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("color") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("icon") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasDefaultValue("exclam"); + + b.Property("sound") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("tag") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("title") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.HasKey("Id"); + + b.ToTable("Notification"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Instrument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("Instrument"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.InstrumentRating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("InstrumentId") + .HasColumnType("bigint"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasAlternateKey("InstrumentId", "OwnerId"); + + b.HasIndex("OwnerId"); + + b.ToTable("InstrumentRating"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalPreference", b => + { + b.Property("OwnerProfileId") + .HasColumnType("text"); + + b.Property("DjSettingsUserId") + .HasColumnType("text"); + + b.Property("GeneralSettingsUserId") + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("integer"); + + b.Property("TendencyId") + .HasColumnType("bigint"); + + b.HasKey("OwnerProfileId"); + + b.HasIndex("DjSettingsUserId"); + + b.HasIndex("GeneralSettingsUserId"); + + b.ToTable("MusicalPreference"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalTendency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("MusicalTendency"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.DjSettings", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("SoundCloudId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("UserId"); + + b.ToTable("DjSettings"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.GeneralSettings", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("UserId"); + + b.ToTable("GeneralSettings"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b => + { + b.Property("InstrumentId") + .HasColumnType("bigint"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("InstrumentId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("Instrumentation"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b => + { + b.Property("CreationToken") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ExecutorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderReference") + .IsRequired() + .HasColumnType("text"); + + b.Property("PaypalPayerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("State") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("CreationToken"); + + b.HasIndex("ExecutorId"); + + b.ToTable("PayPalPayment"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ApplicationUserId") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Public") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.ToTable("Circle"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b => + { + b.Property("MemberId") + .HasColumnType("text"); + + b.Property("CircleId") + .HasColumnType("bigint"); + + b.HasKey("MemberId", "CircleId"); + + b.HasIndex("CircleId"); + + b.ToTable("CircleMembers"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b => + { + b.Property("OwnerId") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("AddressId") + .HasColumnType("bigint"); + + b.Property("ApplicationUserId") + .HasColumnType("text"); + + b.Property("EMail") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("OwnerId", "UserId"); + + b.HasIndex("AddressId"); + + b.HasIndex("ApplicationUserId"); + + b.ToTable("Contact"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.HyperLink", b => + { + b.Property("HRef") + .HasColumnType("text"); + + b.Property("Method") + .HasColumnType("text"); + + b.Property("BrusherProfileUserId") + .HasColumnType("text"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("text"); + + b.Property("PayPalPaymentCreationToken") + .HasColumnType("text"); + + b.Property("Rel") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("HRef", "Method"); + + b.HasIndex("BrusherProfileUserId"); + + b.HasIndex("PayPalPaymentCreationToken"); + + b.ToTable("HyperLink"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("Latitude") + .HasColumnType("double precision"); + + b.Property("Longitude") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.ToTable("Locations"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.PostalAddress", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("Country") + .IsRequired() + .HasColumnType("text"); + + b.Property("PostalCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Province") + .IsRequired() + .HasColumnType("text"); + + b.Property("State") + .IsRequired() + .HasColumnType("text"); + + b.Property("Street1") + .IsRequired() + .HasColumnType("text"); + + b.Property("Street2") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("PostalAddress"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("SiteSkills"); + }); + + modelBuilder.Entity("Yavsc.Models.Streaming.LiveFlow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DifferedFileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("MediaType") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Pitch") + .IsRequired() + .HasColumnType("text"); + + b.Property("SequenceNumber") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("LiveFlow"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.Property("Code") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Hidden") + .HasColumnType("boolean"); + + b.Property("ModeratorGroupName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentCode") + .HasColumnType("text"); + + b.Property("Photo") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("integer"); + + b.Property("SettingsClassName") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.HasIndex("ParentCode"); + + b.ToTable("Activities"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FormationSettingsUserId") + .HasColumnType("text"); + + b.Property("PerformerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkingForId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FormationSettingsUserId"); + + b.HasIndex("PerformerId"); + + b.HasIndex("WorkingForId"); + + b.ToTable("CoWorking"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ActionName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActivityCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ActivityCode"); + + b.ToTable("CommandForm"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerformerId") + .HasColumnType("text"); + + b.Property("AcceptNotifications") + .HasColumnType("boolean"); + + b.Property("AcceptPublicContact") + .HasColumnType("boolean"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("MaxDailyCost") + .HasColumnType("integer"); + + b.Property("MinDailyCost") + .HasColumnType("integer"); + + b.Property("OrganizationAddressId") + .HasColumnType("bigint"); + + b.Property("Rate") + .HasColumnType("integer"); + + b.Property("SIREN") + .IsRequired() + .HasColumnType("text"); + + b.Property("UseGeoLocalizationToReduceDistanceWithClients") + .HasColumnType("boolean"); + + b.Property("WebSite") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("PerformerId"); + + b.HasIndex("OrganizationAddressId"); + + b.ToTable("Performers"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Profiles.FormationSettings", b => + { + b.Property("UserId") + .HasColumnType("text"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("UserId"); + + b.ToTable("FormationSettings"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Accepted") + .HasColumnType("boolean"); + + b.Property("ActivityCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Consent") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Decided") + .HasColumnType("boolean"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EventDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("bigint"); + + b.Property("LocationType") + .HasColumnType("integer"); + + b.Property("PaymentId") + .IsRequired() + .HasColumnType("text"); + + b.Property("PerformerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Previsional") + .HasColumnType("numeric"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.Property("ValidationDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ActivityCode"); + + b.HasIndex("ClientId"); + + b.HasIndex("LocationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PerformerId"); + + b.ToTable("RdvQueries"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => + { + b.Property("DoesCode") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.Property("Weight") + .HasColumnType("integer"); + + b.HasKey("DoesCode", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserActivities"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.Calendar.Period", b => + { + b.Property("Start") + .HasColumnType("timestamp with time zone"); + + b.Property("End") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Start", "End"); + + b.ToTable("Period"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.EMailing.MailingTemplate", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Body") + .IsRequired() + .HasMaxLength(65536) + .HasColumnType("character varying(65536)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ReplyToAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("ToSend") + .HasColumnType("integer"); + + b.Property("Topic") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("MailingTemplate"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Accepted") + .HasColumnType("boolean"); + + b.Property("ActivityCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Consent") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Decided") + .HasColumnType("boolean"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("GitId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("PaymentId") + .IsRequired() + .HasColumnType("text"); + + b.Property("PerformerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Previsional") + .HasColumnType("numeric"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserCreated") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserModified") + .IsRequired() + .HasColumnType("text"); + + b.Property("ValidationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ActivityCode"); + + b.HasIndex("ClientId"); + + b.HasIndex("GitId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PerformerId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.ProjectBuildConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProjectId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectBuildConfiguration"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Branch") + .IsRequired() + .HasColumnType("text"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Path") + .IsRequired() + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("GitRepositoryReference"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Yavsc.Models.Access.Ban", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "TargetUser") + .WithMany() + .HasForeignKey("TargetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TargetUser"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany("BlackList") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b => + { + b.HasOne("Yavsc.Models.Blog.BlogPost", "Target") + .WithMany("ACL") + .HasForeignKey("BlogPostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Relationship.Circle", "Allowed") + .WithMany() + .HasForeignKey("CircleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Allowed"); + + b.Navigation("Target"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithOne("AccountBalance") + .HasForeignKey("Yavsc.Models.AccountBalance", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.HasOne("Yavsc.Models.Relationship.Location", "PostalAddress") + .WithMany() + .HasForeignKey("PostalAddressId"); + + b.Navigation("PostalAddress"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.HasOne("Yavsc.Models.AccountBalance", "Balance") + .WithMany() + .HasForeignKey("BalanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Balance"); + }); + + modelBuilder.Entity("Yavsc.Models.Bank.BankIdentity", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "User") + .WithMany("BankInfo") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.HasOne("Yavsc.Models.Billing.Estimate", null) + .WithMany("Bill") + .HasForeignKey("EstimateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Billing.EstimateTemplate", null) + .WithMany("Bill") + .HasForeignKey("EstimateTemplateId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.RdvQuery", "Query") + .WithMany() + .HasForeignKey("CommandId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Owner"); + + b.Navigation("Query"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogPost", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Author") + .WithMany("Posts") + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogTag", b => + { + b.HasOne("Yavsc.Models.Blog.BlogPost", "Post") + .WithMany("Tags") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Relationship.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Post"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.Comment", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Blog.Comment", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Yavsc.Models.Blog.BlogPost", "Post") + .WithMany("Comments") + .HasForeignKey("ReceiverId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Parent"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.ScheduledEvent", b => + { + b.HasOne("Yavsc.Models.Calendar.Schedule", null) + .WithMany("Events") + .HasForeignKey("ScheduleOwnerId"); + + b.HasOne("Yavsc.Server.Models.Calendar.Period", "Period") + .WithMany() + .HasForeignKey("PeriodStart", "PeriodEnd") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Period"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatConnection", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany("Connections") + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoom", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany("Rooms") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoomAccess", b => + { + b.HasOne("Yavsc.Models.Chat.ChatRoom", "Room") + .WithMany("Moderation") + .HasForeignKey("ChannelName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "User") + .WithMany("RoomAccess") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Room"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.HasOne("Yavsc.Models.Calendar.Schedule", "Schedule") + .WithMany() + .HasForeignKey("ScheduleOwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "BaseProfile") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BaseProfile"); + + b.Navigation("Schedule"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Context") + .WithMany() + .HasForeignKey("ActivityCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Relationship.Location", "Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Haircut.HairPrestation", "Prestation") + .WithMany() + .HasForeignKey("PrestationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Haircut.BrusherProfile", "SelectedProfile") + .WithMany() + .HasForeignKey("SelectedProfileUserId"); + + b.Navigation("Client"); + + b.Navigation("Context"); + + b.Navigation("Location"); + + b.Navigation("PerformerProfile"); + + b.Navigation("Prestation"); + + b.Navigation("Regularisation"); + + b.Navigation("SelectedProfile"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Context") + .WithMany() + .HasForeignKey("ActivityCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Relationship.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Context"); + + b.Navigation("Location"); + + b.Navigation("PerformerProfile"); + + b.Navigation("Regularisation"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b => + { + b.HasOne("Yavsc.Models.Haircut.HairPrestation", "Prestation") + .WithMany() + .HasForeignKey("PrestationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Haircut.HairMultiCutQuery", "Query") + .WithMany("Prestations") + .HasForeignKey("QueryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Prestation"); + + b.Navigation("Query"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => + { + b.HasOne("Yavsc.Models.Drawing.Color", "Color") + .WithMany() + .HasForeignKey("ColorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Color"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaintInstance", b => + { + b.HasOne("Yavsc.Models.Haircut.HairPrestation", "Prestation") + .WithMany("Taints") + .HasForeignKey("PrestationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Haircut.HairTaint", "Taint") + .WithMany() + .HasForeignKey("TaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Prestation"); + + b.Navigation("Taint"); + }); + + modelBuilder.Entity("Yavsc.Models.IT.Fixing.Bug", b => + { + b.HasOne("Yavsc.Models.IT.Evolution.Feature", "False") + .WithMany() + .HasForeignKey("FeatureId"); + + b.Navigation("False"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.DeviceDeclaration", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "DeviceOwner") + .WithMany("DeviceDeclaration") + .HasForeignKey("DeviceOwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeviceOwner"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Context") + .WithMany("Services") + .HasForeignKey("ContextId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Context"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.Announce", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.DismissClicked", b => + { + b.HasOne("Yavsc.Models.Messaging.Notification", "Notified") + .WithMany() + .HasForeignKey("NotificationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Notified"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.InstrumentRating", b => + { + b.HasOne("Yavsc.Models.Musical.Instrument", "Instrument") + .WithMany() + .HasForeignKey("InstrumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "Profile") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Instrument"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalPreference", b => + { + b.HasOne("Yavsc.Models.Musical.Profiles.DjSettings", null) + .WithMany("SoundColor") + .HasForeignKey("DjSettingsUserId"); + + b.HasOne("Yavsc.Models.Musical.Profiles.GeneralSettings", null) + .WithMany("SoundColor") + .HasForeignKey("GeneralSettingsUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b => + { + b.HasOne("Yavsc.Models.Musical.Instrument", "Tool") + .WithMany() + .HasForeignKey("InstrumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tool"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Executor") + .WithMany() + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Executor"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", null) + .WithMany("Circles") + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b => + { + b.HasOne("Yavsc.Models.Relationship.Circle", "Circle") + .WithMany("Members") + .HasForeignKey("CircleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "Member") + .WithMany("Membership") + .HasForeignKey("MemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Circle"); + + b.Navigation("Member"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b => + { + b.HasOne("Yavsc.Models.Relationship.PostalAddress", "PostalAddress") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", null) + .WithMany("Book") + .HasForeignKey("ApplicationUserId"); + + b.Navigation("PostalAddress"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.HyperLink", b => + { + b.HasOne("Yavsc.Models.Haircut.BrusherProfile", null) + .WithMany("Links") + .HasForeignKey("BrusherProfileUserId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment", null) + .WithMany("Links") + .HasForeignKey("PayPalPaymentCreationToken"); + }); + + modelBuilder.Entity("Yavsc.Models.Streaming.LiveFlow", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Parent") + .WithMany("Children") + .HasForeignKey("ParentCode"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b => + { + b.HasOne("Yavsc.Models.Workflow.Profiles.FormationSettings", null) + .WithMany("CoWorking") + .HasForeignKey("FormationSettingsUserId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "Performer") + .WithMany() + .HasForeignKey("PerformerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "WorkingFor") + .WithMany() + .HasForeignKey("WorkingForId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Performer"); + + b.Navigation("WorkingFor"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Context") + .WithMany("Forms") + .HasForeignKey("ActivityCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Context"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.HasOne("Yavsc.Models.Relationship.Location", "OrganizationAddress") + .WithMany() + .HasForeignKey("OrganizationAddressId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "Performer") + .WithMany() + .HasForeignKey("PerformerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrganizationAddress"); + + b.Navigation("Performer"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Context") + .WithMany() + .HasForeignKey("ActivityCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Relationship.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Context"); + + b.Navigation("Location"); + + b.Navigation("PerformerProfile"); + + b.Navigation("Regularisation"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Does") + .WithMany() + .HasForeignKey("DoesCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "User") + .WithMany("Activity") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Does"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.Project", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity", "Context") + .WithMany() + .HasForeignKey("ActivityCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.ApplicationUser", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", "Repository") + .WithMany() + .HasForeignKey("GitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Context"); + + b.Navigation("PerformerProfile"); + + b.Navigation("Regularisation"); + + b.Navigation("Repository"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.ProjectBuildConfiguration", b => + { + b.HasOne("Yavsc.Server.Models.IT.Project", "TargetProject") + .WithMany("Configurations") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TargetProject"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b => + { + b.HasOne("Yavsc.Models.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Navigation("AccountBalance") + .IsRequired(); + + b.Navigation("BankInfo"); + + b.Navigation("BlackList"); + + b.Navigation("Book"); + + b.Navigation("Circles"); + + b.Navigation("Connections"); + + b.Navigation("DeviceDeclaration"); + + b.Navigation("Membership"); + + b.Navigation("Posts"); + + b.Navigation("RoomAccess"); + + b.Navigation("Rooms"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.Navigation("Bill"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Navigation("Bill"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogPost", b => + { + b.Navigation("ACL"); + + b.Navigation("Comments"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.Comment", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b => + { + b.Navigation("Events"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoom", b => + { + b.Navigation("Moderation"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.Navigation("Links"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.Navigation("Prestations"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestation", b => + { + b.Navigation("Taints"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.DjSettings", b => + { + b.Navigation("SoundColor"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.GeneralSettings", b => + { + b.Navigation("SoundColor"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b => + { + b.Navigation("Links"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.Navigation("Members"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.Navigation("Children"); + + b.Navigation("Forms"); + + b.Navigation("Services"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Navigation("Activity"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Profiles.FormationSettings", b => + { + b.Navigation("CoWorking"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.Project", b => + { + b.Navigation("Configurations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Yavsc/Migrations/20250208001037_blogspotcase.cs b/src/Yavsc/Migrations/20250208001037_blogspotcase.cs new file mode 100644 index 00000000..13d393e5 --- /dev/null +++ b/src/Yavsc/Migrations/20250208001037_blogspotcase.cs @@ -0,0 +1,161 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Yavsc.Migrations +{ + /// + public partial class blogspotcase : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Blogspot_AspNetUsers_AuthorId", + table: "Blogspot"); + + migrationBuilder.DropForeignKey( + name: "FK_BlogTag_Blogspot_PostId", + table: "BlogTag"); + + migrationBuilder.DropForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Blogspot_BlogPostId", + table: "CircleAuthorizationToBlogPost"); + + migrationBuilder.DropForeignKey( + name: "FK_Comment_Blogspot_ReceiverId", + table: "Comment"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Blogspot", + table: "Blogspot"); + + migrationBuilder.DropColumn( + name: "Rate", + table: "Blogspot"); + + migrationBuilder.RenameTable( + name: "Blogspot", + newName: "BlogSpot"); + + migrationBuilder.RenameIndex( + name: "IX_Blogspot_AuthorId", + table: "BlogSpot", + newName: "IX_BlogSpot_AuthorId"); + + migrationBuilder.AddPrimaryKey( + name: "PK_BlogSpot", + table: "BlogSpot", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_BlogSpot_AspNetUsers_AuthorId", + table: "BlogSpot", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_BlogTag_BlogSpot_PostId", + table: "BlogTag", + column: "PostId", + principalTable: "BlogSpot", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_BlogSpot_BlogPostId", + table: "CircleAuthorizationToBlogPost", + column: "BlogPostId", + principalTable: "BlogSpot", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Comment_BlogSpot_ReceiverId", + table: "Comment", + column: "ReceiverId", + principalTable: "BlogSpot", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_BlogSpot_AspNetUsers_AuthorId", + table: "BlogSpot"); + + migrationBuilder.DropForeignKey( + name: "FK_BlogTag_BlogSpot_PostId", + table: "BlogTag"); + + migrationBuilder.DropForeignKey( + name: "FK_CircleAuthorizationToBlogPost_BlogSpot_BlogPostId", + table: "CircleAuthorizationToBlogPost"); + + migrationBuilder.DropForeignKey( + name: "FK_Comment_BlogSpot_ReceiverId", + table: "Comment"); + + migrationBuilder.DropPrimaryKey( + name: "PK_BlogSpot", + table: "BlogSpot"); + + migrationBuilder.RenameTable( + name: "BlogSpot", + newName: "Blogspot"); + + migrationBuilder.RenameIndex( + name: "IX_BlogSpot_AuthorId", + table: "Blogspot", + newName: "IX_Blogspot_AuthorId"); + + migrationBuilder.AddColumn( + name: "Rate", + table: "Blogspot", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddPrimaryKey( + name: "PK_Blogspot", + table: "Blogspot", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_Blogspot_AspNetUsers_AuthorId", + table: "Blogspot", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_BlogTag_Blogspot_PostId", + table: "BlogTag", + column: "PostId", + principalTable: "Blogspot", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Blogspot_BlogPostId", + table: "CircleAuthorizationToBlogPost", + column: "BlogPostId", + principalTable: "Blogspot", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Comment_Blogspot_ReceiverId", + table: "Comment", + column: "ReceiverId", + principalTable: "Blogspot", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index 7fe8001b..85f8cf30 100644 --- a/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -725,9 +725,6 @@ namespace Yavsc.Migrations .HasMaxLength(1024) .HasColumnType("character varying(1024)"); - b.Property("Rate") - .HasColumnType("integer"); - b.Property("Title") .IsRequired() .HasMaxLength(1024) @@ -748,7 +745,7 @@ namespace Yavsc.Migrations b.HasIndex("AuthorId"); - b.ToTable("Blogspot"); + b.ToTable("BlogSpot"); }); modelBuilder.Entity("Yavsc.Models.Blog.BlogTag", b => diff --git a/src/Yavsc/Models/Access/ProcessConsentResult.cs b/src/Yavsc/Models/Access/ProcessConsentResult.cs index b86eb9f8..6800211c 100644 --- a/src/Yavsc/Models/Access/ProcessConsentResult.cs +++ b/src/Yavsc/Models/Access/ProcessConsentResult.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; +using IdentityServer8.Models; namespace Yavsc.Models.Access { diff --git a/src/Yavsc/Models/ApplicationDbContext.cs b/src/Yavsc/Models/ApplicationDbContext.cs index 2f371691..7da36095 100644 --- a/src/Yavsc/Models/ApplicationDbContext.cs +++ b/src/Yavsc/Models/ApplicationDbContext.cs @@ -123,7 +123,7 @@ namespace Yavsc.Models /// Users posts /// /// - public DbSet Blogspot { get; set; } + public DbSet BlogSpot { get; set; } /// /// Skills powered by this site diff --git a/src/Yavsc/Program.cs b/src/Yavsc/Program.cs index a084d833..d0318a55 100644 --- a/src/Yavsc/Program.cs +++ b/src/Yavsc/Program.cs @@ -15,6 +15,7 @@ namespace Yavsc .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true) .AddEnvironmentVariables() .Build(); + var app = builder.ConfigureServices().ConfigurePipeline(); app.UseSession(); app.Run(); diff --git a/src/Yavsc/Services/YavscClientStore.cs b/src/Yavsc/Services/YavscClientStore.cs index 7accd231..46576662 100644 --- a/src/Yavsc/Services/YavscClientStore.cs +++ b/src/Yavsc/Services/YavscClientStore.cs @@ -1,6 +1,6 @@ -using IdentityServer4.Models; -using IdentityServer4.Stores; +using IdentityServer8.Models; +using IdentityServer8.Stores; using Microsoft.EntityFrameworkCore; using Yavsc.Models; diff --git a/src/Yavsc/ViewComponents/BlogIndexViewComponent.cs b/src/Yavsc/ViewComponents/BlogIndexViewComponent.cs index 1ad9f12a..e38ad975 100644 --- a/src/Yavsc/ViewComponents/BlogIndexViewComponent.cs +++ b/src/Yavsc/ViewComponents/BlogIndexViewComponent.cs @@ -24,7 +24,7 @@ namespace Yavsc.ViewComponents Where(c=>c.Members.Any(m=>m.MemberId == viewerId)) .Select(c=>c.Id).ToArrayAsync(); - var allposts = _context.Blogspot + var allposts = _context.BlogSpot .Include(b => b.Author) .Include(p=>p.ACL) .Include(p=>p.Tags) diff --git a/src/Yavsc/ViewComponents/CirclesControlViewComponent.cs b/src/Yavsc/ViewComponents/CirclesControlViewComponent.cs index 4eb18add..eacca699 100644 --- a/src/Yavsc/ViewComponents/CirclesControlViewComponent.cs +++ b/src/Yavsc/ViewComponents/CirclesControlViewComponent.cs @@ -22,7 +22,7 @@ namespace Yavsc.ViewComponents { if (target!=null) { - var oid = target.GetOwnerId(); + var oid = target.OwnerId; ViewBag.ACL = dbContext.Circle.Where( c=>c.OwnerId == oid) .Select( diff --git a/src/Yavsc/Views/Blogspot/Delete.cshtml b/src/Yavsc/Views/Blogspot/Delete.cshtml index 7ebffe0b..dfbdc335 100644 --- a/src/Yavsc/Views/Blogspot/Delete.cshtml +++ b/src/Yavsc/Views/Blogspot/Delete.cshtml @@ -41,12 +41,6 @@
@Html.DisplayFor(model => model.DateCreated)
-
- @Html.DisplayNameFor(model => model.Rate) -
-
- @Html.DisplayFor(model => model.Rate) -
@Html.DisplayNameFor(model => model.Title)
diff --git a/src/Yavsc/Views/Blogspot/userposts.cshtml b/src/Yavsc/Views/Blogspot/userposts.cshtml index a73fcb98..234b1652 100644 --- a/src/Yavsc/Views/Blogspot/userposts.cshtml +++ b/src/Yavsc/Views/Blogspot/userposts.cshtml @@ -25,9 +25,6 @@ @Html.DisplayNameFor(model => model.UserModified) - - @Html.DisplayNameFor(model => model.Rate) - @Html.DisplayNameFor(model => model.Title) @@ -57,9 +54,6 @@ @Html.DisplayFor(modelItem => item.UserModified) - - @Html.DisplayFor(modelItem => item.Rate) - @Html.DisplayFor(modelItem => item.Title) diff --git a/src/Yavsc/Views/Home/AboutIdentityServer.cshtml b/src/Yavsc/Views/Home/AboutIdentityServer.cshtml index 36b2bfc3..b34a19c8 100644 --- a/src/Yavsc/Views/Home/AboutIdentityServer.cshtml +++ b/src/Yavsc/Views/Home/AboutIdentityServer.cshtml @@ -1,13 +1,13 @@ @using System.Diagnostics @{ - var version = FileVersionInfo.GetVersionInfo(typeof(IdentityServer4.Hosting.IdentityServerMiddleware).Assembly.Location).ProductVersion.Split('+').First(); + var version = FileVersionInfo.GetVersionInfo(typeof(IdentityServer8.Hosting.IdentityServerMiddleware).Assembly.Location).ProductVersion.Split('+').First(); }

- Welcome to IdentityServer4 + Welcome to IdentityServer8 (version @version)

@@ -25,8 +25,8 @@
  • Here are links to the - source code repository, - and ready to use samples. + source code repository, + and ready to use samples.
  • diff --git a/src/Yavsc/Views/Home/Index.cshtml b/src/Yavsc/Views/Home/Index.cshtml index aabfffb4..c374f367 100755 --- a/src/Yavsc/Views/Home/Index.cshtml +++ b/src/Yavsc/Views/Home/Index.cshtml @@ -117,7 +117,7 @@ Hello !!!
  • Here are links to the - source code repository, - and ready to use samples. + source code repository, + and ready to use samples.
  • diff --git a/src/Yavsc/Yavsc.csproj b/src/Yavsc/Yavsc.csproj index 698fa771..c2891a1a 100644 --- a/src/Yavsc/Yavsc.csproj +++ b/src/Yavsc/Yavsc.csproj @@ -12,24 +12,25 @@ all - - - + + + - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + + @@ -37,11 +38,10 @@ - + - diff --git a/src/Yavsc/appsettings.json b/src/Yavsc/appsettings.json index 416d75aa..eb9b890f 100644 --- a/src/Yavsc/appsettings.json +++ b/src/Yavsc/appsettings.json @@ -15,7 +15,7 @@ "Title": "Yavsc", "Slogan": "Yavsc!", "StyleSheet": "/css/default.css", - "Authority": "http://127.0.0.1:5000/", + "Authority": "https://127.0.0.1:5001/", "Owner": { "Name": "[Site owner's name]", "EMail": "[Site owner's e-mail address]" diff --git a/src/sampleWebAsWebApiClient/Controllers/AuthenticationController.cs b/src/sampleWebAsWebApiClient/Controllers/AuthenticationController.cs index 627f4be2..419642f1 100644 --- a/src/sampleWebAsWebApiClient/Controllers/AuthenticationController.cs +++ b/src/sampleWebAsWebApiClient/Controllers/AuthenticationController.cs @@ -12,13 +12,13 @@ using Microsoft.AspNetCore.Mvc; // But, this redirect URI doesn't need to match the OAuth parameter, it's serialized in the query state, // to be used once the identification ends. var properties = new AuthenticationProperties { RedirectUri = returnUrl }; - return new ChallengeResult("Bearer", properties); + return new ChallengeResult("Yavsc", properties); } + [HttpGet("~/signout")] public async Task SignOut(string returnUrl="/") { - await HttpContext.SignOutAsync("Bearer"); + await HttpContext.SignOutAsync("Yavsc"); return Redirect(returnUrl); } - } diff --git a/src/sampleWebAsWebApiClient/Controllers/HomeController.cs b/src/sampleWebAsWebApiClient/Controllers/HomeController.cs index 37cdbe2f..a645056d 100755 --- a/src/sampleWebAsWebApiClient/Controllers/HomeController.cs +++ b/src/sampleWebAsWebApiClient/Controllers/HomeController.cs @@ -36,123 +36,38 @@ namespace testOauthClient.Controllers return View(); } + public async Task CallApi() + { + var accessToken = await HttpContext.GetTokenAsync("access_token"); + + var client = new HttpClient(); + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); + var content = await client.GetStringAsync("https://localhost:5001/api/me"); + + ViewBag.Json = content; + return View("json"); + } + [HttpPost] public async Task GetUserInfo(CancellationToken cancellationToken) { + var accessToken = await HttpContext.GetTokenAsync("access_token"); + using (var client = new HttpClient()) { - var request = new HttpRequestMessage(HttpMethod.Get, "http://dev.pschneider.fr/api/me"); - request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken); + var request = new HttpRequestMessage(HttpMethod.Get, "https://localhost:5001/api/me"); + request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); var response = await client.SendAsync(request, cancellationToken); response.EnsureSuccessStatusCode(); - return View("Index", model: await response.Content.ReadAsStringAsync()); + return View("UserInfo", model: await response.Content.ReadAsStringAsync()); } } -#if FALSECODE - [HttpPost] - public async Task PostFiles(string subdir) - { - string results; - _logger.LogInformation($"{Request.Form.Files.Count} file(s) to send"); - - // TODO better uri construction in production environment - List args = new List(); - foreach (var formFile in Request.Form.Files) - { - _logger.LogWarning($"Treating {formFile.ContentDisposition}"); - MemoryStream memStream = new MemoryStream(); - const int sz = 1024 * 64; - byte[] buffer = new byte[sz]; - using (var innerStream = formFile.OpenReadStream()) - { - int szRead = 0; - do - { - szRead = innerStream.Read(buffer, 0, sz); - memStream.Write(buffer, 0, szRead); - } while (szRead > 0); - } - memStream.Seek(0, SeekOrigin.Begin); - args.Add( - new FormFile(memStream, 0, formFile.Length, formFile.Name, formFile.Name ) - { - ContentDisposition = formFile.ContentDisposition, - ContentType = formFile.ContentType - }); - } - string uri = "http://dev.pschneider.fr/api/fs/" + System.Uri.EscapeDataString(subdir); - _logger.LogInformation($"Posting data to '{uri}'..."); - - results = await RequestHelper.PostMultipart(uri, args.ToArray(), AccessToken); - _logger.LogInformation("Data posted."); - - return View("Index", model: results); - - } - - [HttpPost] - public async Task PostDeviceInfo(CancellationToken cancellationToken) - { - /* - using (var client = new HttpClient()) { - var request = new HttpRequestMessage(HttpMethod.Post, "http://dev.pschneider.fr/api/gcm/register"); - - request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken); - var json = JsonConvert. - SerializeObject(new Yavsc.Models.Identity.GoogleCloudMobileDeclaration { DeviceId= "devid01", GCMRegistrationId = "1234" } ); - var content = new StringContent(json, Encoding.UTF8, "application/json"); - var response = await client.SendAsync(request, cancellationToken); - response.EnsureSuccessStatusCode(); - - return View("Index", model: await response.Content.ReadAsStringAsync()); - }*/ - GCMRegistrationRecord result = null; - var authHeader = $"Bearer {AccessToken}"; - _logger.LogWarning($"using authorization Header {authHeader}"); - try - { - - - using (var request = new SimpleJsonPostMethod( - "http://dev.pschneider.fr/api/gcm/register", authHeader)) - { - result = await request.Invoke(new - GCMRegistrationRecord - { - GCMRegistrationId = "testGoogleRegistrationIdValue", - DeviceId = "TestDeviceId", - Model = "TestModel", - Platform = "External Web", - Version = "0.0.1-rc1" - }); - } - } - catch (Exception ex) - { - return View("Index", model: new { error = ex.Message }); - } - return View("Index", model: result?.ToString()); - } -#endif - - protected string AccessToken - { - get - { - var claim = HttpContext.User?.FindFirst("access_token"); - if (claim == null) - { - throw new InvalidOperationException("no access_token"); - } - - return claim.Value; - } - } + public IActionResult About() { ViewData["Message"] = "Your application description page."; @@ -167,18 +82,6 @@ namespace testOauthClient.Controllers return View(); } - public async Task CallApi() - { - var accessToken = await HttpContext.GetTokenAsync("access_token"); - - var client = new HttpClient(); - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); - var content = await client.GetStringAsync("https://localhost:6001/identity"); - - ViewBag.Json = JArray.Parse(content).ToString(); - return View("json"); - } - public IActionResult Logout() { return SignOut("Cookies", "oidc"); diff --git a/src/sampleWebAsWebApiClient/Startup.cs b/src/sampleWebAsWebApiClient/Startup.cs index e997d5d4..8d9a7d81 100644 --- a/src/sampleWebAsWebApiClient/Startup.cs +++ b/src/sampleWebAsWebApiClient/Startup.cs @@ -21,8 +21,8 @@ using System.IdentityModel.Tokens.Jwt; .AddOpenIdConnect("Yavsc", options => { options.Authority = "https://localhost:5001"; - - options.ClientId = "interactive"; + + options.ClientId = "mvc"; options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0"; options.ResponseType = "code"; diff --git a/src/sampleWebAsWebApiClient/Views/Home/Index.cshtml b/src/sampleWebAsWebApiClient/Views/Home/Index.cshtml index fda9951d..e5a883e7 100755 --- a/src/sampleWebAsWebApiClient/Views/Home/Index.cshtml +++ b/src/sampleWebAsWebApiClient/Views/Home/Index.cshtml @@ -2,6 +2,27 @@ @{ ViewData["Title"] = "Home Page"; } +@using Microsoft.AspNetCore.Authentication + +

    Claims

    + +
    + @foreach (var claim in User.Claims) + { +
    @claim.Type
    +
    @claim.Value
    + } +
    + +

    Properties

    + +
    + @foreach (var prop in (await Context.AuthenticateAsync()).Properties.Items) + { +
    @prop.Key
    +
    @prop.Value
    + } +
    @if (User?.Identity?.IsAuthenticated ?? false) { diff --git a/src/sampleWebAsWebApiClient/Views/Home/UserInfo.cshtml b/src/sampleWebAsWebApiClient/Views/Home/UserInfo.cshtml new file mode 100644 index 00000000..14b3845b --- /dev/null +++ b/src/sampleWebAsWebApiClient/Views/Home/UserInfo.cshtml @@ -0,0 +1,7 @@ +@model string +@{ + ViewData["Title"] = "User Info"; +} +

    @ViewData["Title"].

    + +@Model diff --git a/src/sampleWebAsWebApiClient/Views/Shared/json.cshtml b/src/sampleWebAsWebApiClient/Views/Shared/json.cshtml new file mode 100644 index 00000000..db90de65 --- /dev/null +++ b/src/sampleWebAsWebApiClient/Views/Shared/json.cshtml @@ -0,0 +1 @@ +
    @ViewBag.Json
    diff --git a/src/sampleWebAsWebApiClient/appsettings.json b/src/sampleWebAsWebApiClient/appsettings.json index adb68b50..0abe7ebb 100755 --- a/src/sampleWebAsWebApiClient/appsettings.json +++ b/src/sampleWebAsWebApiClient/appsettings.json @@ -6,18 +6,13 @@ } }, "AllowedHosts": "*", - "Authentication": { - "Yavsc" : { - "TokenEndpoint": "http://dev.pschneider.fr/connect/token", - "AuthorizationEndpoint": "http://dev.pschneider.fr/connect/authorize", - "ClientId": "interactive", - "ClientSecret": "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0" - } - }, "Kestrel": { "Endpoints": { - "http": { + "Http": { + "Url": "http://localhost:5002" + }, + "Https": { "Url": "https://localhost:5003" } } diff --git a/src/sampleWebAsWebApiClient/sampleWebAsWebApiClient.csproj b/src/sampleWebAsWebApiClient/sampleWebAsWebApiClient.csproj index 0785b0d4..0ca278ef 100644 --- a/src/sampleWebAsWebApiClient/sampleWebAsWebApiClient.csproj +++ b/src/sampleWebAsWebApiClient/sampleWebAsWebApiClient.csproj @@ -1,13 +1,19 @@ + + - + + true + PreserveNewest + net8.0 enable enable - \ No newline at end of file + +