mirror of https://github.com/abpframework/abp.git
60 changed files with 1701 additions and 734 deletions
@ -1,465 +0,0 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using VoloDocs.EntityFrameworkCore; |
|||
|
|||
namespace VoloDocs.EntityFrameworkCore.Migrations |
|||
{ |
|||
[DbContext(typeof(VoloDocsDbContext))] |
|||
[Migration("20181225134002_Initial20181225")] |
|||
partial class Initial20181225 |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128) |
|||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Regex") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("RegexDescription") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<bool>("Required"); |
|||
|
|||
b.Property<int>("ValueType"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AbpClaimTypes"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDefault") |
|||
.HasColumnName("IsDefault"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnName("IsPublic"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnName("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedName") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("NormalizedName"); |
|||
|
|||
b.ToTable("AbpRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleId"); |
|||
|
|||
b.ToTable("AbpRoleClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("AccessFailedCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("AccessFailedCount") |
|||
.HasDefaultValue(0); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Email") |
|||
.HasColumnName("Email") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<bool>("EmailConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("EmailConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<bool>("LockoutEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("LockoutEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTimeOffset?>("LockoutEnd"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasColumnName("Name") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("NormalizedEmail") |
|||
.HasColumnName("NormalizedEmail") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedUserName") |
|||
.IsRequired() |
|||
.HasColumnName("NormalizedUserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PasswordHash") |
|||
.HasColumnName("PasswordHash") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PhoneNumber") |
|||
.HasColumnName("PhoneNumber") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<bool>("PhoneNumberConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("PhoneNumberConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("SecurityStamp") |
|||
.IsRequired() |
|||
.HasColumnName("SecurityStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Surname") |
|||
.HasColumnName("Surname") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<bool>("TwoFactorEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("TwoFactorEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasColumnName("UserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Email"); |
|||
|
|||
b.HasIndex("NormalizedEmail"); |
|||
|
|||
b.HasIndex("NormalizedUserName"); |
|||
|
|||
b.HasIndex("UserName"); |
|||
|
|||
b.ToTable("AbpUsers"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId"); |
|||
|
|||
b.ToTable("AbpUserClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderDisplayName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(196); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider"); |
|||
|
|||
b.HasIndex("LoginProvider", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpUserLogins"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "RoleId"); |
|||
|
|||
b.HasIndex("RoleId", "UserId"); |
|||
|
|||
b.ToTable("AbpUserRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<string>("Value"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider", "Name"); |
|||
|
|||
b.ToTable("AbpUserTokens"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpPermissionGrants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasMaxLength(2048); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Docs.Projects.Project", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("DefaultDocumentName") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("DocumentStoreType"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Format"); |
|||
|
|||
b.Property<string>("LatestVersionBranchName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("MainWebsiteUrl"); |
|||
|
|||
b.Property<string>("MinimumVersion"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("NavigationDocumentName") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ShortName") |
|||
.IsRequired() |
|||
.HasMaxLength(32); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("DocsProjects"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Logins") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany() |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
|
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Roles") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Tokens") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,670 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using VoloDocs.EntityFrameworkCore; |
|||
|
|||
namespace VoloDocs.EntityFrameworkCore.Migrations |
|||
{ |
|||
[DbContext(typeof(VoloDocsDbContext))] |
|||
[Migration("20200212135141_init")] |
|||
partial class init |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "3.1.1") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128) |
|||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("bit"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Regex") |
|||
.HasColumnType("nvarchar(512)") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("RegexDescription") |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<bool>("Required") |
|||
.HasColumnType("bit"); |
|||
|
|||
b.Property<int>("ValueType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AbpClaimTypes"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<bool>("IsDefault") |
|||
.HasColumnName("IsDefault") |
|||
.HasColumnType("bit"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnName("IsPublic") |
|||
.HasColumnType("bit"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnName("IsStatic") |
|||
.HasColumnType("bit"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("NormalizedName"); |
|||
|
|||
b.ToTable("AbpRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasColumnType("nvarchar(1024)") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid>("RoleId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleId"); |
|||
|
|||
b.ToTable("AbpRoleClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<int>("AccessFailedCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("AccessFailedCount") |
|||
.HasColumnType("int") |
|||
.HasDefaultValue(0); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime") |
|||
.HasColumnType("datetime2"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime") |
|||
.HasColumnType("datetime2"); |
|||
|
|||
b.Property<string>("Email") |
|||
.IsRequired() |
|||
.HasColumnName("Email") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<bool>("EmailConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("EmailConfirmed") |
|||
.HasColumnType("bit") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasColumnType("bit") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime") |
|||
.HasColumnType("datetime2"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<bool>("LockoutEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("LockoutEnabled") |
|||
.HasColumnType("bit") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTimeOffset?>("LockoutEnd") |
|||
.HasColumnType("datetimeoffset"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasColumnName("Name") |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("NormalizedEmail") |
|||
.IsRequired() |
|||
.HasColumnName("NormalizedEmail") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedUserName") |
|||
.IsRequired() |
|||
.HasColumnName("NormalizedUserName") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PasswordHash") |
|||
.HasColumnName("PasswordHash") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PhoneNumber") |
|||
.HasColumnName("PhoneNumber") |
|||
.HasColumnType("nvarchar(16)") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<bool>("PhoneNumberConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("PhoneNumberConfirmed") |
|||
.HasColumnType("bit") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("SecurityStamp") |
|||
.IsRequired() |
|||
.HasColumnName("SecurityStamp") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Surname") |
|||
.HasColumnName("Surname") |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<bool>("TwoFactorEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("TwoFactorEnabled") |
|||
.HasColumnType("bit") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasColumnName("UserName") |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Email"); |
|||
|
|||
b.HasIndex("NormalizedEmail"); |
|||
|
|||
b.HasIndex("NormalizedUserName"); |
|||
|
|||
b.HasIndex("UserName"); |
|||
|
|||
b.ToTable("AbpUsers"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(256)") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasColumnType("nvarchar(1024)") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId"); |
|||
|
|||
b.ToTable("AbpUserClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderDisplayName") |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(196)") |
|||
.HasMaxLength(196); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider"); |
|||
|
|||
b.HasIndex("LoginProvider", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpUserLogins"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<Guid>("RoleId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.HasKey("UserId", "RoleId"); |
|||
|
|||
b.HasIndex("RoleId", "UserId"); |
|||
|
|||
b.ToTable("AbpUserRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("Value") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider", "Name"); |
|||
|
|||
b.ToTable("AbpUserTokens"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpPermissionGrants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.HasColumnType("nvarchar(64)") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(2048)") |
|||
.HasMaxLength(2048); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Docs.Documents.Document", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("EditLink") |
|||
.HasColumnType("nvarchar(2048)") |
|||
.HasMaxLength(2048); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("FileName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("Format") |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("LanguageCode") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<DateTime>("LastCachedTime") |
|||
.HasColumnType("datetime2"); |
|||
|
|||
b.Property<DateTime>("LastUpdatedTime") |
|||
.HasColumnType("datetime2"); |
|||
|
|||
b.Property<string>("LocalDirectory") |
|||
.HasColumnType("nvarchar(512)") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(255)") |
|||
.HasMaxLength(255); |
|||
|
|||
b.Property<Guid>("ProjectId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("RawRootUrl") |
|||
.HasColumnType("nvarchar(2048)") |
|||
.HasMaxLength(2048); |
|||
|
|||
b.Property<string>("RootUrl") |
|||
.HasColumnType("nvarchar(2048)") |
|||
.HasMaxLength(2048); |
|||
|
|||
b.Property<int>("UpdatedCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("DocsDocuments"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Docs.Documents.DocumentContributor", b => |
|||
{ |
|||
b.Property<Guid>("DocumentId") |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("Username") |
|||
.HasColumnType("nvarchar(450)"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("UserProfileUrl") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.HasKey("DocumentId", "Username"); |
|||
|
|||
b.ToTable("DocsDocumentContributors"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Docs.Projects.Project", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("uniqueidentifier"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("DefaultDocumentName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("DocumentStoreType") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("Format") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("LatestVersionBranchName") |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("MainWebsiteUrl") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("MinimumVersion") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("NavigationDocumentName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ParametersDocumentName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(128)") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ShortName") |
|||
.IsRequired() |
|||
.HasColumnType("nvarchar(32)") |
|||
.HasMaxLength(32); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("DocsProjects"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole", null) |
|||
.WithMany("Claims") |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser", null) |
|||
.WithMany("Claims") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser", null) |
|||
.WithMany("Logins") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole", null) |
|||
.WithMany() |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.HasOne("Volo.Abp.Identity.IdentityUser", null) |
|||
.WithMany("Roles") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser", null) |
|||
.WithMany("Tokens") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Docs.Documents.DocumentContributor", b => |
|||
{ |
|||
b.HasOne("Volo.Docs.Documents.Document", null) |
|||
.WithMany("Contributors") |
|||
.HasForeignKey("DocumentId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace Volo.Docs.Admin.Documents |
|||
{ |
|||
public interface IDocumentAdminAppService : IApplicationService |
|||
{ |
|||
Task PullAllAsync(PullAllDocumentInput input); |
|||
|
|||
Task PullAsync(PullDocumentInput input); |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Docs.Documents; |
|||
|
|||
namespace Volo.Docs.Admin.Documents |
|||
{ |
|||
public class PullAllDocumentInput |
|||
{ |
|||
public Guid ProjectId { get; set; } |
|||
|
|||
[StringLength(DocumentConsts.MaxLanguageCodeNameLength)] |
|||
public string LanguageCode { get; set; } |
|||
|
|||
[StringLength(DocumentConsts.MaxVersionNameLength)] |
|||
public string Version { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Docs.Documents; |
|||
|
|||
namespace Volo.Docs.Admin.Documents |
|||
{ |
|||
public class PullDocumentInput |
|||
{ |
|||
public Guid ProjectId { get; set; } |
|||
|
|||
[StringLength(DocumentConsts.MaxNameLength)] |
|||
public string Name { get; set; } |
|||
|
|||
[StringLength(DocumentConsts.MaxLanguageCodeNameLength)] |
|||
public string LanguageCode { get; set; } |
|||
|
|||
[StringLength(DocumentConsts.MaxVersionNameLength)] |
|||
public string Version { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,99 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Newtonsoft.Json; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Docs.Documents; |
|||
using Volo.Docs.Projects; |
|||
|
|||
namespace Volo.Docs.Admin.Documents |
|||
{ |
|||
[Authorize(DocsAdminPermissions.Documents.Default)] |
|||
public class DocumentAdminAppService : ApplicationService, IDocumentAdminAppService |
|||
{ |
|||
private readonly IProjectRepository _projectRepository; |
|||
private readonly IDocumentRepository _documentRepository; |
|||
private readonly IDocumentSourceFactory _documentStoreFactory; |
|||
|
|||
public DocumentAdminAppService(IProjectRepository projectRepository, |
|||
IDocumentRepository documentRepository, |
|||
IDocumentSourceFactory documentStoreFactory) |
|||
{ |
|||
_projectRepository = projectRepository; |
|||
_documentRepository = documentRepository; |
|||
_documentStoreFactory = documentStoreFactory; |
|||
} |
|||
|
|||
public async Task PullAllAsync(PullAllDocumentInput input) |
|||
{ |
|||
var project = await _projectRepository.GetAsync(input.ProjectId); |
|||
|
|||
var navigationFile = await GetDocumentAsync( |
|||
project, |
|||
project.NavigationDocumentName, |
|||
input.LanguageCode, |
|||
input.Version |
|||
); |
|||
|
|||
var nav = JsonConvert.DeserializeObject<NavigationNode>(navigationFile.Content); |
|||
var leafs = nav.Items.GetAllNodes(x => x.Items) |
|||
.Where(x => x.IsLeaf && !x.Path.IsNullOrWhiteSpace()) |
|||
.ToList(); |
|||
|
|||
var source = _documentStoreFactory.Create(project.DocumentStoreType); |
|||
|
|||
var documents = new List<Document>(); |
|||
foreach (var leaf in leafs) |
|||
{ |
|||
var sourceDocument = |
|||
await source.GetDocumentAsync(project, leaf.Path, input.LanguageCode, input.Version); |
|||
documents.Add(sourceDocument); |
|||
} |
|||
|
|||
foreach (var document in documents) |
|||
{ |
|||
var oldDocument = await _documentRepository.FindAsync(document.ProjectId, document.Name, |
|||
document.LanguageCode, |
|||
document.Version); |
|||
|
|||
if (oldDocument != null) |
|||
{ |
|||
await _documentRepository.DeleteAsync(oldDocument); |
|||
} |
|||
|
|||
await _documentRepository.InsertAsync(document); |
|||
} |
|||
} |
|||
|
|||
public async Task PullAsync(PullDocumentInput input) |
|||
{ |
|||
var project = await _projectRepository.GetAsync(input.ProjectId); |
|||
|
|||
var source = _documentStoreFactory.Create(project.DocumentStoreType); |
|||
var sourceDocument = await source.GetDocumentAsync(project, input.Name, input.LanguageCode, input.Version); |
|||
|
|||
var oldDocument = await _documentRepository.FindAsync(sourceDocument.ProjectId, sourceDocument.Name, |
|||
sourceDocument.LanguageCode, sourceDocument.Version); |
|||
|
|||
if (oldDocument != null) |
|||
{ |
|||
await _documentRepository.DeleteAsync(oldDocument); |
|||
} |
|||
|
|||
await _documentRepository.InsertAsync(sourceDocument); |
|||
} |
|||
|
|||
private async Task<Document> GetDocumentAsync( |
|||
Project project, |
|||
string documentName, |
|||
string languageCode, |
|||
string version) |
|||
{ |
|||
version = string.IsNullOrWhiteSpace(version) ? project.LatestVersionBranchName : version; |
|||
var source = _documentStoreFactory.Create(project.DocumentStoreType); |
|||
return await source.GetDocumentAsync(project, documentName, languageCode, version); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Docs.Admin.Documents; |
|||
|
|||
namespace Volo.Docs.Admin |
|||
{ |
|||
[RemoteService] |
|||
[Area("docs")] |
|||
[ControllerName("DocumentsAdmin")] |
|||
[Route("api/docs/admin/documents")] |
|||
public class DocumentsAdminController : AbpController, IDocumentAdminAppService |
|||
{ |
|||
private readonly IDocumentAdminAppService _documentAdminAppService; |
|||
|
|||
public DocumentsAdminController(IDocumentAdminAppService documentAdminAppService) |
|||
{ |
|||
_documentAdminAppService = documentAdminAppService; |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("PullAll")] |
|||
public Task PullAllAsync(PullAllDocumentInput input) |
|||
{ |
|||
return _documentAdminAppService.PullAllAsync(input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("Pull")] |
|||
public Task PullAsync(PullDocumentInput input) |
|||
{ |
|||
return _documentAdminAppService.PullAsync(input); |
|||
} |
|||
} |
|||
} |
|||
@ -1,27 +1,109 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class Document |
|||
public class Document : AggregateRoot<Guid> |
|||
{ |
|||
public string Title { get; set; } |
|||
public virtual Guid ProjectId { get; protected set; } |
|||
|
|||
public string Content { get; set; } |
|||
public virtual string Name { get; protected set; } |
|||
|
|||
public string Format { get; set; } |
|||
public virtual string Version { get; protected set; } |
|||
|
|||
public string EditLink { get; set; } |
|||
public virtual string LanguageCode { get; protected set; } |
|||
|
|||
public string RootUrl { get; set; } |
|||
public virtual string FileName { get; set; } |
|||
|
|||
public string RawRootUrl { get; set; } |
|||
public virtual string Content { get; set; } |
|||
|
|||
public string Version { get; set; } |
|||
public virtual string Format { get; set; } |
|||
|
|||
public string LocalDirectory { get; set; } |
|||
public virtual string EditLink { get; set; } |
|||
|
|||
public string FileName { get; set; } |
|||
public virtual string RootUrl { get; set; } |
|||
|
|||
public List<DocumentContributor> Contributors { get; set; } |
|||
public virtual string RawRootUrl { get; set; } |
|||
|
|||
public virtual string LocalDirectory { get; set; } |
|||
|
|||
public virtual DateTime LastUpdatedTime { get; set; } |
|||
|
|||
public virtual int UpdatedCount { get; set; } |
|||
|
|||
public virtual DateTime LastCachedTime { get; set; } |
|||
|
|||
public virtual List<DocumentContributor> Contributors { get; set; } |
|||
|
|||
protected Document() |
|||
{ |
|||
Contributors = new List<DocumentContributor>(); |
|||
ExtraProperties = new Dictionary<string, object>(); |
|||
} |
|||
|
|||
public Document( |
|||
Guid id, |
|||
Guid projectId, |
|||
[NotNull] string name, |
|||
[NotNull] string version, |
|||
[NotNull] string languageCode, |
|||
[NotNull] string fileName, |
|||
[NotNull] string content, |
|||
[NotNull] string format, |
|||
[NotNull] string editLink, |
|||
[NotNull] string rootUrl, |
|||
[NotNull] string rawRootUrl, |
|||
[NotNull] string localDirectory, |
|||
DateTime lastUpdatedTime, |
|||
int updatedCount, |
|||
DateTime lastCachedTime |
|||
) |
|||
{ |
|||
Id = id; |
|||
ProjectId = projectId; |
|||
|
|||
Name = Check.NotNullOrWhiteSpace(name, nameof(name)); |
|||
Version = Check.NotNullOrWhiteSpace(version, nameof(version)); |
|||
LanguageCode = Check.NotNullOrWhiteSpace(languageCode, nameof(languageCode)); |
|||
FileName = Check.NotNullOrWhiteSpace(fileName, nameof(fileName)); |
|||
Content = Check.NotNullOrWhiteSpace(content, nameof(content)); |
|||
Format = Check.NotNullOrWhiteSpace(format, nameof(format)); |
|||
EditLink = Check.NotNullOrWhiteSpace(editLink, nameof(editLink)); |
|||
RootUrl = Check.NotNullOrWhiteSpace(rootUrl, nameof(rootUrl)); |
|||
RawRootUrl = Check.NotNullOrWhiteSpace(rawRootUrl, nameof(rawRootUrl)); |
|||
LocalDirectory = Check.NotNull(localDirectory, nameof(localDirectory)); |
|||
LastUpdatedTime = lastUpdatedTime; |
|||
UpdatedCount = updatedCount; |
|||
LastCachedTime = lastCachedTime; |
|||
|
|||
Contributors = new List<DocumentContributor>(); |
|||
ExtraProperties = new Dictionary<string, object>(); |
|||
} |
|||
|
|||
public virtual void AddContributor(string username, string userProfileUrl, string avatarUrl) |
|||
{ |
|||
Contributors.AddIfNotContains(new DocumentContributor(Id, username, userProfileUrl, avatarUrl)); |
|||
} |
|||
|
|||
public virtual void RemoveAllContributors() |
|||
{ |
|||
Contributors.Clear(); |
|||
} |
|||
|
|||
public virtual void RemoveContributor(string username, string userProfileUrl, string avatarUrl) |
|||
{ |
|||
Contributors.RemoveAll(r => |
|||
r.Username == username && r.UserProfileUrl == userProfileUrl && r.AvatarUrl == avatarUrl); |
|||
} |
|||
|
|||
public virtual DocumentContributor FindContributor(string username, string userProfileUrl, string avatarUrl) |
|||
{ |
|||
return Contributors.FirstOrDefault(r => |
|||
r.Username == username && r.UserProfileUrl == userProfileUrl && r.AvatarUrl == avatarUrl); |
|||
} |
|||
} |
|||
} |
|||
@ -1,15 +1,39 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class DocumentContributor |
|||
public class DocumentContributor : Entity |
|||
{ |
|||
public Guid DocumentId { get; set; } |
|||
|
|||
public string Username { get; set; } |
|||
|
|||
public string UserProfileUrl { get; set; } |
|||
|
|||
public string AvatarUrl { get; set; } |
|||
|
|||
protected DocumentContributor() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual bool Equals(Guid documentId, string username) |
|||
{ |
|||
return DocumentId == documentId && Username == username; |
|||
} |
|||
|
|||
public DocumentContributor(Guid documentId, string username, string userProfileUrl, string avatarUrl) |
|||
{ |
|||
DocumentId = documentId; |
|||
Username = username; |
|||
UserProfileUrl = userProfileUrl; |
|||
AvatarUrl = avatarUrl; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { DocumentId, Username }; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class DocumentSourceOptions |
|||
{ |
|||
public Dictionary<string, Type> Sources { get; set; } |
|||
|
|||
public DocumentSourceOptions() |
|||
{ |
|||
Sources = new Dictionary<string, Type>(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,15 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class DocumentStoreOptions |
|||
{ |
|||
public Dictionary<string, Type> Stores { get; set; } |
|||
|
|||
public DocumentStoreOptions() |
|||
{ |
|||
Stores = new Dictionary<string, Type>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public interface IDocumentRepository : IBasicRepository<Document> |
|||
{ |
|||
Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version); |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public interface IDocumentSourceFactory |
|||
{ |
|||
IDocumentSource Create(string sourceType); |
|||
} |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public interface IDocumentStoreFactory |
|||
{ |
|||
IDocumentStore Create(string storeType); |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Docs.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class EFCoreDocumentRepository : EfCoreRepository<IDocsDbContext, Document>, IDocumentRepository |
|||
{ |
|||
public EFCoreDocumentRepository(IDbContextProvider<IDocsDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version) |
|||
{ |
|||
return await DbSet.FirstOrDefaultAsync(x => |
|||
x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && x.Version == version); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using MongoDB.Driver.Linq; |
|||
using Volo.Abp.Domain.Repositories.MongoDB; |
|||
using Volo.Abp.MongoDB; |
|||
using Volo.Docs.MongoDB; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class MongoDocumentRepository : MongoDbRepository<IDocsMongoDbContext, Document, Guid>, IDocumentRepository |
|||
{ |
|||
public MongoDocumentRepository(IMongoDbContextProvider<IDocsMongoDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version) |
|||
{ |
|||
return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ProjectId == projectId && |
|||
x.Name == name && |
|||
x.LanguageCode == languageCode && |
|||
x.Version == version); |
|||
} |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using System; |
|||
using Newtonsoft.Json; |
|||
|
|||
namespace Volo.Docs.Documents |
|||
{ |
|||
public class NavigationWithDetailsDto : DocumentWithDetailsDto |
|||
{ |
|||
[JsonProperty("items")] |
|||
public NavigationNode RootNode { get; set; } |
|||
|
|||
public void ConvertItems() |
|||
{ |
|||
if (Content.IsNullOrEmpty()) |
|||
{ |
|||
RootNode = new NavigationNode(); |
|||
return; |
|||
} |
|||
|
|||
try |
|||
{ |
|||
RootNode = JsonConvert.DeserializeObject<NavigationNode>(Content); |
|||
} |
|||
catch (JsonException ex) |
|||
{ |
|||
//todo: should log the exception?
|
|||
RootNode = new NavigationNode(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue