Upload 2 new, 10 modified files from chat-switchboard-v0.7.4.zip

This commit is contained in:
2026-02-21 23:00:58 +00:00
parent 1ec392879b
commit 99dd88f896
10 changed files with 519 additions and 11 deletions

View File

@@ -108,6 +108,7 @@ func (h *ChannelHandler) ListChannels(c *gin.Context) {
archived := c.DefaultQuery("archived", "false")
folder := c.Query("folder")
channelType := c.DefaultQuery("type", "") // empty = all types
search := strings.TrimSpace(c.Query("search"))
// Count total
countQuery := `SELECT COUNT(*) FROM channels WHERE user_id = $1 AND is_archived = $2`
@@ -124,6 +125,11 @@ func (h *ChannelHandler) ListChannels(c *gin.Context) {
countArgs = append(countArgs, folder)
argN++
}
if search != "" {
countQuery += ` AND title ILIKE $` + strconv.Itoa(argN)
countArgs = append(countArgs, "%"+search+"%")
argN++
}
var total int
if err := database.DB.QueryRow(countQuery, countArgs...).Scan(&total); err != nil {
@@ -156,9 +162,13 @@ func (h *ChannelHandler) ListChannels(c *gin.Context) {
args = append(args, folder)
argN++
}
if search != "" {
query += ` AND c.title ILIKE $` + strconv.Itoa(argN)
args = append(args, "%"+search+"%")
argN++
}
query += ` ORDER BY c.is_pinned DESC, c.updated_at DESC
LIMIT $` + strconv.Itoa(argN) + ` OFFSET $` + strconv.Itoa(argN+1)
query += ` ORDER BY c.is_pinned DESC, c.updated_at DESC LIMIT $` + strconv.Itoa(argN) + ` OFFSET $` + strconv.Itoa(argN+1)
args = append(args, perPage, offset)
rows, err := database.DB.Query(query, args...)