Initial commit - Auth
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Threading.Tasks;
|
||||
// using Bogus;
|
||||
// using Domain.Entities;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class BundleConfiguration : IEntityTypeConfiguration<Bundle>
|
||||
// {
|
||||
// // private readonly int count;
|
||||
|
||||
// public List<Bundle> Bundles { get; set; }
|
||||
|
||||
// public BundleConfiguration(int count)
|
||||
// {
|
||||
// // this.count = count;
|
||||
// Bundles = GenerateBundles(count);
|
||||
// }
|
||||
|
||||
// private List<Bundle> GenerateBundles(int count)
|
||||
// {
|
||||
// var fakerCategory = new Faker<Bundle>()
|
||||
// .RuleFor(p => p.Id, f => Guid.NewGuid())
|
||||
// .RuleFor(p => p.Name, f => f.Commerce.ProductName())
|
||||
// .RuleFor(p => p.Description, f => f.Commerce.ProductDescription())
|
||||
// .RuleFor(p => p.Photo, f => f.Image.LoremFlickrUrl(640, 480, "bundle"))
|
||||
// .RuleFor(p => p.Language, f => "test")
|
||||
// .RuleFor(p => p.CategoryId, f => f.Random.Number(1, 30));
|
||||
|
||||
// return fakerCategory.Generate(count);
|
||||
// }
|
||||
|
||||
// public void Configure(EntityTypeBuilder<Bundle> builder)
|
||||
// {
|
||||
// ////builder.HasIndex(category => category.Name).IsUnique();
|
||||
// //builder.Property(c => c.Name).HasMaxLength(450);
|
||||
// builder.HasData(Bundles);
|
||||
// }
|
||||
// }
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// using Bogus;
|
||||
// using Domain.Entities;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class CategoryConfiguration : IEntityTypeConfiguration<Category>
|
||||
// {
|
||||
// private readonly int count;
|
||||
|
||||
// public List<Category> Categories { get; set; }
|
||||
|
||||
// public CategoryConfiguration(int count)
|
||||
// {
|
||||
// this.count = count;
|
||||
// Categories = GenerateCategories(count);
|
||||
// }
|
||||
|
||||
// private List<Category> GenerateCategories(int count)
|
||||
// {
|
||||
|
||||
// var id = 1;
|
||||
// var fakerCategory = new Faker<Category>()
|
||||
// .RuleFor(p => p.Id, f => id++)
|
||||
// .RuleFor(p => p.Name, f => f.Commerce.ProductName())
|
||||
// .RuleFor(p => p.Show, f => true)
|
||||
// .RuleFor(p => p.Description, f => f.Commerce.ProductDescription())
|
||||
// .RuleFor(p => p.Created, f => f.Date.Past(1, DateTime.UtcNow))
|
||||
// .RuleFor(p => p.Language, f => "test")
|
||||
|
||||
// .RuleFor(p => p.PhotoPath, f => f.Image.LoremFlickrUrl(512, 512, "Category Categories"));
|
||||
|
||||
// return fakerCategory.Generate(count);
|
||||
// }
|
||||
|
||||
|
||||
// public void Configure(EntityTypeBuilder<Category> builder)
|
||||
// {
|
||||
// ////builder.HasIndex(category => category.Name).IsUnique();
|
||||
// //builder.Property(c => c.Name).HasMaxLength(450);
|
||||
// builder.HasData(Categories);
|
||||
// }
|
||||
// }
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// using Bogus;
|
||||
// using Domain.Entities;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class ProductConfiguration : IEntityTypeConfiguration<Product>
|
||||
// {
|
||||
// private readonly int count;
|
||||
// private readonly int categoryCount;
|
||||
|
||||
// public ProductConfiguration(int count, int categoryCount)
|
||||
// {
|
||||
// this.count = count;
|
||||
// this.categoryCount = categoryCount;
|
||||
// }
|
||||
|
||||
// private List<Product> GenerateProducts()
|
||||
// {
|
||||
// var i = 1;
|
||||
// var fakerProduct = new Faker<Product>()
|
||||
// .RuleFor(p => p.Id, f => Guid.NewGuid())
|
||||
// .RuleFor(p => p.Name, f => f.Commerce.ProductName())
|
||||
// // .RuleFor(p => p.Price, f => f.Random.Number(1, 1000))
|
||||
// // .RuleFor(p => p.ItemsSold, f => f.Random.Number(2, 5))
|
||||
// .RuleFor(p => p.Language, f => "test")
|
||||
|
||||
// // .RuleFor(p => p.PiecesLeft, f => f.Random.Number(2, 5))
|
||||
// .RuleFor(p => p.CategoryName, f => "Fishing Rods")
|
||||
// .RuleFor(p => p.CategoryId, f => f.Random.Number(1, categoryCount))
|
||||
// .RuleFor(p => p.Description, f => f.Commerce.ProductDescription())
|
||||
// .RuleFor(p => p.Created, f => f.Date.Past(1, DateTime.UtcNow))
|
||||
// .RuleFor(p => p.PhotoPath, f => f.Image.LoremFlickrUrl(512, 512, "Product"));
|
||||
|
||||
// return fakerProduct.Generate(count);
|
||||
// }
|
||||
|
||||
// public void Configure(EntityTypeBuilder<Product> builder)
|
||||
// {
|
||||
// builder.HasData(GenerateProducts());
|
||||
// // builder.HasIndex(u => u.Name).IsUnique();
|
||||
// }
|
||||
// }
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// using Contracts;
|
||||
// using Microsoft.AspNetCore.Identity;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class RoleConfiguration : IEntityTypeConfiguration<IdentityRole>
|
||||
// {
|
||||
// private List<IdentityRole> CreateRoles()
|
||||
// {
|
||||
// var roleList = new List<IdentityRole>();
|
||||
// // foreach (var role in Enum.GetValues(typeof(AppEnum.Roles)))
|
||||
// // {
|
||||
// // var newRole = new IdentityRole()
|
||||
// // {
|
||||
// // Id = Guid.NewGuid().ToString(),
|
||||
// // Name = role.ToString(),
|
||||
// // NormalizedName = role.ToString().ToUpper(),
|
||||
// // ConcurrencyStamp = Guid.NewGuid().ToString()
|
||||
// // };
|
||||
// // roleList.Add(newRole);
|
||||
// // }
|
||||
|
||||
// return roleList;
|
||||
// }
|
||||
|
||||
|
||||
// public void Configure(EntityTypeBuilder<IdentityRole> builder)
|
||||
// {
|
||||
// builder.HasData(CreateRoles());
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,31 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Threading.Tasks;
|
||||
// using Domain.Entities;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class ShippingConfiguration : IEntityTypeConfiguration<Shipping>
|
||||
// {
|
||||
// private List<Shipping> Generate()
|
||||
// {
|
||||
// return new List<Shipping>()
|
||||
// {
|
||||
// new Shipping() {Id = 1, ShippingCost = 10, Name ="Standard Shipping - $10"},
|
||||
// new Shipping() {Id = 2, ShippingCost = 50, Name ="Fast Shipping - $50"},
|
||||
|
||||
// };
|
||||
|
||||
// }
|
||||
|
||||
// public void Configure(EntityTypeBuilder<Shipping> builder)
|
||||
// {
|
||||
// builder.HasData(Generate());
|
||||
// // builder.HasIndex(u => u.Name).IsUnique();
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// using Bogus;
|
||||
// using Domain.Entities;
|
||||
// using Microsoft.AspNetCore.Identity;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class UserConfiguration : IEntityTypeConfiguration<AppUser>
|
||||
// {
|
||||
// private readonly PasswordHasher<AppUser> _Hasher = new PasswordHasher<AppUser>();
|
||||
// private readonly int count;
|
||||
|
||||
// public UserConfiguration(int count)
|
||||
// {
|
||||
// this.count = count;
|
||||
|
||||
// }
|
||||
|
||||
// private List<AppUser> GenerateUsers()
|
||||
// {
|
||||
// var fakerUser = new Faker<AppUser>()
|
||||
// .RuleFor(u => u.Name, f => f.Name.FullName(f.Person.Gender))
|
||||
// .RuleFor(u => u.Email, (f, u) => f.Internet.Email(u.Name))
|
||||
// .RuleFor(u => u.EmailConfirmed, true)
|
||||
// .RuleFor(u => u.Building, f => f.Address.BuildingNumber())
|
||||
// .RuleFor(u => u.Floor, f => f.Random.Number(1, 3))
|
||||
// .RuleFor(u => u.Flat, f => f.Random.Number(3, 10))
|
||||
// .RuleFor(u => u.PhotoPath, f => f.Person.Avatar)
|
||||
// .RuleFor(u => u.PasswordHash, (f, u) => _Hasher.HashPassword(u, "aaa111!!!AAA"))
|
||||
// .RuleFor(u => u.PhoneNumber, f => f.Phone.PhoneNumber())
|
||||
// .RuleFor(u => u.locationLati, f => f.Random.Number(300))
|
||||
// .RuleFor(u => u.locationLong, f => f.Random.Number(300));
|
||||
|
||||
// return fakerUser.Generate(count);
|
||||
// }
|
||||
|
||||
// public void Configure(EntityTypeBuilder<AppUser> builder)
|
||||
// {
|
||||
// var adminUser = new AppUser()
|
||||
// {
|
||||
// Id = Guid.NewGuid().ToString(),
|
||||
// Name = "said",
|
||||
// Email = "said.amir.kattan@outlook.com",
|
||||
// UserName = "said.amir.kattan@outlook.com",
|
||||
// NormalizedEmail = "said.amir.kattan@outlook.com".ToUpper(),
|
||||
// NormalizedUserName = "said.amir.kattan@outlook.com".ToUpper(),
|
||||
// PhoneNumber = "01231231322",
|
||||
// EmailConfirmed = true,
|
||||
// PasswordHash = _Hasher.HashPassword(null, "aaa111!!!AAA")
|
||||
// };
|
||||
|
||||
// builder.HasData(GenerateUsers(), adminUser);
|
||||
// }
|
||||
// }
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// using Microsoft.AspNetCore.Identity;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
// namespace Auth.Domain.Configuration;
|
||||
|
||||
// public class UserRoleConfiguration : IEntityTypeConfiguration<IdentityUserRole<string>>
|
||||
// {
|
||||
|
||||
|
||||
// public void Configure(EntityTypeBuilder<IdentityUserRole<string>> builder)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user