Merge branch 'main-merge-base-a'
# Conflicts: # deploy/dev/docker-compose.yml # deploy/dev/envoy.yaml # desc/api/dispute.api # desc/api/review.api # desc/api/search.api
This commit is contained in:
+27
-13
@@ -3,34 +3,48 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathId {
|
||||
DisputePathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Dispute {
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
Reason string `json:"reason"`
|
||||
Status string `json:"status"`
|
||||
Evidence []string `json:"evidence"`
|
||||
Result string `json:"result,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
InitiatorId int64 `json:"initiatorId"`
|
||||
InitiatorName string `json:"initiatorName"`
|
||||
RespondentId int64 `json:"respondentId"`
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
Status string `json:"status"`
|
||||
Result string `json:"result,optional"`
|
||||
RespondentReason string `json:"respondentReason,optional"`
|
||||
RespondentEvidence []string `json:"respondentEvidence"`
|
||||
AppealReason string `json:"appealReason,optional"`
|
||||
AppealedAt string `json:"appealedAt,optional"`
|
||||
ResolvedBy int64 `json:"resolvedBy,optional"`
|
||||
ResolvedAt string `json:"resolvedAt,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
DisputeListReq {
|
||||
PageReq
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
DisputeListResp {
|
||||
Items []Dispute `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
CreateDisputeReq {
|
||||
PathId
|
||||
DisputePathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
DisputeResponseReq {
|
||||
PathId
|
||||
DisputePathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
AppealReq {
|
||||
PathId
|
||||
DisputePathId
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
)
|
||||
@@ -42,11 +56,11 @@ type (
|
||||
service dispute-api {
|
||||
@doc "获取争议列表"
|
||||
@handler ListDisputes
|
||||
get /disputes (PageReq) returns (DisputeListResp)
|
||||
get /disputes (DisputeListReq) returns (DisputeListResp)
|
||||
|
||||
@doc "获取订单争议"
|
||||
@handler GetOrderDispute
|
||||
get /orders/:id/dispute (PathId) returns (Dispute)
|
||||
get /orders/:id/dispute (DisputePathId) returns (Dispute)
|
||||
|
||||
@doc "发起争议"
|
||||
@handler CreateDispute
|
||||
|
||||
+13
-2
@@ -3,6 +3,9 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
ReviewPathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Review {
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
@@ -18,9 +21,17 @@ type (
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
SubmitReviewReq {
|
||||
ReviewPathId
|
||||
Rating int `json:"rating"`
|
||||
Content string `json:"content,optional"`
|
||||
}
|
||||
GetOrderReviewsReq {
|
||||
ReviewPathId
|
||||
}
|
||||
ListUserReviewsReq {
|
||||
ReviewPathId
|
||||
PageReq
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
@@ -34,7 +45,7 @@ service review-api {
|
||||
|
||||
@doc "获取订单评价"
|
||||
@handler GetOrderReviews
|
||||
get /orders/:id/reviews (EmptyResp) returns ([]Review)
|
||||
get /orders/:id/reviews (GetOrderReviewsReq) returns (ReviewListResp)
|
||||
}
|
||||
|
||||
@server (
|
||||
@@ -48,5 +59,5 @@ service review-api {
|
||||
|
||||
@doc "获取用户收到的评价"
|
||||
@handler ListUserReviews
|
||||
get /users/:id/reviews (PageReq) returns (ReviewListResp)
|
||||
get /users/:id/reviews (ListUserReviewsReq) returns (ReviewListResp)
|
||||
}
|
||||
|
||||
+15
-4
@@ -8,7 +8,7 @@ type (
|
||||
}
|
||||
SearchReq {
|
||||
PageReq
|
||||
Q string `form:"q"`
|
||||
Q string `form:"q,optional"`
|
||||
MinPrice float64 `form:"min,optional"`
|
||||
MaxPrice float64 `form:"max,optional"`
|
||||
OnlyOnline bool `form:"onlyOnline,optional"`
|
||||
@@ -18,14 +18,25 @@ type (
|
||||
Items []interface{} `json:"items"` // Mixed items
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
Favorite {
|
||||
Id string `json:"id"`
|
||||
UserId string `json:"userId"`
|
||||
TargetType string `json:"targetType"`
|
||||
TargetId string `json:"targetId"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
FavoriteListResp {
|
||||
Items []Favorite `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
FavoriteReq {
|
||||
TargetType string `json:"targetType"` // player, shop
|
||||
TargetId int64 `json:"targetId"`
|
||||
TargetId string `json:"targetId"`
|
||||
}
|
||||
FavoriteCheckReq {
|
||||
PathIDReq
|
||||
TargetType string `form:"targetType"`
|
||||
TargetId int64 `form:"targetId"`
|
||||
TargetId string `form:"targetId"`
|
||||
}
|
||||
FavoriteCheckResp {
|
||||
Favorited bool `json:"favorited"`
|
||||
@@ -53,7 +64,7 @@ service search-api {
|
||||
service search-api {
|
||||
@doc "获取收藏列表"
|
||||
@handler ListFavorites
|
||||
get /favorites (PageReq) returns (SearchResp)
|
||||
get /favorites (PageReq) returns (FavoriteListResp)
|
||||
|
||||
@doc "添加收藏"
|
||||
@handler AddFavorite
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------disputes--------------------------------
|
||||
message Disputes {
|
||||
int64 id = 1;
|
||||
int64 orderId = 2;
|
||||
int64 initiatorId = 3;
|
||||
string initiatorName = 4;
|
||||
int64 respondentId = 5;
|
||||
string reason = 6;
|
||||
repeated string evidence = 7;
|
||||
string status = 8;
|
||||
string result = 9;
|
||||
string respondentReason = 10;
|
||||
repeated string respondentEvidence = 11;
|
||||
string appealReason = 12;
|
||||
int64 appealedAt = 13;
|
||||
int64 resolvedBy = 14;
|
||||
int64 resolvedAt = 15;
|
||||
int64 createdAt = 16;
|
||||
int64 updatedAt = 17;
|
||||
}
|
||||
|
||||
message AddDisputesReq {
|
||||
int64 orderId = 1;
|
||||
int64 initiatorId = 2;
|
||||
string initiatorName = 3;
|
||||
int64 respondentId = 4;
|
||||
string reason = 5;
|
||||
repeated string evidence = 6;
|
||||
string status = 7;
|
||||
}
|
||||
|
||||
message AddDisputesResp {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message UpdateDisputesReq {
|
||||
int64 id = 1;
|
||||
optional string status = 2;
|
||||
optional string result = 3;
|
||||
optional string respondentReason = 4;
|
||||
repeated string respondentEvidence = 5;
|
||||
optional string appealReason = 6;
|
||||
optional int64 appealedAt = 7;
|
||||
optional int64 resolvedBy = 8;
|
||||
optional int64 resolvedAt = 9;
|
||||
}
|
||||
|
||||
message UpdateDisputesResp {
|
||||
}
|
||||
|
||||
message DelDisputesReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message DelDisputesResp {
|
||||
}
|
||||
|
||||
message GetDisputesByIdReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message GetDisputesByIdResp {
|
||||
Disputes disputes = 1;
|
||||
}
|
||||
|
||||
message SearchDisputesReq {
|
||||
int64 offset = 1;
|
||||
int64 limit = 2;
|
||||
optional int64 id = 3;
|
||||
optional int64 orderId = 4;
|
||||
optional int64 initiatorId = 5;
|
||||
optional int64 respondentId = 6;
|
||||
optional string status = 7;
|
||||
}
|
||||
|
||||
message SearchDisputesResp {
|
||||
repeated Disputes disputes = 1;
|
||||
}
|
||||
|
||||
//--------------------------------disputeTimeline--------------------------------
|
||||
message DisputeTimeline {
|
||||
int64 id = 1;
|
||||
int64 disputeId = 2;
|
||||
string eventType = 3;
|
||||
int64 actorId = 4;
|
||||
string actorName = 5;
|
||||
string details = 6;
|
||||
int64 createdAt = 7;
|
||||
}
|
||||
|
||||
message AddDisputeTimelineReq {
|
||||
int64 disputeId = 1;
|
||||
string eventType = 2;
|
||||
int64 actorId = 3;
|
||||
string actorName = 4;
|
||||
string details = 5;
|
||||
}
|
||||
|
||||
message AddDisputeTimelineResp {
|
||||
}
|
||||
|
||||
message SearchDisputeTimelineReq {
|
||||
int64 offset = 1;
|
||||
int64 limit = 2;
|
||||
optional int64 disputeId = 3;
|
||||
}
|
||||
|
||||
message SearchDisputeTimelineResp {
|
||||
repeated DisputeTimeline timeline = 1;
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service disputeService {
|
||||
//-----------------------disputes-----------------------
|
||||
rpc AddDisputes(AddDisputesReq) returns (AddDisputesResp);
|
||||
rpc UpdateDisputes(UpdateDisputesReq) returns (UpdateDisputesResp);
|
||||
rpc DelDisputes(DelDisputesReq) returns (DelDisputesResp);
|
||||
rpc GetDisputesById(GetDisputesByIdReq) returns (GetDisputesByIdResp);
|
||||
rpc SearchDisputes(SearchDisputesReq) returns (SearchDisputesResp);
|
||||
|
||||
//-----------------------disputeTimeline-----------------------
|
||||
rpc AddDisputeTimeline(AddDisputeTimelineReq) returns (AddDisputeTimelineResp);
|
||||
rpc SearchDisputeTimeline(SearchDisputeTimelineReq) returns (SearchDisputeTimelineResp);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------notifications--------------------------------
|
||||
message Notifications {
|
||||
int64 id = 1;
|
||||
int64 userId = 2;
|
||||
string type = 3;
|
||||
string title = 4;
|
||||
string content = 5;
|
||||
bool read = 6;
|
||||
string link = 7;
|
||||
int64 createdAt = 8;
|
||||
int64 updatedAt = 9;
|
||||
}
|
||||
|
||||
message AddNotificationsReq {
|
||||
int64 userId = 1;
|
||||
string type = 2;
|
||||
string title = 3;
|
||||
string content = 4;
|
||||
optional string link = 5;
|
||||
}
|
||||
|
||||
message AddNotificationsResp {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message UpdateNotificationsReq {
|
||||
int64 id = 1;
|
||||
optional bool read = 2;
|
||||
optional string type = 3;
|
||||
optional string title = 4;
|
||||
optional string content = 5;
|
||||
optional string link = 6;
|
||||
optional int64 updatedAt = 7;
|
||||
}
|
||||
|
||||
message UpdateNotificationsResp {
|
||||
}
|
||||
|
||||
message DelNotificationsReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message DelNotificationsResp {
|
||||
}
|
||||
|
||||
message GetNotificationsByIdReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message GetNotificationsByIdResp {
|
||||
Notifications notifications = 1;
|
||||
}
|
||||
|
||||
message SearchNotificationsReq {
|
||||
int64 offset = 1;
|
||||
int64 limit = 2;
|
||||
optional int64 id = 3;
|
||||
optional int64 userId = 4;
|
||||
optional string type = 5;
|
||||
optional bool read = 6;
|
||||
}
|
||||
|
||||
message SearchNotificationsResp {
|
||||
repeated Notifications notifications = 1;
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service notificationService {
|
||||
rpc AddNotifications(AddNotificationsReq) returns (AddNotificationsResp);
|
||||
rpc UpdateNotifications(UpdateNotificationsReq) returns (UpdateNotificationsResp);
|
||||
rpc DelNotifications(DelNotificationsReq) returns (DelNotificationsResp);
|
||||
rpc GetNotificationsById(GetNotificationsByIdReq) returns (GetNotificationsByIdResp);
|
||||
rpc SearchNotifications(SearchNotificationsReq) returns (SearchNotificationsResp);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------reviews--------------------------------
|
||||
message Reviews {
|
||||
int64 id = 1; //id
|
||||
int64 orderId = 2; //orderId
|
||||
int64 fromUserId = 3; //fromUserId
|
||||
string fromUserName = 4; //fromUserName
|
||||
string fromUserAvatar = 5; //fromUserAvatar
|
||||
int64 toUserId = 6; //toUserId
|
||||
int32 rating = 7; //rating
|
||||
string content = 8; //content
|
||||
bool sealed = 9; //sealed
|
||||
int64 createdAt = 10; //createdAt
|
||||
int64 unsealedAt = 11; //unsealedAt
|
||||
}
|
||||
|
||||
message AddReviewsReq {
|
||||
int64 orderId = 1; //orderId
|
||||
int64 fromUserId = 2; //fromUserId
|
||||
string fromUserName = 3; //fromUserName
|
||||
string fromUserAvatar = 4; //fromUserAvatar
|
||||
int64 toUserId = 5; //toUserId
|
||||
int32 rating = 6; //rating
|
||||
string content = 7; //content
|
||||
bool sealed = 8; //sealed
|
||||
int64 createdAt = 9; //createdAt
|
||||
}
|
||||
|
||||
message AddReviewsResp {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message UpdateReviewsReq {
|
||||
int64 id = 1; //id
|
||||
optional int64 orderId = 2; //orderId
|
||||
optional int64 fromUserId = 3; //fromUserId
|
||||
optional string fromUserName = 4; //fromUserName
|
||||
optional string fromUserAvatar = 5; //fromUserAvatar
|
||||
optional int64 toUserId = 6; //toUserId
|
||||
optional int32 rating = 7; //rating
|
||||
optional string content = 8; //content
|
||||
optional bool sealed = 9; //sealed
|
||||
optional int64 createdAt = 10; //createdAt
|
||||
optional int64 unsealedAt = 11; //unsealedAt
|
||||
}
|
||||
|
||||
message UpdateReviewsResp {
|
||||
}
|
||||
|
||||
message DelReviewsReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelReviewsResp {
|
||||
}
|
||||
|
||||
message GetReviewsByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetReviewsByIdResp {
|
||||
Reviews reviews = 1; //reviews
|
||||
}
|
||||
|
||||
message SearchReviewsReq {
|
||||
int64 offset = 1; //offset
|
||||
int64 limit = 2; //limit
|
||||
optional int64 id = 3; //id
|
||||
optional int64 orderId = 4; //orderId
|
||||
optional int64 fromUserId = 5; //fromUserId
|
||||
optional int64 toUserId = 6; //toUserId
|
||||
optional bool sealed = 7; //sealed
|
||||
}
|
||||
|
||||
message SearchReviewsResp {
|
||||
repeated Reviews reviews = 1; //reviews
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service reviewService {
|
||||
//-----------------------reviews-----------------------
|
||||
rpc AddReviews(AddReviewsReq) returns (AddReviewsResp);
|
||||
rpc UpdateReviews(UpdateReviewsReq) returns (UpdateReviewsResp);
|
||||
rpc DelReviews(DelReviewsReq) returns (DelReviewsResp);
|
||||
rpc GetReviewsById(GetReviewsByIdReq) returns (GetReviewsByIdResp);
|
||||
rpc SearchReviews(SearchReviewsReq) returns (SearchReviewsResp);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------favorites--------------------------------
|
||||
message Favorites {
|
||||
int64 id = 1;
|
||||
int64 userId = 2;
|
||||
string targetType = 3;
|
||||
int64 targetId = 4;
|
||||
int64 createdAt = 5;
|
||||
}
|
||||
|
||||
message AddFavoritesReq {
|
||||
int64 userId = 1;
|
||||
string targetType = 2;
|
||||
int64 targetId = 3;
|
||||
}
|
||||
|
||||
message AddFavoritesResp {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message DelFavoritesReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message DelFavoritesResp {
|
||||
}
|
||||
|
||||
message GetFavoritesByIdReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message GetFavoritesByIdResp {
|
||||
Favorites favorites = 1;
|
||||
}
|
||||
|
||||
message SearchFavoritesReq {
|
||||
int64 offset = 1;
|
||||
int64 limit = 2;
|
||||
optional int64 id = 3;
|
||||
optional int64 userId = 4;
|
||||
optional string targetType = 5;
|
||||
optional int64 targetId = 6;
|
||||
}
|
||||
|
||||
message SearchFavoritesResp {
|
||||
repeated Favorites favorites = 1;
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service searchService {
|
||||
rpc AddFavorites(AddFavoritesReq) returns (AddFavoritesResp);
|
||||
rpc DelFavorites(DelFavoritesReq) returns (DelFavoritesResp);
|
||||
rpc GetFavoritesById(GetFavoritesByIdReq) returns (GetFavoritesByIdResp);
|
||||
rpc SearchFavorites(SearchFavoritesReq) returns (SearchFavoritesResp);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
CREATE TABLE notifications
|
||||
(
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
type VARCHAR(20) NOT NULL,
|
||||
title VARCHAR(200) NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
read BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
link VARCHAR(500),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
|
||||
CONSTRAINT chk_notification_type CHECK (type IN ('order', 'community', 'system'))
|
||||
);
|
||||
|
||||
CREATE INDEX idx_notifications_user_created ON notifications (user_id, created_at DESC);
|
||||
CREATE INDEX idx_notifications_user_read_created ON notifications (user_id, read, created_at DESC);
|
||||
CREATE INDEX idx_notifications_user_type_created ON notifications (user_id, type, created_at DESC);
|
||||
|
||||
CREATE TRIGGER trigger_notifications_updated_at
|
||||
BEFORE UPDATE
|
||||
ON notifications
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_updated_at_column();
|
||||
Reference in New Issue
Block a user