Skip to content

Commit d90d0b7

Browse files
authored
Merge pull request #5 from typinghard/feature/68
Feature/68
2 parents af08b3d + 30876ee commit d90d0b7

File tree

10 files changed

+426
-17
lines changed

10 files changed

+426
-17
lines changed

AzureDevopsTracker/DTOs/Create/CreateWorkItemDTO.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,4 @@ public class CreateWorkItemDTO
99
[JsonProperty("resource")]
1010
public Resource Resource { get; set; }
1111
}
12-
13-
public class Resource
14-
{
15-
[JsonPropertyName("id")]
16-
[JsonProperty("id")]
17-
public string Id { get; set; }
18-
19-
[JsonPropertyName("fields")]
20-
[JsonProperty("fields")]
21-
public Fields Fields { get; set; }
22-
}
2312
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace AzureDevopsTracker.DTOs.Delete
5+
{
6+
public class DeleteWorkItemDTO
7+
{
8+
[JsonPropertyName("resource")]
9+
[JsonProperty("resource")]
10+
public Resource Resource { get; set; }
11+
}
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace AzureDevopsTracker.DTOs
5+
{
6+
public class Resource
7+
{
8+
[JsonPropertyName("id")]
9+
[JsonProperty("id")]
10+
public string Id { get; set; }
11+
12+
[JsonPropertyName("fields")]
13+
[JsonProperty("fields")]
14+
public Fields Fields { get; set; }
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace AzureDevopsTracker.DTOs.Restore
5+
{
6+
public class RestoreWorkItemDTO
7+
{
8+
[JsonPropertyName("resource")]
9+
[JsonProperty("resource")]
10+
public Resource Resource { get; set; }
11+
}
12+
}

AzureDevopsTracker/Entities/WorkItem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class WorkItem : Entity
2121
public string WorkItemParentId { get; private set; }
2222
public string Activity { get; private set; }
2323
public string Lancado { get; private set; }
24+
public bool Deleted { get; private set; }
2425

2526
public ChangeLogItem ChangeLogItem { get; private set; }
2627

@@ -73,6 +74,16 @@ public void Update(string title,
7374
Lancado = lancado;
7475
}
7576

77+
public void Restore()
78+
{
79+
Deleted = false;
80+
}
81+
82+
public void Delete()
83+
{
84+
Deleted = true;
85+
}
86+
7687
public void Validate()
7788
{
7889
if (Id.IsNullOrEmpty())

AzureDevopsTracker/Interfaces/IAzureDevopsTrackerService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using AzureDevopsTracker.DTOs;
22
using AzureDevopsTracker.DTOs.Create;
3+
using AzureDevopsTracker.DTOs.Delete;
4+
using AzureDevopsTracker.DTOs.Restore;
35
using AzureDevopsTracker.DTOs.Update;
46
using System.Threading.Tasks;
57

@@ -9,6 +11,8 @@ public interface IAzureDevopsTrackerService
911
{
1012
Task Create(CreateWorkItemDTO createDto, bool addWorkItemChange = true);
1113
Task Update(UpdatedWorkItemDTO updateDto);
14+
Task Delete(DeleteWorkItemDTO deleteDto);
15+
Task Restore(RestoreWorkItemDTO restoreDto);
1216
Task<WorkItemDTO> GetByWorkItemId(string workItemId);
1317
}
1418
}

AzureDevopsTracker/Migrations/20220607220158_WorkItem_AddDeleted.Designer.cs

Lines changed: 253 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using AzureDevopsTracker.Data;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
namespace AzureDevopsTracker.Migrations
5+
{
6+
public partial class WorkItem_AddDeleted : Migration
7+
{
8+
protected override void Up(MigrationBuilder migrationBuilder)
9+
{
10+
migrationBuilder.AddColumn<bool>(
11+
name: "Deleted",
12+
schema: DataBaseConfig.SchemaName,
13+
table: "WorkItems",
14+
type: "bit",
15+
nullable: false,
16+
defaultValue: false);
17+
}
18+
19+
protected override void Down(MigrationBuilder migrationBuilder)
20+
{
21+
migrationBuilder.DropColumn(
22+
name: "Deleted",
23+
schema: DataBaseConfig.SchemaName,
24+
table: "WorkItems");
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)