mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Before model refactoring
This commit is contained in:
parent
b5dc92e3a7
commit
959e5be871
@ -17,7 +17,8 @@ SOURCES += \
|
||||
synchronizer.cpp \
|
||||
settings.cpp \
|
||||
uuid.cpp \
|
||||
dispatcher.cpp
|
||||
dispatcher.cpp \
|
||||
models/change.cpp
|
||||
|
||||
RESOURCES += qml.qrc \
|
||||
database.qrc
|
||||
@ -47,7 +48,8 @@ HEADERS += \
|
||||
settings.h \
|
||||
simpletypes.h \
|
||||
uuid.h \
|
||||
dispatcher.h
|
||||
dispatcher.h \
|
||||
models/change.h
|
||||
|
||||
DISTFILES +=
|
||||
|
||||
|
@ -108,6 +108,10 @@ bool Database::errorCheck(const QSqlQuery& query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Change Database::newChange() const {
|
||||
// return Change(*this);
|
||||
//}
|
||||
|
||||
|
||||
int Database::version() const {
|
||||
if (version_ >= 0) return version_;
|
||||
|
@ -19,6 +19,8 @@ public:
|
||||
QSqlQuery buildSqlQuery(Database::QueryType type, const QString& tableName, const QStringList& fields, const VariantVector& values, const QString& whereCondition = "");
|
||||
bool errorCheck(const QSqlQuery& query);
|
||||
|
||||
//Change newChange() const;
|
||||
|
||||
private:
|
||||
|
||||
QSqlDatabase db_;
|
||||
|
7
QtClient/JoplinQtClient/models/change.cpp
Executable file
7
QtClient/JoplinQtClient/models/change.cpp
Executable file
@ -0,0 +1,7 @@
|
||||
#include "change.h"
|
||||
|
||||
using namespace jop;
|
||||
|
||||
Change::Change(Database &database) {
|
||||
|
||||
}
|
24
QtClient/JoplinQtClient/models/change.h
Executable file
24
QtClient/JoplinQtClient/models/change.h
Executable file
@ -0,0 +1,24 @@
|
||||
#ifndef CHANGE_H
|
||||
#define CHANGE_H
|
||||
|
||||
#include <stable.h>
|
||||
|
||||
#include "database.h"
|
||||
|
||||
namespace jop {
|
||||
|
||||
class Change {
|
||||
|
||||
public:
|
||||
|
||||
Change(Database& database);
|
||||
|
||||
private:
|
||||
|
||||
Database& database_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // CHANGE_H
|
@ -14,6 +14,10 @@ class FoldersController extends ApiController {
|
||||
* @Route("/folders")
|
||||
*/
|
||||
public function allAction(Request $request) {
|
||||
if ($request->isMethod('GET')) {
|
||||
return static::successResponse(Folder::all());
|
||||
}
|
||||
|
||||
if ($request->isMethod('POST')) {
|
||||
$folder = new Folder();
|
||||
$folder->fromPublicArray($request->request->all());
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
function config($name) {
|
||||
$config = array(
|
||||
'baseUrl' => 'http://joplin.local',
|
||||
);
|
||||
if (isset($config[$name])) {
|
||||
return $config[$name];
|
||||
}
|
||||
throw new Exception('Unknown config: ' . $name);
|
||||
}
|
||||
|
||||
function execRequest($method, $path, $query = null, $data = null) {
|
||||
$url = config('baseUrl') . '/' . $path;
|
||||
if ($query) $url .= '?' . http_build_query($query);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
if ($data) curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$output = json_decode($response, true);
|
||||
if ($output === null) {
|
||||
return array('error' => 'Cannot decode JSON', 'body' => $response);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
$session = execRequest('POST', 'session', null, array(
|
||||
'email' => 'laurent@cozic.net',
|
||||
'password' => '12345678',
|
||||
));
|
||||
|
||||
var_dump($session);
|
||||
|
||||
die();
|
Loading…
Reference in New Issue
Block a user