Merge pull request #15 from gwinn/master

add prouct & order messages structs
This commit is contained in:
Alex Lushpai 2018-09-12 11:35:57 +03:00 committed by GitHub
commit 55b0a617b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,29 +308,31 @@ type (
// Single entity types // Single entity types
type ( type (
Message struct { Message struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
Time string `json:"time"` Time string `json:"time"`
Type string `json:"type"` Type string `json:"type"`
ChatID uint64 `json:"chat_id"` Scope string `json:"scope"`
IsRead bool `json:"is_read"` ChatID uint64 `json:"chat_id"`
Status string `json:"status"` IsRead bool `json:"is_read"`
TextMessage IsEdit bool `json:"is_edit"`
SystemMessage Status string `json:"status"`
From *UserRef `json:"from"`
Product *MessageProduct `json:"product,omitempty"`
Order *MessageOrder `json:"order,omitempty"`
*TextMessage
*SystemMessage
} }
TextMessage struct { TextMessage struct {
Scope string `json:"scope"` Content string `json:"content"`
Content string `json:"content"` Quote *QuoteMessage `json:"quote"`
From UserRef `json:"from"` Actions []string `json:"actions"`
Quote QuoteMessage `json:"quote"`
IsEdit bool `json:"is_edit"`
Actions []string `json:"actions"`
} }
SystemMessage struct { SystemMessage struct {
Action string `json:"action"` Action string `json:"action"`
Dialog SystemMessageDialog `json:"dialog,omitempty"` Dialog *SystemMessageDialog `json:"dialog,omitempty"`
User UserRef `json:"user,omitempty"` User *UserRef `json:"user,omitempty"`
} }
SystemMessageDialog struct { SystemMessageDialog struct {
@ -338,19 +340,61 @@ type (
} }
QuoteMessage struct { QuoteMessage struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
Content string `json:"content"` Content string `json:"content"`
Time string `json:"time"` Time string `json:"time"`
From UserRef `json:"from"` From *UserRef `json:"from"`
}
MessageProduct struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Article string `json:"article,omitempty"`
Url string `json:"url,omitempty"`
Img string `json:"img,omitempty"`
Cost *MessageOrderCost `json:"cost,omitempty"`
Quantity *MessageOrderQuantity `json:"quantity,omitempty"`
}
MessageOrder struct {
Number string `json:"number"`
Url string `json:"url,omitempty"`
Date string `json:"date,omitempty"`
Cost *MessageOrderCost `json:"cost,omitempty"`
Status *MessageOrderStatus `json:"status,omitempty"`
Items []MessageOrderItem `json:"items,omitempty"`
}
MessageOrderStatus struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
}
MessageOrderItem struct {
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
Quantity string `json:"quantity,omitempty"`
Price string `json:"price,omitempty"`
}
MessageOrderCost struct {
Value float32 `json:"value,omitempty"`
Currency string `json:"currency"`
}
MessageOrderQuantity struct {
Value float32 `json:"value"`
Unit string `json:"unit"`
} }
UserRef struct { UserRef struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
Avatar string `json:"avatar"` Avatar string `json:"avatar"`
Type string `json:"type"` Type string `json:"type"`
Name string `json:"name"` FirstName string `json:"first_name,omitempty"`
Phone string `json:"phone,omitempty"` LastName string `json:"last_name,omitempty"`
Email string `json:"email,omitempty"` Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
} }
Channel struct { Channel struct {