-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
177 lines (151 loc) · 2.49 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
package main
import "time"
// Test
const (
UserTypeBidder = 0
UserTypeSeller = 1
UserStatusTest = 0
)
// User table
type User struct {
ID int64
UserType int
Username string
Status int
Balance int64
}
// Product table
type Product struct {
ID int64
UserID int64
ProductName string
ImageURL string
Status int
}
// ProductDetail table
type ProductDetail struct {
Product Product
Auction Auction
HighestBidder User
HighestBid int64
Countdown int64
}
// TimeWindow table
type TimeWindow struct {
ID int64
AuctionID int64
StartTime time.Time
EndTime time.Time
Status int
}
// Auction table
type Auction struct {
ID int64
ProductID int64
WinnerUserID int64
InitialBid int64
HighestBid int64
Multiplier int64
Status int
}
// BidCollection table
type BidCollection struct {
ID int64
UserID int64
AuctionID int64
CurrentBid int64
PaymentID int64
}
// Payment table
type Payment struct {
ID int64
UserID int64
Amount int64
Status int
}
// /get/auction/detail
type (
GetAuctionDetailRequest struct {
ProductID int64
}
GetAuctionDetailResponse struct {
ProductDetail ProductDetail
}
)
// /get/user/info
type (
GetUserInfoRequest struct {
UserID int64
}
GetUserInfoResposne struct {
UserInfo User
}
)
// /get/auction/list
type (
GetAuctionListRequest struct {
UserID int64
SortAsc bool
}
GetAuctionListResponse struct {
ProductDetail []ProductDetail
}
)
// /login
type (
LoginRequest struct {
Username string
Password string
}
LoginResponse struct {
User int
}
)
// /auction/create
type (
CreateAuctionRequest struct {
ProductName string
ProductImageURL string
StartBid int64
Multiplier int64
StartTime time.Time
EndTime time.Time
ShopID string
UserID int64
}
CreateAuctionResponse struct {
ResultStatus ResultStatus
}
)
// /auction/bid
type (
AuctionBidRequest struct {
UserID int64
ProductID int64
Amount int64
}
AuctionBidResponse struct {
ResultStatus ResultStatus
}
)
type (
ResultStatus struct {
Message string
IsSuccess bool
}
)
type (
UpdateScoreboardNSQ struct {
UserID, BidAmount, AuctionID int64
}
)
type (
InsertPaymentAndBidCollectionNSQ struct {
Payment Payment
BidCollection BidCollection
}
)
type FirestoreAuction struct {
ID int64 `firestore:"id,omitempty"`
CurrentBid float64 `firestore:"current_bid,omitempty"`
}