Skip to content

Commit e9e6a42

Browse files
committed
archive replaced file
1 parent c3fcb9d commit e9e6a42

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

LearningHub.Nhs.WebUI/Controllers/Api/ResourceController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace LearningHub.Nhs.WebUI.Controllers.Api
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.Linq;
56
using System.Threading.Tasks;
67
using LearningHub.Nhs.Models.Enums;
78
using LearningHub.Nhs.Models.Resource;
@@ -565,9 +566,9 @@ public async Task<ActionResult> DeleteResourceProviderAsync(int resourceVersionI
565566
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
566567
[HttpPost]
567568
[Route("ArchiveResourceFile")]
568-
public ActionResult ArchiveResourceFile(List<string> filePaths)
569+
public ActionResult ArchiveResourceFile(IEnumerable<string> filePaths)
569570
{
570-
_ = Task.Run(async () => { await this.fileService.PurgeResourceFile(null, filePaths); });
571+
_ = Task.Run(async () => { await this.fileService.PurgeResourceFile(null, filePaths.ToList()); });
571572
return this.Ok();
572573
}
573574

LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/Content.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@
822822
this.fileUploadRef.value = null;
823823
(this.$refs.fileUploader as any).uploadResourceFile(this.file);
824824
},
825-
fileUploadComplete(uploadResult: FileUploadResult) {
825+
async fileUploadComplete(uploadResult: FileUploadResult) {
826826
if (!uploadResult.invalid) {
827827
if (uploadResult.resourceType != ResourceType.SCORM) {
828828
this.$store.commit("setResourceType", uploadResult.resourceType);
@@ -841,7 +841,7 @@
841841
}
842842
843843
if (this.filePathBeforeFileChange.length > 0) {
844-
this.getResourceFilePath('completed');
844+
await this.getResourceFilePath('completed');
845845
if (this.filePathBeforeFileChange.length > 0 && this.filePathAfterFileChange.length > 0) {
846846
let filePaths = this.filePathBeforeFileChange.filter(item => !this.filePathAfterFileChange.includes(item));
847847
if (filePaths.length > 0) {
@@ -1040,6 +1040,7 @@
10401040
await resourceData.getObsoleteResourceFile(resource.resourceVersionId).then(response => {
10411041
if (fileChangeStatus == 'initialised') {
10421042
this.filePathBeforeFileChange = response;
1043+
this.filePathAfterFileChange.length = 0;
10431044
}
10441045
else if (fileChangeStatus == 'completed') {
10451046
this.filePathAfterFileChange = response;

LearningHub.Nhs.WebUI/Scripts/vuesrc/data/resource.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ const getObsoleteResourceFile = async function (id: number): Promise<string[]> {
558558
};
559559

560560
const archiveResourceFile = async function (filepaths: string[]): Promise<boolean> {
561-
const params = {filePaths:filepaths};
562-
return await AxiosWrapper.axios.post('/api/Resource/DuplicateBlocks', params).then(() => {
561+
562+
return await AxiosWrapper.axios.post('/api/Resource/ArchiveResourceFile', filepaths).then(() => {
563563
return true
564564
}).catch(e => {
565565
console.log('archiveResourceFile:' + e);

WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
55
</PropertyGroup>
66
<PropertyGroup>
7-
<ActiveDebugProfile>IIS Local</ActiveDebugProfile>
7+
<ActiveDebugProfile>API IIS</ActiveDebugProfile>
88
</PropertyGroup>
99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
1010
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>

0 commit comments

Comments
 (0)