style: 自动格式化
This commit is contained in:
+20
-3
@@ -26,9 +26,26 @@ PASSWORD = "test1234"
|
|||||||
|
|
||||||
def psql(sql: str) -> str:
|
def psql(sql: str) -> str:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
["docker", "exec", "-i", CONTAINER, "psql", "-U", DB_USER, "-d", DB_NAME,
|
[
|
||||||
"-v", "ON_ERROR_STOP=1", "--no-psqlrc", "-t", "-A"],
|
"docker",
|
||||||
input=sql, capture_output=True, text=True, timeout=30,
|
"exec",
|
||||||
|
"-i",
|
||||||
|
CONTAINER,
|
||||||
|
"psql",
|
||||||
|
"-U",
|
||||||
|
DB_USER,
|
||||||
|
"-d",
|
||||||
|
DB_NAME,
|
||||||
|
"-v",
|
||||||
|
"ON_ERROR_STOP=1",
|
||||||
|
"--no-psqlrc",
|
||||||
|
"-t",
|
||||||
|
"-A",
|
||||||
|
],
|
||||||
|
input=sql,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
timeout=30,
|
||||||
)
|
)
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
print(f"psql error:\n{r.stderr}", file=sys.stderr)
|
print(f"psql error:\n{r.stderr}", file=sys.stderr)
|
||||||
|
|||||||
@@ -647,7 +647,9 @@ def phase6_player(s: Session, game_id):
|
|||||||
return player_id, service_id
|
return player_id, service_id
|
||||||
|
|
||||||
|
|
||||||
def phase7_shop(s_owner: Session, s_invited_player: Session, owner_user_id, invited_player_id):
|
def phase7_shop(
|
||||||
|
s_owner: Session, s_invited_player: Session, owner_user_id, invited_player_id
|
||||||
|
):
|
||||||
print("\n=== Phase 7: Shop ===")
|
print("\n=== Phase 7: Shop ===")
|
||||||
|
|
||||||
s_owner.post(
|
s_owner.post(
|
||||||
@@ -1206,7 +1208,9 @@ def main():
|
|||||||
phase2_user(s_user, user_id)
|
phase2_user(s_user, user_id)
|
||||||
|
|
||||||
s_consumer.get(f"{GATEWAY}/healthz")
|
s_consumer.get(f"{GATEWAY}/healthz")
|
||||||
phase1_register(s_consumer, consumer_name, consumer_email, consumer_pass, label="consumer")
|
phase1_register(
|
||||||
|
s_consumer, consumer_name, consumer_email, consumer_pass, label="consumer"
|
||||||
|
)
|
||||||
consumer_login_resp = phase1_login(
|
consumer_login_resp = phase1_login(
|
||||||
s_consumer,
|
s_consumer,
|
||||||
consumer_name,
|
consumer_name,
|
||||||
|
|||||||
+1
-7
@@ -1,20 +1,18 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
import "common.api"
|
import "common.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
SessionIdReq {
|
SessionIdReq {
|
||||||
Id int64 `path:"id"`
|
Id int64 `path:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateGroupReq {
|
CreateGroupReq {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Participants []int64 `json:"participants,optional"`
|
Participants []int64 `json:"participants,optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateDMReq {
|
CreateDMReq {
|
||||||
TargetId int64 `json:"targetId"`
|
TargetId int64 `json:"targetId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatSession {
|
ChatSession {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
@@ -25,11 +23,9 @@ type (
|
|||||||
LastMessageAt int64 `json:"lastMessageAt"`
|
LastMessageAt int64 `json:"lastMessageAt"`
|
||||||
CreatedAt int64 `json:"createdAt"`
|
CreatedAt int64 `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatSessionListResp {
|
ChatSessionListResp {
|
||||||
Items []ChatSession `json:"items"`
|
Items []ChatSession `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessage {
|
ChatMessage {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
SessionId int64 `json:"sessionId"`
|
SessionId int64 `json:"sessionId"`
|
||||||
@@ -38,11 +34,9 @@ type (
|
|||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
CreatedAt int64 `json:"createdAt"`
|
CreatedAt int64 `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessageListResp {
|
ChatMessageListResp {
|
||||||
Items []ChatMessage `json:"items"`
|
Items []ChatMessage `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ListMessageReq {
|
ListMessageReq {
|
||||||
SessionIdReq
|
SessionIdReq
|
||||||
PageReq
|
PageReq
|
||||||
|
|||||||
@@ -13,17 +13,14 @@ type (
|
|||||||
Offset int64 `form:"offset,default=0"`
|
Offset int64 `form:"offset,default=0"`
|
||||||
Limit int64 `form:"limit,default=20"`
|
Limit int64 `form:"limit,default=20"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页响应元数据
|
// 分页响应元数据
|
||||||
PageMeta {
|
PageMeta {
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
Offset int64 `json:"offset"`
|
Offset int64 `json:"offset"`
|
||||||
Limit int64 `json:"limit"`
|
Limit int64 `json:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 空响应
|
// 空响应
|
||||||
EmptyResp {}
|
EmptyResp {}
|
||||||
|
|
||||||
// 核心用户画像 (被 Auth, Community, Shop 等多个服务引用)
|
// 核心用户画像 (被 Auth, Community, Shop 等多个服务引用)
|
||||||
UserProfile {
|
UserProfile {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
@@ -37,7 +34,6 @@ type (
|
|||||||
Bio string `json:"bio,optional"`
|
Bio string `json:"bio,optional"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 简略用户信息 (用于列表、聊天头像等)
|
// 简略用户信息 (用于列表、聊天头像等)
|
||||||
SimpleUser {
|
SimpleUser {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
import "common.api"
|
import "common.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -14,24 +15,20 @@ type (
|
|||||||
Result string `json:"result,optional"`
|
Result string `json:"result,optional"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
DisputeListResp {
|
DisputeListResp {
|
||||||
Items []Dispute `json:"items"`
|
Items []Dispute `json:"items"`
|
||||||
Meta PageMeta `json:"meta"`
|
Meta PageMeta `json:"meta"`
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateDisputeReq {
|
CreateDisputeReq {
|
||||||
PathId
|
PathId
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
Evidence []string `json:"evidence"`
|
Evidence []string `json:"evidence"`
|
||||||
}
|
}
|
||||||
|
|
||||||
DisputeResponseReq {
|
DisputeResponseReq {
|
||||||
PathId
|
PathId
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
Evidence []string `json:"evidence"`
|
Evidence []string `json:"evidence"`
|
||||||
}
|
}
|
||||||
|
|
||||||
AppealReq {
|
AppealReq {
|
||||||
PathId
|
PathId
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
import "common.api"
|
import "common.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -14,7 +15,6 @@ type (
|
|||||||
Link string `json:"link,optional"`
|
Link string `json:"link,optional"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationListResp {
|
NotificationListResp {
|
||||||
Items []Notification `json:"items"`
|
Items []Notification `json:"items"`
|
||||||
Meta PageMeta `json:"meta"`
|
Meta PageMeta `json:"meta"`
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,5 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
import "common.api"
|
import "common.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -12,12 +13,10 @@ type (
|
|||||||
Sealed bool `json:"sealed"`
|
Sealed bool `json:"sealed"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ReviewListResp {
|
ReviewListResp {
|
||||||
Items []Review `json:"items"`
|
Items []Review `json:"items"`
|
||||||
Meta PageMeta `json:"meta"`
|
Meta PageMeta `json:"meta"`
|
||||||
}
|
}
|
||||||
|
|
||||||
SubmitReviewReq {
|
SubmitReviewReq {
|
||||||
Rating int `json:"rating"`
|
Rating int `json:"rating"`
|
||||||
Content string `json:"content,optional"`
|
Content string `json:"content,optional"`
|
||||||
|
|||||||
+1
-4
@@ -1,4 +1,5 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
import "common.api"
|
import "common.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -13,23 +14,19 @@ type (
|
|||||||
OnlyOnline bool `form:"onlyOnline,optional"`
|
OnlyOnline bool `form:"onlyOnline,optional"`
|
||||||
Sort string `form:"sort,optional"`
|
Sort string `form:"sort,optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchResp {
|
SearchResp {
|
||||||
Items []interface{} `json:"items"` // Mixed items
|
Items []interface{} `json:"items"` // Mixed items
|
||||||
Meta PageMeta `json:"meta"`
|
Meta PageMeta `json:"meta"`
|
||||||
}
|
}
|
||||||
|
|
||||||
FavoriteReq {
|
FavoriteReq {
|
||||||
TargetType string `json:"targetType"` // player, shop
|
TargetType string `json:"targetType"` // player, shop
|
||||||
TargetId int64 `json:"targetId"`
|
TargetId int64 `json:"targetId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
FavoriteCheckReq {
|
FavoriteCheckReq {
|
||||||
PathIDReq
|
PathIDReq
|
||||||
TargetType string `form:"targetType"`
|
TargetType string `form:"targetType"`
|
||||||
TargetId int64 `form:"targetId"`
|
TargetId int64 `form:"targetId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
FavoriteCheckResp {
|
FavoriteCheckResp {
|
||||||
Favorited bool `json:"favorited"`
|
Favorited bool `json:"favorited"`
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-15
@@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
option go_package ="./pb";
|
|
||||||
|
|
||||||
package pb;
|
package pb;
|
||||||
|
|
||||||
|
option go_package = "./pb";
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Messages
|
// Messages
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
@@ -39,15 +39,13 @@ message UpdateChatSessionsReq {
|
|||||||
optional int64 lastMessageAt = 4; //lastMessageAt
|
optional int64 lastMessageAt = 4; //lastMessageAt
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateChatSessionsResp {
|
message UpdateChatSessionsResp {}
|
||||||
}
|
|
||||||
|
|
||||||
message DelChatSessionsReq {
|
message DelChatSessionsReq {
|
||||||
int64 id = 1; //id
|
int64 id = 1; //id
|
||||||
}
|
}
|
||||||
|
|
||||||
message DelChatSessionsResp {
|
message DelChatSessionsResp {}
|
||||||
}
|
|
||||||
|
|
||||||
message GetChatSessionsByIdReq {
|
message GetChatSessionsByIdReq {
|
||||||
int64 id = 1; //id
|
int64 id = 1; //id
|
||||||
@@ -73,16 +71,14 @@ message AddParticipantReq {
|
|||||||
int64 userId = 2; //userId
|
int64 userId = 2; //userId
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddParticipantResp {
|
message AddParticipantResp {}
|
||||||
}
|
|
||||||
|
|
||||||
message RemoveParticipantReq {
|
message RemoveParticipantReq {
|
||||||
int64 sessionId = 1; //sessionId
|
int64 sessionId = 1; //sessionId
|
||||||
int64 userId = 2; //userId
|
int64 userId = 2; //userId
|
||||||
}
|
}
|
||||||
|
|
||||||
message RemoveParticipantResp {
|
message RemoveParticipantResp {}
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------chatMessages--------------------------------
|
//--------------------------------chatMessages--------------------------------
|
||||||
message ChatMessages {
|
message ChatMessages {
|
||||||
@@ -109,8 +105,7 @@ message DelChatMessagesReq {
|
|||||||
int64 id = 1; //id
|
int64 id = 1; //id
|
||||||
}
|
}
|
||||||
|
|
||||||
message DelChatMessagesResp {
|
message DelChatMessagesResp {}
|
||||||
}
|
|
||||||
|
|
||||||
message GetChatMessagesByIdReq {
|
message GetChatMessagesByIdReq {
|
||||||
int64 id = 1; //id
|
int64 id = 1; //id
|
||||||
@@ -131,13 +126,11 @@ message SearchChatMessagesResp {
|
|||||||
repeated ChatMessages chatMessages = 1; //chatMessages
|
repeated ChatMessages chatMessages = 1; //chatMessages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Rpc Func
|
// Rpc Func
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
|
||||||
service chatService {
|
service chatService {
|
||||||
|
|
||||||
//-----------------------chatSessions-----------------------
|
//-----------------------chatSessions-----------------------
|
||||||
rpc AddChatSessions(AddChatSessionsReq) returns (AddChatSessionsResp);
|
rpc AddChatSessions(AddChatSessionsReq) returns (AddChatSessionsResp);
|
||||||
rpc UpdateChatSessions(UpdateChatSessionsReq) returns (UpdateChatSessionsResp);
|
rpc UpdateChatSessions(UpdateChatSessionsReq) returns (UpdateChatSessionsResp);
|
||||||
@@ -151,5 +144,4 @@ service chatService{
|
|||||||
rpc DelChatMessages(DelChatMessagesReq) returns (DelChatMessagesResp);
|
rpc DelChatMessages(DelChatMessagesReq) returns (DelChatMessagesResp);
|
||||||
rpc GetChatMessagesById(GetChatMessagesByIdReq) returns (GetChatMessagesByIdResp);
|
rpc GetChatMessagesById(GetChatMessagesByIdReq) returns (GetChatMessagesByIdResp);
|
||||||
rpc SearchChatMessages(SearchChatMessagesReq) returns (SearchChatMessagesResp);
|
rpc SearchChatMessages(SearchChatMessagesReq) returns (SearchChatMessagesResp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user