1c9f000576
the number of feeds in the category is currently displayed twice, and a lot less useful than the number of unread items in the category.
33 lines
904 B
Go
33 lines
904 B
Go
// Copyright 2017 Frédéric Guillot. All rights reserved.
|
|
// Use of this source code is governed by the Apache 2.0
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package model // import "miniflux.app/model"
|
|
|
|
import "fmt"
|
|
|
|
// Category represents a feed category.
|
|
type Category struct {
|
|
ID int64 `json:"id"`
|
|
Title string `json:"title"`
|
|
UserID int64 `json:"user_id"`
|
|
FeedCount int `json:"-"`
|
|
TotalUnread int `json:"-"`
|
|
}
|
|
|
|
func (c *Category) String() string {
|
|
return fmt.Sprintf("ID=%d, UserID=%d, Title=%s", c.ID, c.UserID, c.Title)
|
|
}
|
|
|
|
// CategoryRequest represents the request to create or update a category.
|
|
type CategoryRequest struct {
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
// Patch updates category fields.
|
|
func (cr *CategoryRequest) Patch(category *Category) {
|
|
category.Title = cr.Title
|
|
}
|
|
|
|
// Categories represents a list of categories.
|
|
type Categories []*Category
|