Skip to content

Commit

Permalink
V2022.10.0-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Oct 29, 2022
1 parent c5cab35 commit f6d8a5a
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 3 deletions.
2 changes: 1 addition & 1 deletion org.nickvision.money.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{
"type": "git",
"url": "https://github.com/nlogozzo/NickvisionMoney.git",
"tag": "2022.10.0-next"
"tag": "2022.10.0-beta1"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion org.nickvision.money.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<binary>org.nickvision.money</binary>
</provides>
<releases>
<release version="2022.10.0-next" date="2022-10-01">
<release version="2022.10.0-beta1" date="2022-10-28">
<description>
<p>- Redesign with GTK4 and libadwaita 1.2</p>
</description>
Expand Down
62 changes: 62 additions & 0 deletions src/models/account.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,81 @@

namespace NickvisionMoney::Models
{
/**
* A model of an account
*/
class Account
{
public:
/**
* Constructs an account
*
* @param path The path to the account file on disk
*/
Account(const std::string& path);
/**
* Gets the path of the account
*
* @returns The path of the account
*/
const std::string& getPath() const;
/**
* Gets a map of transactions in the account
*
* @returns The map of transaction in the account
*/
const std::map<unsigned int, Transaction>& getTransactions() const;
/**
* Attempts to get a transaction from the account by id
*
* @param id The id of the transaction
* @returns The transaction if found, else std::nullopt
*/
std::optional<Transaction> getTransactionById(unsigned int id) const;
/**
* Gets the next available id in the account
*
* @returns The next available id in the account
*/
unsigned int getNextAvailableId() const;
/**
* Adds a transaction to the account
*
* @param transaction The transaction to add
* @returns True if successful, else false
*/
bool addTransaction(const Transaction& transaction);
/**
* Updates a transaction in the account
*
* @param transaction The transaction to update
* @returns True if successful, else false
*/
bool updateTransaction(const Transaction& transaction);
/**
* Deletes a transaction in the account
*
* @param id The id of the transaction to delete
* @returns True if successful, else false
*/
bool deleteTransaction(unsigned int id);
/**
* Gets the income amount of the account
*
* @returns The income amount of the account
*/
boost::multiprecision::cpp_dec_float_50 getIncome() const;
/**
* Gets the expense amount of the account
*
* @returns The expense amount of the account
*/
boost::multiprecision::cpp_dec_float_50 getExpense() const;
/**
* Gets the total amount of the account
*
* @returns The total amount of the account
*/
boost::multiprecision::cpp_dec_float_50 getTotal() const;

private:
Expand Down
93 changes: 93 additions & 0 deletions src/models/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@

namespace NickvisionMoney::Models
{
/**
* Types of a transaction
*/
enum class TransactionType
{
Income = 0,
Expense
};

/**
* Repeat intervals of a transaction
*/
enum class RepeatInterval
{
Never = 0,
Expand All @@ -23,24 +29,111 @@ namespace NickvisionMoney::Models
Biyearly
};

/**
* A model of a transaction
*/
class Transaction
{
public:
/**
* Constructs a Transaction
*
* @param id The id of the transaction
*/
Transaction(unsigned int id = 0);
/**
* Gets the id of the transaction
*
* @returns The id of the transaction
*/
unsigned int getId() const;
/**
* Gets the date of the transaction
*
* @returns The date of the transaction
*/
const boost::gregorian::date& getDate() const;
/**
* Sets the date of the transaction
*
* @param date The new date
*/
void setDate(const boost::gregorian::date& date);
/**
* Gets the description of the transaction
*
* @returns The description of the transaction
*/
const std::string& getDescription() const;
/**
* Sets the description of the transaction
*
* @param description The new description
*/
void setDescription(const std::string& description);
/**
* Gets the type of the transaction
*
* @returns The type of the transaction
*/
TransactionType getType() const;
/**
* Sets the type of the transaction
*
* @param type The new type
*/
void setType(TransactionType type);
/**
* Gets the repeat interval of the transaction
*
* @returns The repeat interval of the transaction
*/
RepeatInterval getRepeatInterval() const;
/**
* Sets the repeat interval of the transaction
*
* @param repeatInterval The new repeat interval
*/
void setRepeatInterval(RepeatInterval repeatInterval);
/**
* Gets the amount of the transaction
*
* @returns The amount of the transaction
*/
boost::multiprecision::cpp_dec_float_50 getAmount() const;
/**
* Sets the amount of the transaction
*
* @param amount The new amount
*/
void setAmount(boost::multiprecision::cpp_dec_float_50 amount);
/**
* Compares two Transactions via less-than
*
* @param toComapre The transaction to compare
* @returns True if this transaction < toCompare, else false
*/
bool operator<(const Transaction& toCompare) const;
/**
* Compares two Transactions via greater-than
*
* @param toComapre The transaction to compare
* @returns True if this transaction > toCompare, else false
*/
bool operator>(const Transaction& toCompare) const;
/**
* Compares two Transactions via equals
*
* @param toComapre The transaction to compare
* @returns True if this transaction == toCompare, else false
*/
bool operator==(const Transaction& toCompare) const;
/**
* Compares two Transactions via not equals
*
* @param toComapre The transaction to compare
* @returns True if this transaction != toCompare, else false
*/
bool operator!=(const Transaction& toCompare) const;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/ui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Application::Application(const std::string& id, GApplicationFlags flags) : m_adw
m_appInfo.setName("Nickvision Money");
m_appInfo.setShortName("Money");
m_appInfo.setDescription("A personal finance manager.");
m_appInfo.setVersion("2022.10.0-next");
m_appInfo.setVersion("2022.10.0-beta1");
m_appInfo.setChangelog("<ul><li>Redesign with GTK4 and libadwaita 1.2</li></ul>");
m_appInfo.setGitHubRepo("https://github.com/nlogozzo/NickvisionMoney");
m_appInfo.setIssueTracker("https://github.com/nlogozzo/NickvisionMoney/issues/new");
Expand Down

0 comments on commit f6d8a5a

Please sign in to comment.