add channel message item info to details (#4092)

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🌻 Feature

#### Issue(s)

* #3989

#### Test Plan

- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Keepers 2023-08-23 11:22:27 -06:00 committed by GitHub
parent af5d98e182
commit 719d6b98cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 6 deletions

View File

@ -1,9 +1,11 @@
package details
import (
"strconv"
"time"
"github.com/alcionai/clues"
"github.com/dustin/go-humanize"
"github.com/alcionai/corso/src/internal/common/dttm"
"github.com/alcionai/corso/src/pkg/path"
@ -47,6 +49,10 @@ type GroupsInfo struct {
// Channels Specific
ChannelName string `json:"channelName,omitempty"`
ChannelID string `json:"channelID,omitempty"`
LastResponseAt time.Time `json:"lastResponseAt,omitempty"`
MessageCreator string `json:"messageCreator,omitempty"`
MessagePreview string `json:"messagePreview,omitempty"`
ReplyCount int `json:"replyCount,omitempty"`
// SharePoint specific
DriveName string `json:"driveName,omitempty"`
@ -58,16 +64,42 @@ type GroupsInfo struct {
// Headers returns the human-readable names of properties in a SharePointInfo
// for printing out to a terminal in a columnar display.
func (i GroupsInfo) Headers() []string {
return []string{"Created", "Modified"}
switch i.ItemType {
case SharePointLibrary:
return []string{"ItemName", "Library", "ParentPath", "Size", "Owner", "Created", "Modified"}
case TeamsChannelMessage:
return []string{"Message", "Channel", "Replies", "Creator", "Created", "Last Response"}
}
return []string{}
}
// Values returns the values matching the Headers list for printing
// out to a terminal in a columnar display.
func (i GroupsInfo) Values() []string {
switch i.ItemType {
case SharePointLibrary:
return []string{
i.ItemName,
i.DriveName,
i.ParentPath,
humanize.Bytes(uint64(i.Size)),
i.Owner,
dttm.FormatToTabularDisplay(i.Created),
dttm.FormatToTabularDisplay(i.Modified),
}
case TeamsChannelMessage:
return []string{
i.MessagePreview,
i.ChannelName,
strconv.Itoa(i.ReplyCount),
i.MessageCreator,
dttm.FormatToTabularDisplay(i.Created),
dttm.FormatToTabularDisplay(i.Modified),
}
}
return []string{}
}
func (i *GroupsInfo) UpdateParentPath(newLocPath *path.Builder) {

View File

@ -37,6 +37,9 @@ const (
// Folder Management(30x)
FolderItem ItemType = 306
// Groups/Teams(40x)
TeamsChannelMessage ItemType = 401
)
func UpdateItem(item *ItemInfo, newLocPath *path.Builder) {