Skip to content

Commit 5bd73fd

Browse files
authored
Merge pull request abpframework#2850 from abpframework/maliming/Docs_new_Label
Docs module "new" label improvement
2 parents 037ef9a + 893c8a4 commit 5bd73fd

File tree

15 files changed

+42
-34
lines changed

15 files changed

+42
-34
lines changed

modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200212135141_init.Designer.cs renamed to modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.Designer.cs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200212135141_init.cs renamed to modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ protected override void Up(MigrationBuilder migrationBuilder)
130130
RootUrl = table.Column<string>(maxLength: 2048, nullable: true),
131131
RawRootUrl = table.Column<string>(maxLength: 2048, nullable: true),
132132
LocalDirectory = table.Column<string>(maxLength: 512, nullable: true),
133+
CreationTime = table.Column<DateTime>(nullable: false),
133134
LastUpdatedTime = table.Column<DateTime>(nullable: false),
134-
UpdatedCount = table.Column<int>(nullable: false),
135135
LastCachedTime = table.Column<DateTime>(nullable: false)
136136
},
137137
constraints: table =>

modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
462462
.IsRequired()
463463
.HasColumnType("nvarchar(max)");
464464

465+
b.Property<DateTime>("CreationTime")
466+
.HasColumnType("datetime2");
467+
465468
b.Property<string>("EditLink")
466469
.HasColumnType("nvarchar(2048)")
467470
.HasMaxLength(2048);
@@ -510,9 +513,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
510513
.HasColumnType("nvarchar(2048)")
511514
.HasMaxLength(2048);
512515

513-
b.Property<int>("UpdatedCount")
514-
.HasColumnType("int");
515-
516516
b.Property<string>("Version")
517517
.IsRequired()
518518
.HasColumnType("nvarchar(128)")

modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ private async Task UpdateDocumentUpdateInfoCache(Document document)
8686
await _documentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo
8787
{
8888
Name = document.Name,
89-
LastUpdatedTime = document.LastUpdatedTime,
90-
UpdatedCount = document.UpdatedCount
89+
CreationTime = document.CreationTime,
90+
LastUpdatedTime = document.LastUpdatedTime
9191
});
9292
}
9393

modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/DocumentWithDetailsDto.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public class DocumentWithDetailsDto
2727

2828
public virtual string LocalDirectory { get; set; }
2929

30-
public virtual DateTime LastUpdatedTime { get; set; }
30+
public virtual DateTime CreationTime { get; set; }
3131

32-
public virtual int UpdatedCount { get; set; }
32+
public virtual DateTime LastUpdatedTime { get; set; }
3333

3434
public virtual DateTime LastCachedTime { get; set; }
3535

modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public virtual async Task<NavigationNode> GetNavigationAsync(GetNavigationDocume
8585
var documentUpdateInfo = await DocumentUpdateCache.GetAsync(cacheKey);
8686
if (documentUpdateInfo != null)
8787
{
88+
leaf.CreationTime = documentUpdateInfo.CreationTime;
8889
leaf.LastUpdatedTime = documentUpdateInfo.LastUpdatedTime;
89-
leaf.UpdatedCount = documentUpdateInfo.UpdatedCount;
9090
}
9191
}
9292

@@ -175,8 +175,8 @@ async Task<DocumentWithDetailsDto> GetDocumentAsync()
175175
await DocumentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo
176176
{
177177
Name = sourceDocument.Name,
178-
LastUpdatedTime = sourceDocument.LastUpdatedTime,
179-
UpdatedCount = sourceDocument.UpdatedCount
178+
CreationTime = sourceDocument.CreationTime,
179+
LastUpdatedTime = sourceDocument.LastUpdatedTime
180180
});
181181

182182
return CreateDocumentWithDetailsDto(project, sourceDocument);
@@ -206,8 +206,8 @@ async Task<DocumentWithDetailsDto> GetDocumentAsync()
206206
await DocumentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo
207207
{
208208
Name = document.Name,
209+
CreationTime = document.CreationTime,
209210
LastUpdatedTime = document.LastUpdatedTime,
210-
UpdatedCount = document.UpdatedCount
211211
});
212212

213213
return CreateDocumentWithDetailsDto(project, document);

modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentUpdateInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ public class DocumentUpdateInfo
77
{
88
public virtual string Name { get; set; }
99

10-
public virtual DateTime LastUpdatedTime { get; set; }
10+
public virtual DateTime CreationTime { get; set; }
1111

12-
public virtual int UpdatedCount { get; set; }
12+
public virtual DateTime LastUpdatedTime { get; set; }
1313
}
1414
}

modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/NavigationNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public class NavigationNode
2222

2323
public bool IsEmpty => Text == null && Path == null;
2424

25-
public DateTime? LastUpdatedTime { get; set; }
25+
public virtual DateTime? CreationTime { get; set; }
2626

27-
public int UpdatedCount { get; set; }
27+
public virtual DateTime? LastUpdatedTime { get; set; }
2828

2929
public bool IsSelected(string documentName)
3030
{

modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/Document.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public class Document : AggregateRoot<Guid>
3131

3232
public virtual string LocalDirectory { get; set; }
3333

34+
public virtual DateTime CreationTime { get; set; }
35+
3436
public virtual DateTime LastUpdatedTime { get; set; }
3537

36-
public virtual int UpdatedCount { get; set; }
37-
3838
public virtual DateTime LastCachedTime { get; set; }
3939

4040
public virtual List<DocumentContributor> Contributors { get; set; }
@@ -58,8 +58,8 @@ public Document(
5858
[NotNull] string rootUrl,
5959
[NotNull] string rawRootUrl,
6060
[NotNull] string localDirectory,
61+
DateTime creationTime,
6162
DateTime lastUpdatedTime,
62-
int updatedCount,
6363
DateTime lastCachedTime
6464
)
6565
{
@@ -76,8 +76,9 @@ DateTime lastCachedTime
7676
RootUrl = Check.NotNullOrWhiteSpace(rootUrl, nameof(rootUrl));
7777
RawRootUrl = Check.NotNullOrWhiteSpace(rawRootUrl, nameof(rawRootUrl));
7878
LocalDirectory = Check.NotNull(localDirectory, nameof(localDirectory));
79+
80+
CreationTime = creationTime;
7981
LastUpdatedTime = lastUpdatedTime;
80-
UpdatedCount = updatedCount;
8182
LastCachedTime = lastCachedTime;
8283

8384
Contributors = new List<DocumentContributor>();

modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public async Task<Document> GetDocumentAsync(Project project, string documentNam
4343
"/",
4444
$"/document-resources?projectId={project.Id.ToString()}&version={version}&languageCode={languageCode}&name=",
4545
localDirectory,
46+
File.GetCreationTime(path),
4647
File.GetLastWriteTime(path),
47-
File.GetLastWriteTime(path) == File.GetCreationTime(path) ? 1 : 2,
4848
DateTime.Now);
4949
}
5050

0 commit comments

Comments
 (0)