some little refactor, deleting assets
This commit is contained in:
parent
7a116bfdf2
commit
5c4bd18cdc
21 changed files with 139 additions and 36 deletions
|
@ -10,6 +10,7 @@ set(HEADERS
|
|||
poll.h
|
||||
listassets.h
|
||||
addasset.h
|
||||
deleteasset.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
|
@ -21,6 +22,7 @@ set(SOURCES
|
|||
poll.cpp
|
||||
listassets.cpp
|
||||
addasset.cpp
|
||||
deleteasset.cpp
|
||||
)
|
||||
|
||||
target_sources(magpie PRIVATE ${SOURCES})
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
#include "addasset.h"
|
||||
|
||||
Request::AddAsset::AddAsset (const QString& title, const QString& icon, const QColor& color, unsigned int currency, const QUrl& baseUrl):
|
||||
Post(createUrl(baseUrl, "/addAsset"), {{"title", title}, {"icon", icon}, {"currency", std::to_string(currency).c_str()}, {"color", "0"}})
|
||||
Post(createUrl(baseUrl, "/addAsset"), {
|
||||
{"title", title},
|
||||
{"icon", icon},
|
||||
{"currency", std::to_string(currency).c_str()},
|
||||
{"color", std::to_string(color.rgba()).c_str()}
|
||||
})
|
||||
{
|
||||
emptyResult = true;
|
||||
}
|
||||
|
|
12
API/requests/deleteasset.cpp
Normal file
12
API/requests/deleteasset.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
||||
//SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "deleteasset.h"
|
||||
|
||||
Request::DeleteAsset::DeleteAsset(unsigned int id, const QUrl &baseUrl):
|
||||
Post(createUrl(baseUrl, "/deleteAsset"), {
|
||||
{"id", std::to_string(id).c_str()}
|
||||
})
|
||||
{
|
||||
emptyResult = true;
|
||||
}
|
20
API/requests/deleteasset.h
Normal file
20
API/requests/deleteasset.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
||||
//SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "post.h"
|
||||
|
||||
namespace Request {
|
||||
|
||||
class DeleteAsset : public Post {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeleteAsset(unsigned int id, const QUrl& baseUrl);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "listassets.h"
|
||||
|
||||
#include "API/helpers.h"
|
||||
#include "utils/helpers.h"
|
||||
|
||||
Request::ListAssets::ListAssets (const QUrl& baseUrl):
|
||||
Request(createUrl(baseUrl, "/listAssets")) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue