mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Move internal packages to an internal folder
For reference: https://go.dev/doc/go1.4#internalpackages
This commit is contained in:
parent
c234903255
commit
168a870c02
433 changed files with 1121 additions and 1123 deletions
|
@ -1,39 +0,0 @@
|
|||
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package validator // import "miniflux.app/v2/validator"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"miniflux.app/v2/model"
|
||||
)
|
||||
|
||||
// ValidateEntriesStatusUpdateRequest validates a status update for a list of entries.
|
||||
func ValidateEntriesStatusUpdateRequest(request *model.EntriesStatusUpdateRequest) error {
|
||||
if len(request.EntryIDs) == 0 {
|
||||
return fmt.Errorf(`The list of entries cannot be empty`)
|
||||
}
|
||||
|
||||
return ValidateEntryStatus(request.Status)
|
||||
}
|
||||
|
||||
// ValidateEntryStatus makes sure the entry status is valid.
|
||||
func ValidateEntryStatus(status string) error {
|
||||
switch status {
|
||||
case model.EntryStatusRead, model.EntryStatusUnread, model.EntryStatusRemoved:
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf(`Invalid entry status, valid status values are: "%s", "%s" and "%s"`, model.EntryStatusRead, model.EntryStatusUnread, model.EntryStatusRemoved)
|
||||
}
|
||||
|
||||
// ValidateEntryOrder makes sure the sorting order is valid.
|
||||
func ValidateEntryOrder(order string) error {
|
||||
switch order {
|
||||
case "id", "status", "changed_at", "published_at", "created_at", "category_title", "category_id", "title", "author":
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf(`Invalid entry order, valid order values are: "id", "status", "changed_at", "published_at", "created_at", "category_title", "category_id", "title", "author"`)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue