mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Make sure golint pass on the code base
This commit is contained in:
parent
8781648af9
commit
bb8e61c7c5
59 changed files with 322 additions and 171 deletions
|
@ -6,6 +6,7 @@ package api
|
|||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/miniflux/miniflux2/server/api/payload"
|
||||
"github.com/miniflux/miniflux2/server/core"
|
||||
)
|
||||
|
@ -65,7 +66,7 @@ func (c *Controller) UpdateCategory(ctx *core.Context, request *core.Request, re
|
|||
|
||||
// GetCategories is the API handler to get a list of categories for a given user.
|
||||
func (c *Controller) GetCategories(ctx *core.Context, request *core.Request, response *core.Response) {
|
||||
categories, err := c.store.GetCategories(ctx.UserID())
|
||||
categories, err := c.store.Categories(ctx.UserID())
|
||||
if err != nil {
|
||||
response.JSON().ServerError(errors.New("Unable to fetch categories"))
|
||||
return
|
||||
|
|
|
@ -66,7 +66,7 @@ func (c *Controller) UpdateFeed(ctx *core.Context, request *core.Request, respon
|
|||
return
|
||||
}
|
||||
|
||||
originalFeed, err := c.store.GetFeedById(userID, feedID)
|
||||
originalFeed, err := c.store.FeedByID(userID, feedID)
|
||||
if err != nil {
|
||||
response.JSON().NotFound(errors.New("Unable to find this feed"))
|
||||
return
|
||||
|
@ -88,7 +88,7 @@ func (c *Controller) UpdateFeed(ctx *core.Context, request *core.Request, respon
|
|||
|
||||
// GetFeeds is the API handler that get all feeds that belongs to the given user.
|
||||
func (c *Controller) GetFeeds(ctx *core.Context, request *core.Request, response *core.Response) {
|
||||
feeds, err := c.store.GetFeeds(ctx.UserID())
|
||||
feeds, err := c.store.Feeds(ctx.UserID())
|
||||
if err != nil {
|
||||
response.JSON().ServerError(errors.New("Unable to fetch feeds from the database"))
|
||||
return
|
||||
|
@ -106,7 +106,7 @@ func (c *Controller) GetFeed(ctx *core.Context, request *core.Request, response
|
|||
return
|
||||
}
|
||||
|
||||
feed, err := c.store.GetFeedById(userID, feedID)
|
||||
feed, err := c.store.FeedByID(userID, feedID)
|
||||
if err != nil {
|
||||
response.JSON().ServerError(errors.New("Unable to fetch this feed"))
|
||||
return
|
||||
|
|
|
@ -6,6 +6,7 @@ package api
|
|||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/miniflux/miniflux2/server/api/payload"
|
||||
"github.com/miniflux/miniflux2/server/core"
|
||||
)
|
||||
|
@ -67,7 +68,7 @@ func (c *Controller) UpdateUser(ctx *core.Context, request *core.Request, respon
|
|||
return
|
||||
}
|
||||
|
||||
originalUser, err := c.store.GetUserById(userID)
|
||||
originalUser, err := c.store.UserByID(userID)
|
||||
if err != nil {
|
||||
response.JSON().BadRequest(errors.New("Unable to fetch this user from the database"))
|
||||
return
|
||||
|
@ -94,7 +95,7 @@ func (c *Controller) GetUsers(ctx *core.Context, request *core.Request, response
|
|||
return
|
||||
}
|
||||
|
||||
users, err := c.store.GetUsers()
|
||||
users, err := c.store.Users()
|
||||
if err != nil {
|
||||
response.JSON().ServerError(errors.New("Unable to fetch the list of users"))
|
||||
return
|
||||
|
@ -116,7 +117,7 @@ func (c *Controller) GetUser(ctx *core.Context, request *core.Request, response
|
|||
return
|
||||
}
|
||||
|
||||
user, err := c.store.GetUserById(userID)
|
||||
user, err := c.store.UserByID(userID)
|
||||
if err != nil {
|
||||
response.JSON().BadRequest(errors.New("Unable to fetch this user from the database"))
|
||||
return
|
||||
|
@ -143,7 +144,7 @@ func (c *Controller) RemoveUser(ctx *core.Context, request *core.Request, respon
|
|||
return
|
||||
}
|
||||
|
||||
user, err := c.store.GetUserById(userID)
|
||||
user, err := c.store.UserByID(userID)
|
||||
if err != nil {
|
||||
response.JSON().ServerError(errors.New("Unable to fetch this user from the database"))
|
||||
return
|
||||
|
|
|
@ -12,11 +12,13 @@ import (
|
|||
"github.com/miniflux/miniflux2/model"
|
||||
)
|
||||
|
||||
// EntriesResponse represents the response sent when fetching entries.
|
||||
type EntriesResponse struct {
|
||||
Total int `json:"total"`
|
||||
Entries model.Entries `json:"entries"`
|
||||
}
|
||||
|
||||
// DecodeUserPayload unserialize JSON user object.
|
||||
func DecodeUserPayload(data io.Reader) (*model.User, error) {
|
||||
var user model.User
|
||||
|
||||
|
@ -28,6 +30,7 @@ func DecodeUserPayload(data io.Reader) (*model.User, error) {
|
|||
return &user, nil
|
||||
}
|
||||
|
||||
// DecodeURLPayload unserialize JSON subscription object.
|
||||
func DecodeURLPayload(data io.Reader) (string, error) {
|
||||
type payload struct {
|
||||
URL string `json:"url"`
|
||||
|
@ -42,6 +45,7 @@ func DecodeURLPayload(data io.Reader) (string, error) {
|
|||
return p.URL, nil
|
||||
}
|
||||
|
||||
// DecodeEntryStatusPayload unserialize JSON entry statuses object.
|
||||
func DecodeEntryStatusPayload(data io.Reader) ([]int64, string, error) {
|
||||
type payload struct {
|
||||
EntryIDs []int64 `json:"entry_ids"`
|
||||
|
@ -57,6 +61,7 @@ func DecodeEntryStatusPayload(data io.Reader) ([]int64, string, error) {
|
|||
return p.EntryIDs, p.Status, nil
|
||||
}
|
||||
|
||||
// DecodeFeedCreationPayload unserialize JSON feed creation object.
|
||||
func DecodeFeedCreationPayload(data io.Reader) (string, int64, error) {
|
||||
type payload struct {
|
||||
FeedURL string `json:"feed_url"`
|
||||
|
@ -72,6 +77,7 @@ func DecodeFeedCreationPayload(data io.Reader) (string, int64, error) {
|
|||
return p.FeedURL, p.CategoryID, nil
|
||||
}
|
||||
|
||||
// DecodeFeedModificationPayload unserialize JSON feed object.
|
||||
func DecodeFeedModificationPayload(data io.Reader) (*model.Feed, error) {
|
||||
var feed model.Feed
|
||||
|
||||
|
@ -83,6 +89,7 @@ func DecodeFeedModificationPayload(data io.Reader) (*model.Feed, error) {
|
|||
return &feed, nil
|
||||
}
|
||||
|
||||
// DecodeCategoryPayload unserialize JSON category object.
|
||||
func DecodeCategoryPayload(data io.Reader) (*model.Category, error) {
|
||||
var category model.Category
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue