//SPDX-FileCopyrightText: 2024 Yury Gubich //SPDX-License-Identifier: GPL-3.0-or-later #include "asset.h" DB::Asset::Asset (): id(0), owner(0), currency(0), title(), icon(), color(0), archived(false) {} DB::Asset::Asset (const std::vector& vec): id(std::any_cast(vec[0])), owner(std::any_cast(vec[1])), currency(std::any_cast(vec[2])), title(std::any_cast(vec[3])), icon(std::any_cast(vec[4])), color(std::any_cast(vec[5])), archived(std::any_cast(vec[6])) {} void DB::Asset::parse (const std::vector& vec) { id = std::any_cast(vec[0]); owner = std::any_cast(vec[1]); currency = std::any_cast(vec[2]); title = std::any_cast(vec[3]); icon = std::any_cast(vec[4]); color = std::any_cast(vec[5]); archived = std::any_cast(vec[6]); } nlohmann::json DB::Asset::toJSON () const { nlohmann::json result = nlohmann::json::object(); result["id"] = id; //result["owner"] = owner; result["currency"] = currency; result["title"] = title; result["icon"] = icon; result["color"] = color; result["archived"] = archived; return result; }