🚀 Launch tech preview
This commit is contained in:
parent
56af8688f6
commit
ec1cf74207
@ -16,6 +16,7 @@ type Channel struct {
|
|||||||
Members []ChannelMember `json:"members"`
|
Members []ChannelMember `json:"members"`
|
||||||
Messages []Message `json:"messages"`
|
Messages []Message `json:"messages"`
|
||||||
Type ChannelType `json:"type"`
|
Type ChannelType `json:"type"`
|
||||||
|
Account Account `json:"account"`
|
||||||
AccountID uint `json:"account_id"`
|
AccountID uint `json:"account_id"`
|
||||||
RealmID uint `json:"realm_id"`
|
RealmID uint `json:"realm_id"`
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ func ListMessage(channel models.Channel, take int, offset int) ([]models.Message
|
|||||||
ChannelID: channel.ID,
|
ChannelID: channel.ID,
|
||||||
}).Limit(take).Offset(offset).
|
}).Limit(take).Offset(offset).
|
||||||
Order("created_at DESC").
|
Order("created_at DESC").
|
||||||
|
Preload("Attachments").
|
||||||
Preload("Sender").
|
Preload("Sender").
|
||||||
Preload("Sender.Account").
|
Preload("Sender.Account").
|
||||||
Find(&messages).Error; err != nil {
|
Find(&messages).Error; err != nil {
|
||||||
@ -42,7 +43,9 @@ func GetMessage(channel models.Channel, id uint) (models.Message, error) {
|
|||||||
Where(models.Message{
|
Where(models.Message{
|
||||||
BaseModel: models.BaseModel{ID: id},
|
BaseModel: models.BaseModel{ID: id},
|
||||||
ChannelID: channel.ID,
|
ChannelID: channel.ID,
|
||||||
}).Preload("Sender").
|
}).
|
||||||
|
Preload("Attachments").
|
||||||
|
Preload("Sender").
|
||||||
Preload("Sender.Account").
|
Preload("Sender.Account").
|
||||||
First(&message).Error; err != nil {
|
First(&message).Error; err != nil {
|
||||||
return message, err
|
return message, err
|
||||||
|
Loading…
Reference in New Issue
Block a user