Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #12

Merged
merged 6 commits into from
May 15, 2024
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
2 changes: 1 addition & 1 deletion Apps.BWX/Apps.BWX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Product>Bureau Works</Product>
<Version>1.0.9</Version>
<Version>1.0.10</Version>
<Description>Bureau Works is cutting edge translation software that helps its users translate at greater speeds and with an increased sense of authorship.</Description>
<AssemblyName>Apps.BWX</AssemblyName>
</PropertyGroup>
Expand Down
29 changes: 29 additions & 0 deletions Apps.BWX/Converters/DateTimeConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Apps.BWX.Converters
{
public class DateTimeConverter : JsonConverter<DateTime>
{
public override DateTime ReadJson(JsonReader reader, Type objectType, DateTime existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Integer)
{
DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return start.AddMilliseconds(long.Parse(reader.Value.ToString())).ToLocalTime();
}

throw new JsonException("The JSON value could not be converted to DateTime.");
}

public override void WriteJson(JsonWriter writer, DateTime value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
}
}
10 changes: 6 additions & 4 deletions Apps.BWX/Webhooks/Payload/NewProjectEvent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Blackbird.Applications.Sdk.Common;
using Apps.BWX.Converters;
using Blackbird.Applications.Sdk.Common;
using Newtonsoft.Json;

namespace Apps.BWX.Webhooks.Payload;
Expand All @@ -9,9 +10,10 @@ public class NewProjectEvent
[JsonProperty("uuid")]
public string Uuid { get; set; }

//[Display("Creation timestamp")]
//[JsonProperty("creation_timestamp")]
//public long CreationTimestamp { get; set; }
[Display("Creation date")]
[JsonProperty("creation_timestamp")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime CreationTimestamp { get; set; }

[JsonProperty("creator")]
public string Creator { get; set; }
Expand Down
10 changes: 6 additions & 4 deletions Apps.BWX/Webhooks/Payload/ProjectStatusChangedPayload.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Blackbird.Applications.Sdk.Common;
using Apps.BWX.Converters;
using Blackbird.Applications.Sdk.Common;
using Newtonsoft.Json;

namespace Apps.BWX.Webhooks.Payload;
Expand All @@ -9,9 +10,10 @@ public class ProjectStatusChangedPayload
[JsonProperty("uuid")]
public string Uuid { get; set; }

//[Display("Creation timestamp")]
//[JsonProperty("creation_timestamp")]
//public long CreationTimestamp { get; set; }
[Display("Creation date")]
[JsonProperty("creation_timestamp")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime CreationTimestamp { get; set; }
public string Creator { get; set; }

[Display("Creator email")]
Expand Down
52 changes: 30 additions & 22 deletions Apps.BWX/Webhooks/Payload/TaskAssignedEvent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Blackbird.Applications.Sdk.Common;
using Apps.BWX.Converters;
using Blackbird.Applications.Sdk.Common;
using Newtonsoft.Json;

namespace Apps.BWX.Webhooks.Payload;
Expand All @@ -9,13 +10,15 @@ public class TaskAssignedEvent
[JsonProperty("uuid")]
public string Uuid { get; set; }

//[Display("Acceptance date")]
//[JsonProperty("acceptance_date")]
//public long AcceptanceDate { get; set; }
[Display("Acceptance date")]
[JsonProperty("acceptance_date")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime AcceptanceDate { get; set; }

//[Display("Assign date")]
//[JsonProperty("assign_date")]
//public long AssignDate { get; set; }
[Display("Assign date")]
[JsonProperty("assign_date")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime AssignDate { get; set; }

[Display("Assigned by email")]
[JsonProperty("assigned_by_email")]
Expand All @@ -40,9 +43,10 @@ public class TaskAssignedEvent
[JsonProperty("begin_index", NullValueHandling = NullValueHandling.Ignore)]
public long BeginIndex { get; set; }

//[Display("Creation timestamp")]
//[JsonProperty("creation_timestamp")]
//public long CreationTimestamp { get; set; }
[Display("Creation date")]
[JsonProperty("creation_timestamp")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime CreationTimestamp { get; set; }

[JsonProperty("creator")]
public string Creator { get; set; }
Expand All @@ -51,13 +55,15 @@ public class TaskAssignedEvent
[JsonProperty("creator_email")]
public string CreatorEmail { get; set; }

//[Display("Delivery date")]
//[JsonProperty("delivery_date")]
//public long DeliveryDate { get; set; }
[Display("Delivery date")]
[JsonProperty("delivery_date")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime DeliveryDate { get; set; }

//[Display("Due date")]
//[JsonProperty("due_date")]
//public long DueDate { get; set; }
[Display("Due date")]
[JsonProperty("due_date")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime DueDate { get; set; }

//[Display("End index")]
//[JsonProperty("end_index")]
Expand Down Expand Up @@ -88,13 +94,15 @@ public class TaskAssignedEvent
[JsonProperty("reference_files")]
public List<string> ReferenceFiles { get; set; }

//[Display("Scheduled date")]
//[JsonProperty("scheduled_date")]
//public long ScheduledDate { get; set; }
[Display("Scheduled date")]
[JsonProperty("scheduled_date")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime ScheduledDate { get; set; }

//[Display("Skip date")]
//[JsonProperty("skip_date")]
//public long SkipDate { get; set; }
[Display("Skip date")]
[JsonProperty("skip_date")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime SkipDate { get; set; }

[JsonProperty("status")]
public string Status { get; set; }
Expand Down