♻️ I have no idea what I have done

This commit is contained in:
2025-07-15 01:54:27 +08:00
parent a03b8d1cac
commit 3c11c4f3be
35 changed files with 1761 additions and 930 deletions

View File

@@ -0,0 +1,40 @@
namespace DysonNetwork.Shared.Data;
public abstract class ActionLogType
{
public const string NewLogin = "login";
public const string ChallengeAttempt = "challenges.attempt";
public const string ChallengeSuccess = "challenges.success";
public const string ChallengeFailure = "challenges.failure";
public const string PostCreate = "posts.create";
public const string PostUpdate = "posts.update";
public const string PostDelete = "posts.delete";
public const string PostReact = "posts.react";
public const string MessageCreate = "messages.create";
public const string MessageUpdate = "messages.update";
public const string MessageDelete = "messages.delete";
public const string MessageReact = "messages.react";
public const string PublisherCreate = "publishers.create";
public const string PublisherUpdate = "publishers.update";
public const string PublisherDelete = "publishers.delete";
public const string PublisherMemberInvite = "publishers.members.invite";
public const string PublisherMemberJoin = "publishers.members.join";
public const string PublisherMemberLeave = "publishers.members.leave";
public const string PublisherMemberKick = "publishers.members.kick";
public const string RealmCreate = "realms.create";
public const string RealmUpdate = "realms.update";
public const string RealmDelete = "realms.delete";
public const string RealmInvite = "realms.invite";
public const string RealmJoin = "realms.join";
public const string RealmLeave = "realms.leave";
public const string RealmKick = "realms.kick";
public const string RealmAdjustRole = "realms.role.edit";
public const string ChatroomCreate = "chatrooms.create";
public const string ChatroomUpdate = "chatrooms.update";
public const string ChatroomDelete = "chatrooms.delete";
public const string ChatroomInvite = "chatrooms.invite";
public const string ChatroomJoin = "chatrooms.join";
public const string ChatroomLeave = "chatrooms.leave";
public const string ChatroomKick = "chatrooms.kick";
public const string ChatroomAdjustRole = "chatrooms.role.edit";
}

View File

@@ -0,0 +1,11 @@
namespace DysonNetwork.Shared.Data;
public abstract class WebSocketPacketType
{
public const string Error = "error";
public const string MessageNew = "messages.new";
public const string MessageUpdate = "messages.update";
public const string MessageDelete = "messages.delete";
public const string CallParticipantsUpdate = "call.participants.update";
}

View File

@@ -86,4 +86,19 @@ public abstract class GrpcTypeHelper
_ => JsonConvert.DeserializeObject(JsonConvert.SerializeObject(value, SerializerSettings))
};
}
public static Value ConvertObjectToValue(object? obj)
{
return obj switch
{
string s => Value.ForString(s),
int i => Value.ForNumber(i),
long l => Value.ForNumber(l),
float f => Value.ForNumber(f),
double d => Value.ForNumber(d),
bool b => Value.ForBool(b),
null => Value.ForNull(),
_ => Value.ForString(JsonConvert.SerializeObject(obj, SerializerSettings)) // fallback to JSON string
};
}
}

View File

@@ -159,7 +159,7 @@ message Relationship {
string related_id = 2;
optional Account account = 3;
optional Account related = 4;
int32 type = 5;
int32 status = 5;
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
@@ -218,8 +218,8 @@ service AccountService {
rpc GetRelationship(GetRelationshipRequest) returns (GetRelationshipResponse) {}
rpc HasRelationship(GetRelationshipRequest) returns (google.protobuf.BoolValue) {}
rpc ListFriends(ListUserRelationshipSimpleRequest) returns (ListUserRelationshipSimpleResponse) {}
rpc ListBlocked(ListUserRelationshipSimpleRequest) returns (ListUserRelationshipSimpleResponse) {}
rpc ListFriends(ListRelationshipSimpleRequest) returns (ListRelationshipSimpleResponse) {}
rpc ListBlocked(ListRelationshipSimpleRequest) returns (ListRelationshipSimpleResponse) {}
}
// ActionLogService provides operations for action logs
@@ -396,10 +396,10 @@ message GetRelationshipResponse {
optional Relationship relationship = 1;
}
message ListUserRelationshipSimpleRequest {
message ListRelationshipSimpleRequest {
string account_id = 1;
}
message ListUserRelationshipSimpleResponse {
message ListRelationshipSimpleResponse {
repeated string accounts_id = 1;
}