-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatabasecontroller.h
62 lines (46 loc) · 2.05 KB
/
databasecontroller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef DATABASECONTROLLER_H
#define DATABASECONTROLLER_H
#include <QObject>
#include <QtSql>
#include "model/project.h"
#include "model/product.h"
#include "model/user.h"
#include "model/moneycode.h"
#include "QDjango/db/QDjango.h"
#include "QDjango/db/QDjangoQuerySet.h"
#include "model/genericmodel.h"
class DatabaseController : public QObject{
Q_OBJECT
public:
DatabaseController();
void dbTestFill();
bool newProject();
bool shutdownProject(Project project); // sends all MOS users their redeem code again, set valid_until to hide the project (if not set)
bool finishProject(Project project); // payout the money & email MOS users, success!, set valid_until to hide the project (if not set)
bool newProduct(Project project);
bool deleteProduct(Product product); // generate moneycodes and/or send updates
bool newUser(QString email);
bool addMoneycode(User user); //generates and adds a moneycode to a user
bool sendMoneycode(User user); //sends an email about all the open moneycode for this user
bool redeemMoneycode(User user, QString code); //payout that moneycode
QDjangoQuerySet<Project> listProjects(bool active);
QDjangoQuerySet<Project> listProjects(QDateTime from, QDateTime to);
QDjangoQuerySet<Project> listProjects(Product product);
QDjangoQuerySet<Product> listProducts(); // QList<Product*> test function, .. making this work.. damnit
QDjangoQuerySet<Product> listProducts(Project project);
QDjangoQuerySet<Product> listProducts(int min_price, int max_price);
QDjangoQuerySet<Product> listProducts(Project project, int min_price, int max_price);
//GenericModel<Product> listProductsFoo(Project p, int min_price, int max_price);
bool buyProduct(Product p);
//
// allen usern fuer abgelaufenes projekt nen gutschrift code ausstellen und per mail schicken
// gutscheincode erneut senden lassen. (neu generieren).
// gutschrift code einloesen.
//
//
public slots:
void dbTestCleanup();
private:
QSqlDatabase m_db;
};
#endif // DATABASECONTROLLER_H