Skip to content

Commit

Permalink
Merge pull request #5 from oxipass/release-v1.1.5
Browse files Browse the repository at this point in the history
Release v1.1.5
  • Loading branch information
aboxis authored Nov 24, 2023
2 parents 0643122 + 37ac1a7 commit ce648df
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 1 deletion.
5 changes: 5 additions & 0 deletions assets/langs/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"tag_internet": "Інтэрнэт",
"tag_banking": "Банкінг",
"tag_crypto": "Крыптавалюта",
"tag_shopping": "Пакупкі",
"tag_documents": "Дакументы",
"tag_messengers": "Месенджэры",
"tag_phones": "Тэлефоны",
"tag_computers": "Кампутары",
"item_bank-account": "Банкаўскі рахунак",
"item_debit-card-visa": "Дэбетавая карта (Visa)",
"item_debit-card-mastercard": "Дэбетавая карта (MasterCard)",
Expand Down
5 changes: 5 additions & 0 deletions assets/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"tag_internet": "Internet",
"tag_banking": "Banking",
"tag_crypto": "Crypto",
"tag_shopping": "Shopping",
"tag_documents": "Documents",
"tag_messengers": "Messengers",
"tag_phones": "Phones",
"tag_computers": "Computers",
"item_bank-account": "Bank Account",
"item_debit-card-visa": "Debit Card (Visa)",
"item_debit-card-mastercard": "Debit Card (MasterCard)",
Expand Down
5 changes: 5 additions & 0 deletions assets/langs/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"tag_internet": "Интернет",
"tag_banking": "Банкинг",
"tag_crypto": "Криптовалюта",
"tag_shopping": "Покупки",
"tag_documents": "Документы",
"tag_messengers": "Мессенджеры",
"tag_phones": "Телефоны",
"tag_computers": "Компьютеры",
"item_bank-account": "Банковский счет",
"item_debit-card-visa": "Дебетовая карта(Visa)",
"item_debit-card-mastercard": "Дебетовая карта (MasterCard)",
Expand Down
19 changes: 19 additions & 0 deletions assets/resources_templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ func TestTagsTemplates(t *testing.T) {
}
}

func TestTagsDuplicates(t *testing.T) {
tagsTemplate, err := GetTagsTemplate()
if err != nil {
t.Error(err)
}
for _, tag := range tagsTemplate.Tags {
tagId2check := tag.ID
duplicates := 0
for _, tag2 := range tagsTemplate.Tags {
if tagId2check == tag2.ID {
duplicates++
}
}
if duplicates > 1 {
t.Error("tag duplicate found for tag id: " + tagId2check)
}
}
}

func TestTagsTemplatesTranslations(tst *testing.T) {
tagsTemplate, err := GetTagsTemplate()
if err != nil {
Expand Down
22 changes: 21 additions & 1 deletion assets/templates/tags.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"updated": "2022-07-16T15:00:00.000Z",
"updated": "2023-11-24T15:00:00.000Z",
"tags": [
{
"id": "tag_internet",
Expand All @@ -12,6 +12,26 @@
{
"id": "tag_crypto",
"color": "#7c0000"
},
{
"id": "tag_shopping",
"color": "#007c00"
},
{
"id": "tag_documents",
"color": "#ffffff"
},
{
"id": "tag_phones",
"color": "#00ff00"
},
{
"id": "tag_computers",
"color": "#0000ff"
},
{
"id": "tag_messengers",
"color": "#aa0000"
}
]
}
1 change: 1 addition & 0 deletions oxi_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func (storage *StorageSingleton) AddNewItem(addItemParams models.UpdateItemForm)
return response, nil
}

// ReadAllItems TODO: Sort items before returning them
// ReadAllItems - read all not deleted items from the db and decrypt them
func (storage *StorageSingleton) ReadAllItems(readTags bool, readDeleted bool) (items []models.OxiItem, err error) {
err = storage.checkReadiness()
Expand Down
25 changes: 25 additions & 0 deletions oxi_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,33 @@ func (storage *StorageSingleton) SaveItemAsTemplate(item models.OxiItem) (err er
return nil
}

func CopyFieldTemplate(fTemplate models.OxiFieldTemplate) (oxiField models.OxiField) {
oxiField.Icon = fTemplate.Icon
oxiField.ValueType = fTemplate.ValueType
oxiField.Name = fTemplate.Name
return oxiField
}

func (storage *StorageSingleton) SaveItemTemplateAsItem(item models.OxiItemTemplate) (err error) {
err = storage.dbObject.StartTX()
if err != nil {
return err
}
itemId, errInsert := storage.dbObject.DbInsertItem(item.Name, item.Icon)
if errInsert != nil {
return err
}

for _, oxiFieldTemplate := range item.Fields {
_, errField := storage.dbObject.DbInsertField(itemId, CopyFieldTemplate(oxiFieldTemplate))
if errField != nil {
return errField
}
}
err = storage.dbObject.CommitTX()
if err != nil {
return err
}
return nil
}

Expand Down

0 comments on commit ce648df

Please sign in to comment.