Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions AzureDevopsTracker/DTOs/Create/CreateWorkItemDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,4 @@ public class CreateWorkItemDTO
[JsonProperty("resource")]
public Resource Resource { get; set; }
}

public class Resource
{
[JsonPropertyName("id")]
[JsonProperty("id")]
public string Id { get; set; }

[JsonPropertyName("fields")]
[JsonProperty("fields")]
public Fields Fields { get; set; }
}
}
12 changes: 12 additions & 0 deletions AzureDevopsTracker/DTOs/Delete/DeleteWorkItemDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace AzureDevopsTracker.DTOs.Delete
{
public class DeleteWorkItemDTO
{
[JsonPropertyName("resource")]
[JsonProperty("resource")]
public Resource Resource { get; set; }
}
}
16 changes: 16 additions & 0 deletions AzureDevopsTracker/DTOs/Resource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace AzureDevopsTracker.DTOs
{
public class Resource
{
[JsonPropertyName("id")]
[JsonProperty("id")]
public string Id { get; set; }

[JsonPropertyName("fields")]
[JsonProperty("fields")]
public Fields Fields { get; set; }
}
}
12 changes: 12 additions & 0 deletions AzureDevopsTracker/DTOs/Restore/RestoreWorkItemDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace AzureDevopsTracker.DTOs.Restore
{
public class RestoreWorkItemDTO
{
[JsonPropertyName("resource")]
[JsonProperty("resource")]
public Resource Resource { get; set; }
}
}
11 changes: 11 additions & 0 deletions AzureDevopsTracker/Entities/WorkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class WorkItem : Entity
public string WorkItemParentId { get; private set; }
public string Activity { get; private set; }
public string Lancado { get; private set; }
public bool Deleted { get; private set; }

public ChangeLogItem ChangeLogItem { get; private set; }

Expand Down Expand Up @@ -73,6 +74,16 @@ public void Update(string title,
Lancado = lancado;
}

public void Restore()
{
Deleted = false;
}

public void Delete()
{
Deleted = true;
}

public void Validate()
{
if (Id.IsNullOrEmpty())
Expand Down
4 changes: 4 additions & 0 deletions AzureDevopsTracker/Interfaces/IAzureDevopsTrackerService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using AzureDevopsTracker.DTOs;
using AzureDevopsTracker.DTOs.Create;
using AzureDevopsTracker.DTOs.Delete;
using AzureDevopsTracker.DTOs.Restore;
using AzureDevopsTracker.DTOs.Update;
using System.Threading.Tasks;

Expand All @@ -9,6 +11,8 @@ public interface IAzureDevopsTrackerService
{
Task Create(CreateWorkItemDTO createDto, bool addWorkItemChange = true);
Task Update(UpdatedWorkItemDTO updateDto);
Task Delete(DeleteWorkItemDTO deleteDto);
Task Restore(RestoreWorkItemDTO restoreDto);
Task<WorkItemDTO> GetByWorkItemId(string workItemId);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using AzureDevopsTracker.Data;
using Microsoft.EntityFrameworkCore.Migrations;

namespace AzureDevopsTracker.Migrations
{
public partial class WorkItem_AddDeleted : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Deleted",
schema: DataBaseConfig.SchemaName,
table: "WorkItems",
type: "bit",
nullable: false,
defaultValue: false);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Deleted",
schema: DataBaseConfig.SchemaName,
table: "WorkItems");
}
}
}
Loading