Новое начало

This commit is contained in:
2025-03-09 10:13:52 +05:00
parent 11ea3a8cd8
commit 4fbe63701f
11 changed files with 108 additions and 196 deletions

View File

@@ -1,13 +0,0 @@
#pragma db object
class Author {
public:
Author() = default;
Author(const std::string& name) : name(name) {}
const std::string& getName() const { return name; }
private:
#pragma db id auto
int id;
std::string name;
};

View File

@@ -1,22 +0,0 @@
#pragma db object
class Book {
public:
Book() = default;
Book(const std::string& title, const std::string& author, const std::string& filePath,
int fileSize, const std::string& format);
const std::string& getTitle() const { return title; }
const std::string& getAuthor() const { return author; }
const std::string& getFilePath() const { return filePath; }
int getFileSize() const { return fileSize; }
const std::string& getFormat() const { return format; }
private:
#pragma db id auto
int id;
std::string title;
std::string author;
std::string filePath;
int fileSize;
std::string format;
};

View File

@@ -1,13 +0,0 @@
#include "database.h"
#include <odb/sqlite/database.hxx>
#include <odb/schema-catalog.hxx>
#include "book-odb.hxx"
#include "author-odb.hxx"
std::unique_ptr<odb::sqlite::database> initializeDatabase(const std::string& dbPath) {
auto db = std::make_unique<odb::sqlite::database>(dbPath, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
odb::transaction t(db->begin());
odb::schema_catalog::create_schema(*db);
t.commit();
return db;
}

View File

View File

@@ -1,12 +0,0 @@
#include <QCoreApplication>
#include "backend.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Backend backend;
backend.start();
return a.exec();
}