Skip to content

Commit

Permalink
Bumping deps with all the breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Aug 7, 2023
1 parent a9c73d8 commit 2fce154
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 53 deletions.
4 changes: 2 additions & 2 deletions cli/cascade.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Cascade() error {

props := []string{data.TitleProperty, data.BookCompletedProperty, data.MyBooksIdsProperty, data.MyBooksOrderProperty}

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil, props...)
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), props...)
if err != nil {
return ca.EndWithError(err)
}
Expand Down Expand Up @@ -48,7 +48,7 @@ func Cascade() error {
mboa := nod.NewProgress(" " + data.MyBooksOrderProperty)
defer mboa.End()

myBooksIds, _ := rxa.GetAllUnchangedValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
myBooksIds, _ := rxa.GetAllValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
mboa.TotalInt(len(myBooksIds))

order := make(map[string][]string)
Expand Down
2 changes: 1 addition & 1 deletion cli/complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func Complete(ids []string, action string) error {
ca := nod.NewProgress("%s complete...", action)
defer ca.End()

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil, data.TitleProperty, data.BookCompletedProperty)
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), data.TitleProperty, data.BookCompletedProperty)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion cli/dehydrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func Dehydrate(idSet map[string]bool, all, overwrite bool) error {

rxa, err := kvas.ConnectReduxAssets(
data.AbsReduxDir(),
nil,
data.DehydratedListImageProperty,
data.DehydratedListImageModifiedProperty,
data.DehydratedItemImageProperty,
Expand Down
8 changes: 4 additions & 4 deletions cli/download_litres.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func DownloadLitRes(ids []string, hc *http.Client) error {
da := nod.NewProgress("downloading LitRes books...")
defer da.End()

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil,
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(),
data.MyBooksIdsProperty,
data.TitleProperty,
data.AuthorsProperty,
Expand All @@ -65,7 +65,7 @@ func DownloadLitRes(ids []string, hc *http.Client) error {

if ids == nil {
var ok bool
ids, ok = rxa.GetAllUnchangedValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
ids, ok = rxa.GetAllValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
if !ok {
err = errors.New("no my books found")
return da.EndWithError(err)
Expand All @@ -84,9 +84,9 @@ func DownloadLitRes(ids []string, hc *http.Client) error {
}

title, _ := rxa.GetFirstVal(data.TitleProperty, id)
authors, _ := rxa.GetAllUnchangedValues(data.AuthorsProperty, id)
authors, _ := rxa.GetAllValues(data.AuthorsProperty, id)

dls, ok := rxa.GetAllUnchangedValues(data.DownloadLinksProperty, id)
dls, ok := rxa.GetAllValues(data.DownloadLinksProperty, id)
if !ok {
nod.Log("book %s is missing download links", id)
continue
Expand Down
2 changes: 1 addition & 1 deletion cli/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Export(ids []string) error {
ea := nod.Begin("exporting books...")
defer ea.End()

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil, data.ReduxProperties()...)
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), data.ReduxProperties()...)
if err != nil {
return ea.EndWithError(err)
}
Expand Down
4 changes: 2 additions & 2 deletions cli/get_litres_covers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func GetLitResCovers(ids []string, forceImported bool) error {
gca := nod.NewProgress("fetching LitRes covers...")
defer gca.End()

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil,
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(),
data.MyBooksIdsProperty,
data.ImportedProperty)
if err != nil {
Expand All @@ -35,7 +35,7 @@ func GetLitResCovers(ids []string, forceImported bool) error {

if len(ids) == 0 {
var ok bool
ids, ok = rxa.GetAllUnchangedValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
ids, ok = rxa.GetAllValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
if !ok {
err = errors.New("no my books found")
return gca.EndWithError(err)
Expand Down
2 changes: 1 addition & 1 deletion cli/get_litres_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func GetLitResDetails(ids []string, hc *http.Client, newOnly, noThrottle bool) e
gmbda := nod.NewProgress("getting LitRes my books details...")
defer gmbda.End()

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil,
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(),
data.MyBooksIdsProperty,
data.HrefProperty,
data.ImportedProperty)
Expand Down
2 changes: 1 addition & 1 deletion cli/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Import() error {
ia := nod.Begin("importing books...")
defer ia.End()

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil, data.ReduxProperties()...)
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), data.ReduxProperties()...)
if err != nil {
return ia.EndWithError(err)
}
Expand Down
4 changes: 2 additions & 2 deletions cli/reduce_litres_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func ReduceLitResBooksDetails(scoreData bool) error {

missingDetails := make([]string, 0)

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil, reduxProps...)
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), reduxProps...)
if err != nil {
return rmbda.EndWithError(err)
}
Expand Down Expand Up @@ -70,7 +70,7 @@ func ReduceLitResBooksDetails(scoreData bool) error {
if scoreData {
for lp, vals := range lrdx {
if p, ok := data.LitResPropertyMap[lp]; ok {
if evs, ok := rxa.GetAllUnchangedValues(p, id); ok {
if evs, ok := rxa.GetAllValues(p, id); ok {
dataScore[id] = len(vals) - len(evs)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/reduce_litres_my_books.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func ReduceLitResMyBooks() error {
}
}

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil,
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(),
data.MyBooksIdsProperty,
data.HrefProperty,
data.ImportedProperty)
Expand Down
2 changes: 1 addition & 1 deletion cli/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func Sync(completionWebhookUrl string, newOnly, noThrottle bool) error {
return err
}

rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), nil, data.SyncCompletedProperty)
rxa, err := kvas.ConnectReduxAssets(data.AbsReduxDir(), data.SyncCompletedProperty)
if err != nil {
return err
}
Expand Down
2 changes: 0 additions & 2 deletions data/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const (
BookCompletedProperty = "book-completed"
ImageProperty = "image"
LanguageProperty = "language"
// aggregate
AnyTextProperty = "any-text"
// sorting
SortProperty = "sort"
DescendingProperty = "desc"
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ require (
github.com/beauxarts/scrinium v0.1.16
github.com/boggydigital/clo v0.3.6
github.com/boggydigital/coost v0.3.8
github.com/boggydigital/dolo v0.2.10
github.com/boggydigital/kvas v0.3.27
github.com/boggydigital/dolo v0.2.11
github.com/boggydigital/kvas v0.3.28
github.com/boggydigital/match_node v0.1.11
github.com/boggydigital/middleware v0.1.7
github.com/boggydigital/nod v0.1.21
github.com/boggydigital/stencil v0.1.88
github.com/boggydigital/stencil v0.1.91
github.com/boggydigital/wits v0.2.3
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691
golang.org/x/net v0.12.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/boggydigital/dolo v0.2.5 h1:Ux0JNW4U1L2QLII013ajhnbPC96NGNV/wo2ka9F30
github.com/boggydigital/dolo v0.2.5/go.mod h1:KyIaQOp2cV85hC6lTMRwHtzofzjxXr+msOgcs89t078=
github.com/boggydigital/dolo v0.2.10 h1:QNv4DTF/hvzXXBs6UkFBEVf80KF6xKnbqfDEBvwzoGM=
github.com/boggydigital/dolo v0.2.10/go.mod h1:KyIaQOp2cV85hC6lTMRwHtzofzjxXr+msOgcs89t078=
github.com/boggydigital/dolo v0.2.11 h1:L/VotXRJbuV7VN7H+eW4HQinYZHzUCeUOQ01++MFsPE=
github.com/boggydigital/dolo v0.2.11/go.mod h1:KyIaQOp2cV85hC6lTMRwHtzofzjxXr+msOgcs89t078=
github.com/boggydigital/issa v0.1.5 h1:3thLinhaXNHYcmF3T5y3wOEvhxq+GyhW8WtNDcl0OC0=
github.com/boggydigital/issa v0.1.5/go.mod h1:evu3blQmQe6xJy9NRFJGIU+91IWy4/YCROVvUZi5k14=
github.com/boggydigital/issa v0.1.6 h1:XpsnIwAxeHh4VNXkNqB+dO4g9xXFfbP3onWETbS7ARg=
Expand All @@ -24,6 +26,8 @@ github.com/boggydigital/issa v0.1.9 h1:Na0WO1gdF6wKGnoNXADBINLlUultOHY9x2F3qVSjk
github.com/boggydigital/issa v0.1.9/go.mod h1:TNYZ7A1mx+Ib7/o4nGQ/G9QLm3JPKV2xP8qBy+DA+ck=
github.com/boggydigital/kvas v0.3.27 h1:9Oczfp5GFkAsZqLyiIsEp/0cCVfTXA6V6/3MEAw+zyw=
github.com/boggydigital/kvas v0.3.27/go.mod h1:I+wVKLxOqWhzw0X8nez/ec/GVXcQY5GUksFJBx+G7Yc=
github.com/boggydigital/kvas v0.3.28 h1:BfWdJwzbqLMOHrqdCSSgB3nIHEX4xRkH/5fHyyeNrj4=
github.com/boggydigital/kvas v0.3.28/go.mod h1:I+wVKLxOqWhzw0X8nez/ec/GVXcQY5GUksFJBx+G7Yc=
github.com/boggydigital/match_node v0.1.11 h1:Uxm5tlrDAXGeHDf8EMVpyazZ5UHzRS0DUkN65HfsEDs=
github.com/boggydigital/match_node v0.1.11/go.mod h1:LmKtZy8YgBYC14BStAS4g17MglrLqqUF6dehrBX7Zwc=
github.com/boggydigital/middleware v0.1.7 h1:BOgctgkbtPkWoIBgHYOuOwdQnpZYa0NrB0gpP66IHwE=
Expand Down Expand Up @@ -78,6 +82,8 @@ github.com/boggydigital/stencil v0.1.84 h1:g52gncZ1/ebn1o6Tfx360LCEHQwjvSOa4ZUdS
github.com/boggydigital/stencil v0.1.84/go.mod h1:yUJAeXbGWxnbWWqPnRgbctYXf3YPA5bfh48igehwpss=
github.com/boggydigital/stencil v0.1.88 h1:lnHr0tyHrFjheIV82MijOMKC532sHhUWsWd9+7CRjKo=
github.com/boggydigital/stencil v0.1.88/go.mod h1:yUJAeXbGWxnbWWqPnRgbctYXf3YPA5bfh48igehwpss=
github.com/boggydigital/stencil v0.1.91 h1:QZNwHmSnK6Pnhc2kp1dJ59TeD3QnctL9Cu2//EVTjig=
github.com/boggydigital/stencil v0.1.91/go.mod h1:qmu+FvjF8kq0/eGGiVu4huCTS2D9i40rQhjXHcGNOtw=
github.com/boggydigital/testo v0.1.7 h1:Sa5GIAwCyQNeGGXi8XgVpIpLQqWVeqBKQRcv0gkL098=
github.com/boggydigital/wits v0.2.3 h1:Z0eB+QlIA18fJmblyV6ZJQ/swPYSFhOxfgMXOQz4/c8=
github.com/boggydigital/wits v0.2.3/go.mod h1:aR/z0vfMLtg0b4hcts0qiSTZcA51O8A2N3U9laqd2Lc=
Expand Down
4 changes: 2 additions & 2 deletions rest/get_books.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func GetBooks(w http.ResponseWriter, r *http.Request) {
return
}

myBooks, ok := rxa.GetAllUnchangedValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
myBooks, ok := rxa.GetAllValues(data.MyBooksIdsProperty, data.MyBooksIdsProperty)
if !ok {
http.Error(w, nod.ErrorStr("no my books found"), http.StatusInternalServerError)
return
}

if missingDetails, ok := rxa.GetAllUnchangedValues(data.MissingDetailsIdsProperty, data.MissingDetailsIdsProperty); ok {
if missingDetails, ok := rxa.GetAllValues(data.MissingDetailsIdsProperty, data.MissingDetailsIdsProperty); ok {
filteredBooks := make([]string, 0, len(myBooks))
for _, id := range myBooks {
if slices.Contains(missingDetails, id) {
Expand Down
24 changes: 17 additions & 7 deletions rest/get_digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rest
import (
"encoding/json"
"github.com/beauxarts/fedorov/data"
"github.com/beauxarts/fedorov/stencil_app"
"github.com/boggydigital/nod"
"net/http"
)
Expand All @@ -16,27 +17,36 @@ func GetDigest(w http.ResponseWriter, r *http.Request) {
return
}

var digests map[string][]string
var values []string
valueTitles := make(map[string]string)

switch property {
case data.SortProperty:
digests = map[string][]string{data.SortProperty: {
values = []string{
data.TitleProperty,
data.DateCreatedProperty,
data.DateTranslatedProperty,
data.DateReleasedProperty,
data.MyBooksOrderProperty}}
data.MyBooksOrderProperty}
case data.DescendingProperty:
digests = map[string][]string{data.DescendingProperty: {
values = []string{
"true",
"false"}}
"false"}
default:
digests = getDigests(property)
values = getDigests(property)[property]
}

for _, v := range values {
if title, ok := stencil_app.PropertyTitles[v]; ok {
valueTitles[v] = title
} else {
valueTitles[v] = v
}
}

DefaultHeaders(w)

if err := json.NewEncoder(w).Encode(digests[property]); err != nil {
if err := json.NewEncoder(w).Encode(valueTitles); err != nil {
http.Error(w, nod.Error(err).Error(), http.StatusInternalServerError)
return
}
Expand Down
4 changes: 2 additions & 2 deletions rest/get_downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func GetDownloads(w http.ResponseWriter, r *http.Request) {
return
}

links, ok := rxa.GetAllUnchangedValues(data.DownloadLinksProperty, idstr)
titles, _ := rxa.GetAllUnchangedValues(data.DownloadTitlesProperty, idstr)
links, ok := rxa.GetAllValues(data.DownloadLinksProperty, idstr)
titles, _ := rxa.GetAllValues(data.DownloadTitlesProperty, idstr)

if !ok {
http.Error(w, nod.ErrorStr("book has no downloads"), http.StatusInternalServerError)
Expand Down
11 changes: 5 additions & 6 deletions rest/get_local_tags_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/beauxarts/fedorov/data"
"github.com/beauxarts/fedorov/stencil_app"
"github.com/boggydigital/nod"
"golang.org/x/exp/maps"
"net/http"
)

Expand All @@ -14,17 +13,17 @@ func GetLocalTagsEdit(w http.ResponseWriter, r *http.Request) {

id := r.URL.Query().Get("id")

allValues := make(map[string]bool)
allValues := make(map[string]string)
for _, id := range rxa.Keys(data.LocalTagsProperty) {
if values, ok := rxa.GetAllUnchangedValues(data.LocalTagsProperty, id); ok {
if values, ok := rxa.GetAllValues(data.LocalTagsProperty, id); ok {
for _, v := range values {
allValues[v] = true
allValues[v] = v
}
}
}

selectedValues := make(map[string]bool)
if values, ok := rxa.GetAllUnchangedValues(data.LocalTagsProperty, id); ok {
if values, ok := rxa.GetAllValues(data.LocalTagsProperty, id); ok {
for _, v := range values {
selectedValues[v] = true
}
Expand All @@ -39,7 +38,7 @@ func GetLocalTagsEdit(w http.ResponseWriter, r *http.Request) {
true,
"",
selectedValues,
maps.Keys(allValues),
allValues,
true,
"/local-tags/apply",
w); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion rest/get_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func GetSearch(w http.ResponseWriter, r *http.Request) {

if len(query) > 0 {

ids = maps.Keys(rxa.Match(query, true))
ids = maps.Keys(rxa.Match(query, true, true))

if sort := r.URL.Query().Get(data.SortProperty); sort != "" {
desc := r.URL.Query().Get(data.DescendingProperty) == "true"
Expand Down
10 changes: 1 addition & 9 deletions rest/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,8 @@ func InitTemplates(templatesFS fs.FS, stencilAppStyles fs.FS) {

func Init() error {

fbr := &kvas.ReduxFabric{
Aggregates: map[string][]string{
data.AnyTextProperty: data.AnyTextProperties(),
},
Transitives: nil,
Atomics: nil,
}

var err error
if rxa, err = kvas.ConnectReduxAssets(data.AbsReduxDir(), fbr, data.ReduxProperties()...); err != nil {
if rxa, err = kvas.ConnectReduxAssets(data.AbsReduxDir(), data.ReduxProperties()...); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions stencil_app/formatters.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func fmtSequenceNameNumber(id, name string, rxa kvas.ReduxAssets) string {
return name
}

names, _ := rxa.GetAllUnchangedValues(data.SequenceNameProperty, id)
numbers, _ := rxa.GetAllUnchangedValues(data.SequenceNumberProperty, id)
names, _ := rxa.GetAllValues(data.SequenceNameProperty, id)
numbers, _ := rxa.GetAllValues(data.SequenceNumberProperty, id)

for ii, sn := range names {
if sn == name {
Expand Down
6 changes: 5 additions & 1 deletion stencil_app/property_titles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package stencil_app
import "github.com/beauxarts/fedorov/data"

var PropertyTitles = map[string]string{
data.AnyTextProperty: "Любой текст",
data.TitleProperty: "Название",
data.BookTypeProperty: "Тип",
data.BookCompletedProperty: "Прочитано",
Expand Down Expand Up @@ -40,4 +39,9 @@ var PropertyTitles = map[string]string{
// sorting properties
data.SortProperty: "Порядок",
data.DescendingProperty: "По убыванию",
// sorting values
data.MyBooksOrderProperty: "Мои книги",
// Yes/No
"true": "Да",
"false": "Нет",
}
1 change: 0 additions & 1 deletion stencil_app/search_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package stencil_app
import "github.com/beauxarts/fedorov/data"

var SearchProperties = []string{
data.AnyTextProperty,
data.TitleProperty,
data.AuthorsProperty,
data.BookTypeProperty,
Expand Down

0 comments on commit 2fce154

Please sign in to comment.