Lots of fix
This commit is contained in:
parent
454b6d5814
commit
16294b7103
@ -6,6 +6,13 @@ using ReactiveUI.SourceGenerators;
|
|||||||
|
|
||||||
namespace Flawless.Client.Models;
|
namespace Flawless.Client.Models;
|
||||||
|
|
||||||
|
public enum WebhookEventType
|
||||||
|
{
|
||||||
|
Push,
|
||||||
|
IssueCreated,
|
||||||
|
IssueUpdate
|
||||||
|
}
|
||||||
|
|
||||||
public partial class RepositoryModel : ReactiveModel
|
public partial class RepositoryModel : ReactiveModel
|
||||||
{
|
{
|
||||||
public static string GetStandaloneName(string name, string ownerName)
|
public static string GetStandaloneName(string name, string ownerName)
|
||||||
@ -79,7 +86,7 @@ public partial class RepositoryModel : ReactiveModel
|
|||||||
|
|
||||||
public partial class Comment : ReactiveModel
|
public partial class Comment : ReactiveModel
|
||||||
{
|
{
|
||||||
[Reactive] private ulong _id;
|
[Reactive] private int _id;
|
||||||
|
|
||||||
[Reactive] private string _content;
|
[Reactive] private string _content;
|
||||||
|
|
||||||
@ -87,7 +94,7 @@ public partial class RepositoryModel : ReactiveModel
|
|||||||
|
|
||||||
[Reactive] private DateTime _createdAt;
|
[Reactive] private DateTime _createdAt;
|
||||||
|
|
||||||
[Reactive] private ulong? _replyTo;
|
[Reactive] private int? _replyTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Member : ReactiveModel
|
public partial class Member : ReactiveModel
|
||||||
|
|||||||
@ -379,13 +379,9 @@ namespace Flawless.Client.Remote
|
|||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||||
public partial class AddCommentRequest
|
public partial class AddCommentRequest
|
||||||
{
|
{
|
||||||
|
public string Content;
|
||||||
|
|
||||||
[JsonPropertyName("content")]
|
public int? ReplyTo;
|
||||||
public string Content { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("replyTo")]
|
|
||||||
public long? ReplyTo { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||||
@ -393,7 +389,7 @@ namespace Flawless.Client.Remote
|
|||||||
{
|
{
|
||||||
|
|
||||||
[JsonPropertyName("commentId")]
|
[JsonPropertyName("commentId")]
|
||||||
public long CommentId { get; set; }
|
public int CommentId { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("author")]
|
[JsonPropertyName("author")]
|
||||||
public string Author { get; set; }
|
public string Author { get; set; }
|
||||||
@ -405,7 +401,7 @@ namespace Flawless.Client.Remote
|
|||||||
public System.DateTimeOffset CreatedAt { get; set; }
|
public System.DateTimeOffset CreatedAt { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("replyToId")]
|
[JsonPropertyName("replyToId")]
|
||||||
public long? ReplyToId { get; set; }
|
public int? ReplyToId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,26 +636,6 @@ namespace Flawless.Client.Remote
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
||||||
public enum LogLevel
|
|
||||||
{
|
|
||||||
|
|
||||||
_0 = 0,
|
|
||||||
|
|
||||||
_1 = 1,
|
|
||||||
|
|
||||||
_2 = 2,
|
|
||||||
|
|
||||||
_3 = 3,
|
|
||||||
|
|
||||||
_4 = 4,
|
|
||||||
|
|
||||||
_5 = 5,
|
|
||||||
|
|
||||||
_6 = 6,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||||
public partial class LoginRequest
|
public partial class LoginRequest
|
||||||
{
|
{
|
||||||
@ -911,7 +887,7 @@ namespace Flawless.Client.Remote
|
|||||||
public string NickName { get; set; }
|
public string NickName { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("gender")]
|
[JsonPropertyName("gender")]
|
||||||
public int Gender { get; set; }
|
public UserSex Gender { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("bio")]
|
[JsonPropertyName("bio")]
|
||||||
public string Bio { get; set; }
|
public string Bio { get; set; }
|
||||||
@ -946,22 +922,7 @@ namespace Flawless.Client.Remote
|
|||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||||
public partial class WebhookCreateRequest
|
public enum UserSex
|
||||||
{
|
|
||||||
|
|
||||||
[JsonPropertyName("targetUrl")]
|
|
||||||
public string TargetUrl { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("eventType")]
|
|
||||||
public WebhookEventType EventType { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("secret")]
|
|
||||||
public string Secret { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
||||||
public enum WebhookEventType
|
|
||||||
{
|
{
|
||||||
|
|
||||||
_0 = 0,
|
_0 = 0,
|
||||||
@ -970,6 +931,23 @@ namespace Flawless.Client.Remote
|
|||||||
|
|
||||||
_2 = 2,
|
_2 = 2,
|
||||||
|
|
||||||
|
_3 = 3,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||||
|
public partial class WebhookCreateRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonPropertyName("targetUrl")]
|
||||||
|
public string TargetUrl { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("eventType")]
|
||||||
|
public int EventType { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("secret")]
|
||||||
|
public string Secret { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||||
@ -983,7 +961,7 @@ namespace Flawless.Client.Remote
|
|||||||
public string TargetUrl { get; set; }
|
public string TargetUrl { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("eventType")]
|
[JsonPropertyName("eventType")]
|
||||||
public WebhookEventType EventType { get; set; }
|
public int EventType { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("isActive")]
|
[JsonPropertyName("isActive")]
|
||||||
public bool IsActive { get; set; }
|
public bool IsActive { get; set; }
|
||||||
|
|||||||
@ -389,11 +389,11 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
|
|
||||||
entity.Comments.AddRange(details.Select(x => new RepositoryModel.Comment
|
entity.Comments.AddRange(details.Select(x => new RepositoryModel.Comment
|
||||||
{
|
{
|
||||||
Id = (ulong)x.Key,
|
Id = x.Key,
|
||||||
Author = x.Value.Author,
|
Author = x.Value.Author,
|
||||||
Content = x.Value.Content,
|
Content = x.Value.Content,
|
||||||
CreatedAt = x.Value.CreatedAt.UtcDateTime,
|
CreatedAt = x.Value.CreatedAt.UtcDateTime,
|
||||||
ReplyTo = x.Value.ReplyToId.HasValue ? (ulong)x.Value.ReplyToId.Value : null
|
ReplyTo = x.Value.ReplyToId.HasValue ? x.Value.ReplyToId.Value : null
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,21 +415,21 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
for (var i = 0; i < entity.Comments.Count; i++)
|
for (var i = 0; i < entity.Comments.Count; i++)
|
||||||
{
|
{
|
||||||
var c = entity.Comments[i];
|
var c = entity.Comments[i];
|
||||||
if (!details.ContainsKey((long) c.Id)) repo.Issues.RemoveAt(i);
|
if (!details.ContainsKey(c.Id)) repo.Issues.RemoveAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (key, value) in details)
|
foreach (var (key, value) in details)
|
||||||
{
|
{
|
||||||
var d = entity.Comments.FirstOrDefault(x => x.Id == (ulong) key);
|
var d = entity.Comments.FirstOrDefault(x => x.Id == key);
|
||||||
if (d == null)
|
if (d == null)
|
||||||
{
|
{
|
||||||
var c = new RepositoryModel.Comment
|
var c = new RepositoryModel.Comment
|
||||||
{
|
{
|
||||||
Id = (ulong)key,
|
Id = key,
|
||||||
Author = value.Author,
|
Author = value.Author,
|
||||||
Content = value.Content,
|
Content = value.Content,
|
||||||
CreatedAt = value.CreatedAt.UtcDateTime,
|
CreatedAt = value.CreatedAt.UtcDateTime,
|
||||||
ReplyTo = value.ReplyToId.HasValue ? (ulong)value.ReplyToId.Value : null
|
ReplyTo = value.ReplyToId.HasValue ? value.ReplyToId.Value : null
|
||||||
};
|
};
|
||||||
|
|
||||||
entity.Comments.Add(c);
|
entity.Comments.Add(c);
|
||||||
@ -439,7 +439,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
d.Author = value.Author;
|
d.Author = value.Author;
|
||||||
d.Content = value.Content;
|
d.Content = value.Content;
|
||||||
d.CreatedAt = value.CreatedAt.UtcDateTime;
|
d.CreatedAt = value.CreatedAt.UtcDateTime;
|
||||||
d.ReplyTo = value.ReplyToId.HasValue ? (ulong)value.ReplyToId.Value : null;
|
d.ReplyTo = value.ReplyToId.HasValue ? value.ReplyToId.Value : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ValueTask<bool> AddCommentAsync(RepositoryModel repo, int issueId, string content, ulong? replyTo)
|
public async ValueTask<bool> AddCommentAsync(RepositoryModel repo, int issueId, string content, int? replyTo)
|
||||||
{
|
{
|
||||||
var api = Api.C;
|
var api = Api.C;
|
||||||
try
|
try
|
||||||
@ -561,8 +561,12 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
await api.Gateway.Comment(repo.OwnerName, repo.Name, issueId,
|
var req = new AddCommentRequest
|
||||||
new AddCommentRequest { Content = content, ReplyTo = replyTo.HasValue ? (long) replyTo.Value : null });
|
{
|
||||||
|
Content = content, ReplyTo = replyTo.HasValue ? replyTo.Value : null
|
||||||
|
};
|
||||||
|
|
||||||
|
await api.Gateway.Comment(repo.OwnerName, repo.Name, issueId, req);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -1445,7 +1449,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
|
|
||||||
wh.TargetUrl = newWh.TargetUrl;
|
wh.TargetUrl = newWh.TargetUrl;
|
||||||
wh.Active = newWh.IsActive;
|
wh.Active = newWh.IsActive;
|
||||||
wh.EventType = newWh.EventType;
|
wh.EventType = (WebhookEventType) newWh.EventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var wh in dict.Values)
|
foreach (var wh in dict.Values)
|
||||||
@ -1456,7 +1460,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
TargetUrl = wh.TargetUrl,
|
TargetUrl = wh.TargetUrl,
|
||||||
Active = wh.IsActive,
|
Active = wh.IsActive,
|
||||||
CreatedAt = wh.CreatedAt.UtcDateTime,
|
CreatedAt = wh.CreatedAt.UtcDateTime,
|
||||||
EventType = wh.EventType
|
EventType = (WebhookEventType) wh.EventType
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1484,7 +1488,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
new WebhookCreateRequest {
|
new WebhookCreateRequest {
|
||||||
TargetUrl = targetUrl,
|
TargetUrl = targetUrl,
|
||||||
Secret = secret,
|
Secret = secret,
|
||||||
EventType = evt,
|
EventType = (int) evt,
|
||||||
});
|
});
|
||||||
|
|
||||||
return await UpdateWebhooksFromServerAsync(repo);
|
return await UpdateWebhooksFromServerAsync(repo);
|
||||||
|
|||||||
@ -84,9 +84,9 @@ public partial class IssueDetailViewModel : RoutableViewModelBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!await _service.AddCommentAsync(_repo, CurrentIssue.Id, NewComment, _replyTo?.Id ?? null)) return;
|
if (!await _service.AddCommentAsync(_repo, CurrentIssue.Id, NewComment, ReplyTo?.Id ?? null)) return;
|
||||||
|
|
||||||
_replyTo = null;
|
ReplyTo = null;
|
||||||
NewComment = string.Empty;
|
NewComment = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using Flawless.Client.Remote;
|
using Flawless.Client.Models;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using ReactiveUI.SourceGenerators;
|
using ReactiveUI.SourceGenerators;
|
||||||
|
|
||||||
|
|||||||
@ -163,7 +163,7 @@ public partial class RepositoryViewModel : RoutableViewModelBase
|
|||||||
[Reactive] private ISeries[] _byDay = [new ColumnSeries<DateTimePoint>()];
|
[Reactive] private ISeries[] _byDay = [new ColumnSeries<DateTimePoint>()];
|
||||||
|
|
||||||
public ICartesianAxis[] XAxesByDay { get; set; } = [
|
public ICartesianAxis[] XAxesByDay { get; set; } = [
|
||||||
new DateTimeAxis(TimeSpan.FromDays(1), date => date.ToString("MMMM dd"))
|
new DateTimeAxis(TimeSpan.FromDays(1), date => date.ToString("MM/dd/yyyy"))
|
||||||
];
|
];
|
||||||
|
|
||||||
private string _wsRoot;
|
private string _wsRoot;
|
||||||
|
|||||||
@ -105,7 +105,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
<Label>Every Day Commits</Label>
|
<Label>Every Day Commits</Label>
|
||||||
<lvc:CartesianChart Series="{Binding ByDay, Mode=TwoWay}" XAxes="{Binding XAxesByDay, Mode=TwoWay}">
|
<lvc:CartesianChart MinHeight="280" Series="{Binding ByDay, Mode=TwoWay}" XAxes="{Binding XAxesByDay, Mode=TwoWay}">
|
||||||
</lvc:CartesianChart>
|
</lvc:CartesianChart>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
namespace Flawless.Communication.Request;
|
namespace Flawless.Communication.Request;
|
||||||
|
|
||||||
public record AddCommentRequest(string Content, ulong? ReplyTo);
|
public struct AddCommentRequest
|
||||||
|
{
|
||||||
|
public string Content;
|
||||||
|
|
||||||
|
public int? ReplyTo;
|
||||||
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
namespace Flawless.Communication.Response;
|
namespace Flawless.Communication.Response;
|
||||||
|
|
||||||
public record CommentResponse(
|
public record CommentResponse(
|
||||||
ulong CommentId,
|
int CommentId,
|
||||||
string Author,
|
string Author,
|
||||||
string Content,
|
string Content,
|
||||||
DateTime CreatedAt,
|
DateTime CreatedAt,
|
||||||
ulong? ReplyToId = null
|
int? ReplyToId = null
|
||||||
);
|
);
|
||||||
@ -5,7 +5,7 @@ namespace Flawless.Server.Models;
|
|||||||
|
|
||||||
public class RepositoryIssue
|
public class RepositoryIssue
|
||||||
{
|
{
|
||||||
[Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
@ -32,8 +32,8 @@ public class RepositoryIssue
|
|||||||
|
|
||||||
public class RepositoryIssueContent
|
public class RepositoryIssueContent
|
||||||
{
|
{
|
||||||
[Key, Required]
|
[Key]
|
||||||
public ulong Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public RepositoryIssue Issue { get; set; }
|
public RepositoryIssue Issue { get; set; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user