style: 自动格式化
This commit is contained in:
+20
-3
@@ -26,9 +26,26 @@ PASSWORD = "test1234"
|
||||
|
||||
def psql(sql: str) -> str:
|
||||
r = subprocess.run(
|
||||
["docker", "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,
|
||||
[
|
||||
"docker",
|
||||
"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:
|
||||
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
|
||||
|
||||
|
||||
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 ===")
|
||||
|
||||
s_owner.post(
|
||||
@@ -1206,7 +1208,9 @@ def main():
|
||||
phase2_user(s_user, user_id)
|
||||
|
||||
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(
|
||||
s_consumer,
|
||||
consumer_name,
|
||||
|
||||
+2
-8
@@ -1,20 +1,18 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
SessionIdReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
|
||||
CreateGroupReq {
|
||||
Name string `json:"name"`
|
||||
Participants []int64 `json:"participants,optional"`
|
||||
}
|
||||
|
||||
CreateDMReq {
|
||||
TargetId int64 `json:"targetId"`
|
||||
}
|
||||
|
||||
ChatSession {
|
||||
Id int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
@@ -25,11 +23,9 @@ type (
|
||||
LastMessageAt int64 `json:"lastMessageAt"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
}
|
||||
|
||||
ChatSessionListResp {
|
||||
Items []ChatSession `json:"items"`
|
||||
}
|
||||
|
||||
ChatMessage {
|
||||
Id int64 `json:"id"`
|
||||
SessionId int64 `json:"sessionId"`
|
||||
@@ -38,18 +34,16 @@ type (
|
||||
Content string `json:"content"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
}
|
||||
|
||||
ChatMessageListResp {
|
||||
Items []ChatMessage `json:"items"`
|
||||
}
|
||||
|
||||
ListMessageReq {
|
||||
SessionIdReq
|
||||
PageReq
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1/chat
|
||||
group: chat
|
||||
)
|
||||
|
||||
+1
-5
@@ -1,6 +1,6 @@
|
||||
syntax = "v1"
|
||||
|
||||
info(
|
||||
info (
|
||||
title: "公共定义"
|
||||
desc: "Common structures"
|
||||
author: "Juwan Team"
|
||||
@@ -13,17 +13,14 @@ type (
|
||||
Offset int64 `form:"offset,default=0"`
|
||||
Limit int64 `form:"limit,default=20"`
|
||||
}
|
||||
|
||||
// 分页响应元数据
|
||||
PageMeta {
|
||||
Total int64 `json:"total"`
|
||||
Offset int64 `json:"offset"`
|
||||
Limit int64 `json:"limit"`
|
||||
}
|
||||
|
||||
// 空响应
|
||||
EmptyResp {}
|
||||
|
||||
// 核心用户画像 (被 Auth, Community, Shop 等多个服务引用)
|
||||
UserProfile {
|
||||
Id string `json:"id"`
|
||||
@@ -37,7 +34,6 @@ type (
|
||||
Bio string `json:"bio,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
// 简略用户信息 (用于列表、聊天头像等)
|
||||
SimpleUser {
|
||||
Id string `json:"id"`
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
@@ -14,31 +15,27 @@ type (
|
||||
Result string `json:"result,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
DisputeListResp {
|
||||
Items []Dispute `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
CreateDisputeReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
|
||||
DisputeResponseReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
|
||||
AppealReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: dispute
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
@@ -14,14 +15,13 @@ type (
|
||||
Link string `json:"link,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
NotificationListResp {
|
||||
Items []Notification `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: notification
|
||||
)
|
||||
|
||||
+3
-4
@@ -1,4 +1,5 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
@@ -12,19 +13,17 @@ type (
|
||||
Sealed bool `json:"sealed"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
ReviewListResp {
|
||||
Items []Review `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
SubmitReviewReq {
|
||||
Rating int `json:"rating"`
|
||||
Content string `json:"content,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: review
|
||||
)
|
||||
@@ -38,7 +37,7 @@ service review-api {
|
||||
get /orders/:id/reviews (EmptyResp) returns ([]Review)
|
||||
}
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: review
|
||||
)
|
||||
|
||||
+3
-6
@@ -1,4 +1,5 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
@@ -13,29 +14,25 @@ type (
|
||||
OnlyOnline bool `form:"onlyOnline,optional"`
|
||||
Sort string `form:"sort,optional"`
|
||||
}
|
||||
|
||||
SearchResp {
|
||||
Items []interface{} `json:"items"` // Mixed items
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
FavoriteReq {
|
||||
TargetType string `json:"targetType"` // player, shop
|
||||
TargetId int64 `json:"targetId"`
|
||||
}
|
||||
|
||||
FavoriteCheckReq {
|
||||
PathIDReq
|
||||
TargetType string `form:"targetType"`
|
||||
TargetId int64 `form:"targetId"`
|
||||
}
|
||||
|
||||
FavoriteCheckResp {
|
||||
Favorited bool `json:"favorited"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: search
|
||||
)
|
||||
@@ -49,7 +46,7 @@ service search-api {
|
||||
get /recommendations/home (PageReq) returns (SearchResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: favorites
|
||||
)
|
||||
|
||||
+8
-16
@@ -1,9 +1,9 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
option go_package = "./pb";
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
@@ -39,15 +39,13 @@ message UpdateChatSessionsReq {
|
||||
optional int64 lastMessageAt = 4; //lastMessageAt
|
||||
}
|
||||
|
||||
message UpdateChatSessionsResp {
|
||||
}
|
||||
message UpdateChatSessionsResp {}
|
||||
|
||||
message DelChatSessionsReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelChatSessionsResp {
|
||||
}
|
||||
message DelChatSessionsResp {}
|
||||
|
||||
message GetChatSessionsByIdReq {
|
||||
int64 id = 1; //id
|
||||
@@ -73,16 +71,14 @@ message AddParticipantReq {
|
||||
int64 userId = 2; //userId
|
||||
}
|
||||
|
||||
message AddParticipantResp {
|
||||
}
|
||||
message AddParticipantResp {}
|
||||
|
||||
message RemoveParticipantReq {
|
||||
int64 sessionId = 1; //sessionId
|
||||
int64 userId = 2; //userId
|
||||
}
|
||||
|
||||
message RemoveParticipantResp {
|
||||
}
|
||||
message RemoveParticipantResp {}
|
||||
|
||||
//--------------------------------chatMessages--------------------------------
|
||||
message ChatMessages {
|
||||
@@ -109,8 +105,7 @@ message DelChatMessagesReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelChatMessagesResp {
|
||||
}
|
||||
message DelChatMessagesResp {}
|
||||
|
||||
message GetChatMessagesByIdReq {
|
||||
int64 id = 1; //id
|
||||
@@ -131,13 +126,11 @@ message SearchChatMessagesResp {
|
||||
repeated ChatMessages chatMessages = 1; //chatMessages
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service chatService{
|
||||
|
||||
service chatService {
|
||||
//-----------------------chatSessions-----------------------
|
||||
rpc AddChatSessions(AddChatSessionsReq) returns (AddChatSessionsResp);
|
||||
rpc UpdateChatSessions(UpdateChatSessionsReq) returns (UpdateChatSessionsResp);
|
||||
@@ -151,5 +144,4 @@ service chatService{
|
||||
rpc DelChatMessages(DelChatMessagesReq) returns (DelChatMessagesResp);
|
||||
rpc GetChatMessagesById(GetChatMessagesByIdReq) returns (GetChatMessagesByIdResp);
|
||||
rpc SearchChatMessages(SearchChatMessagesReq) returns (SearchChatMessagesResp);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user