22 changed files with 633 additions and 64 deletions
@ -1,7 +1,13 @@ |
|||
namespace LINGYUN.Platform.Versions |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Platform.Versions |
|||
{ |
|||
public class VersionDeleteDto |
|||
{ |
|||
[Required] |
|||
[StringLength(AppVersionConsts.MaxVersionLength)] |
|||
public string Version { get; set; } |
|||
|
|||
public PlatformType PlatformType { get; set; } |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,15 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Platform.Versions |
|||
{ |
|||
public class VersionFileDeleteDto |
|||
{ |
|||
[Required] |
|||
public Guid VersionId { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(VersionFileConsts.MaxNameLength)] |
|||
public string FileName { get; set; } |
|||
} |
|||
} |
|||
|
|||
@ -1,11 +1,24 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Platform.Versions |
|||
{ |
|||
public class VersionFileGetDto |
|||
{ |
|||
public PlatformType PlatformType { get; set; } = PlatformType.None; |
|||
|
|||
[Required] |
|||
[StringLength(AppVersionConsts.MaxVersionLength)] |
|||
public string Version { get; set; } |
|||
|
|||
[StringLength(VersionFileConsts.MaxPathLength)] |
|||
public string FilePath { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(VersionFileConsts.MaxNameLength)] |
|||
public string FileName { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(VersionFileConsts.MaxVersionLength)] |
|||
public string FileVersion { get; set; } |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,17 @@ |
|||
using System.Security.Cryptography; |
|||
using System.Text; |
|||
|
|||
namespace System |
|||
{ |
|||
public static class StringExtensions |
|||
{ |
|||
public static string GetHash(this string str) |
|||
{ |
|||
using (var sha = new SHA1Managed()) |
|||
{ |
|||
var hashBytes = sha.ComputeHash(Encoding.UTF8.GetBytes(str)); |
|||
return BitConverter.ToString(hashBytes).Replace("-", string.Empty); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,406 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LINGYUN.Platform.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.Migrations |
|||
{ |
|||
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] |
|||
[Migration("20200724092022_Add-Version-File-Field-Path-And-Platform-Type")] |
|||
partial class AddVersionFileFieldPathAndPlatformType |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("ProductVersion", "3.1.5") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Routes.RoleRoute", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("RoleName") |
|||
.IsRequired() |
|||
.HasColumnName("RoleName") |
|||
.HasColumnType("varchar(256) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid>("RouteId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleName", "RouteId"); |
|||
|
|||
b.ToTable("AppPlatformRoleRoute"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AlwaysShow") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasColumnName("Code") |
|||
.HasColumnType("varchar(95) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(95); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("varchar(40) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(40); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnName("Description") |
|||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(255); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasColumnName("DisplayName") |
|||
.HasColumnType("varchar(128) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("longtext CHARACTER SET utf8mb4"); |
|||
|
|||
b.Property<string>("FullName") |
|||
.HasColumnName("FullName") |
|||
.HasColumnType("varchar(128) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("Icon") |
|||
.HasColumnName("Icon") |
|||
.HasColumnType("varchar(128) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<bool>("IsMenu") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsSideBar") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsToolBar") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("LinkUrl") |
|||
.IsRequired() |
|||
.HasColumnName("LinkUrl") |
|||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(255); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnName("Name") |
|||
.HasColumnType("varchar(64) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<int>("PlatformType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Code"); |
|||
|
|||
b.HasIndex("ParentId"); |
|||
|
|||
b.ToTable("AppPlatformRoute"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Routes.UserRoute", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid>("RouteId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "RouteId"); |
|||
|
|||
b.ToTable("AppPlatformUserRoute"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasColumnType("varchar(40) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(40); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnName("Description") |
|||
.HasColumnType("longtext CHARACTER SET utf8mb4") |
|||
.HasMaxLength(2048); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties") |
|||
.HasColumnType("longtext CHARACTER SET utf8mb4"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<int>("Level") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("PlatformType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Title") |
|||
.IsRequired() |
|||
.HasColumnName("Title") |
|||
.HasColumnType("varchar(50) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(50); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasColumnName("Version") |
|||
.HasColumnType("varchar(20) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(20); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Version"); |
|||
|
|||
b.ToTable("AppPlatformVersion"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid>("AppVersionId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<int>("DownloadCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("FileType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnName("Name") |
|||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(255); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasColumnName("Path") |
|||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(255); |
|||
|
|||
b.Property<string>("SHA256") |
|||
.IsRequired() |
|||
.HasColumnName("SHA256") |
|||
.HasColumnType("varchar(65) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(65); |
|||
|
|||
b.Property<long>("Size") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasColumnName("Version") |
|||
.HasColumnType("varchar(20) CHARACTER SET utf8mb4") |
|||
.HasMaxLength(20); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("AppVersionId"); |
|||
|
|||
b.HasIndex("Path", "Name", "Version") |
|||
.IsUnique(); |
|||
|
|||
b.ToTable("AppPlatformVersionFile"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Routes.Route", null) |
|||
.WithMany() |
|||
.HasForeignKey("ParentId"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") |
|||
.WithMany("Files") |
|||
.HasForeignKey("AppVersionId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace LINGYUN.Platform.Migrations |
|||
{ |
|||
public partial class AddVersionFileFieldPathAndPlatformType : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropIndex( |
|||
name: "IX_AppPlatformVersionFile_Name_Version", |
|||
table: "AppPlatformVersionFile"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Path", |
|||
table: "AppPlatformVersionFile", |
|||
maxLength: 255, |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "PlatformType", |
|||
table: "AppPlatformVersion", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AppPlatformVersionFile_Path_Name_Version", |
|||
table: "AppPlatformVersionFile", |
|||
columns: new[] { "Path", "Name", "Version" }, |
|||
unique: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropIndex( |
|||
name: "IX_AppPlatformVersionFile_Path_Name_Version", |
|||
table: "AppPlatformVersionFile"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Path", |
|||
table: "AppPlatformVersionFile"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PlatformType", |
|||
table: "AppPlatformVersion"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AppPlatformVersionFile_Name_Version", |
|||
table: "AppPlatformVersionFile", |
|||
columns: new[] { "Name", "Version" }); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue