Browse Source

adding

master
Björn 3 years ago
parent
commit
62759e3300
4 changed files with 82 additions and 11 deletions
  1. +14
    -2
      app/Http/Bucket.php
  2. +1
    -3
      app/Http/Home.php
  3. +58
    -0
      app/Http/Note.php
  4. +9
    -6
      public/index.php

+ 14
- 2
app/Http/Bucket.php View File

@ -20,8 +20,20 @@ use Carbon\Carbon;
*/ */
class Bucket extends FlightAbstract class Bucket extends FlightAbstract
{ {
public function indexAction()
public function viewAction($id)
{ {
$this->app->render('bucket', [
'id' => $id
]);
}
public function indexAction($id, $visibilty, $page)
{
$bucketStore = new Bucket();
$publicBuckets = $bucketStore->findBy();
$this->app->json([
'publicBuckets' => $publicBuckets
]);
} }
} }

app/Http/Index.php → app/Http/Home.php View File

@ -22,9 +22,7 @@ class Home extends FlightAbstract
{ {
public function indexAction() public function indexAction()
{ {
$this->app->render('index', [
$this->app->render('home', [
]); ]);
} }

+ 58
- 0
app/Http/Note.php View File

@ -0,0 +1,58 @@
<?php
namespace App\Http;
use Rakit\Validation\Validator;
use App\Flight\FlightAbstract;
use App\Models\Bucket;
use Carbon\Carbon;
/**
*
*
*
*
* @author Björn Hase
* @link https://gitea.tentakelfabrik.de/mITSM/feedback GitHub Repository
*
*
*/
class Note extends FlightAbstract
{
/**
*
* @param integer $id
*
*/
public function viewAction($id)
{
$this->app->render('bucket', [
'id' => $id
]);
}
public function indexAction($bucketId)
{
$noteStore = new Note();
$notes = $noteStore->findBy();
$this->app->json([
'data' => $notes,
'page' => $page
]);
}
public function createAction($bucketId)
{
$result = [
'success' => false
];
$noteStore = new Note();
$this->app->json([
'data' => $notes,
]);
}
}

+ 9
- 6
public/index.php View File

@ -3,13 +3,16 @@
require __DIR__.'/../vendor/autoload.php'; require __DIR__.'/../vendor/autoload.php';
require __DIR__.'/../app/bootstrap.php'; require __DIR__.'/../app/bootstrap.php';
$app->route('GET /', array(new App\Controllers\Index, 'indexAction'));
$app->route('GET /', array(new App\Http\Home, 'homeAction'));
$app->route('GET /api/bucket', array(new App\Controllers\Bucket, 'indexAction'));
$app->route('POST /api/bucket', array(new App\Controllers\Bucket, 'createAction'));
$app->route('POST /api/bucket/[:id]', array(new App\Controllers\Bucket, 'updateAction'));
$app->route('DELETE /api/bucket/[:id]', array(new App\Controllers\Bucket, 'destroyAction'));
$app->route('GET /bucket/@id:[0-9]', array(new App\Http\Bucket, 'viewAction'));
$app->route('GET /bucket/@id:[0-9]', array(new App\Http\Bucket, 'indexAction'));
$app->route('POST /bucket', array(new App\Http\Bucket, 'createAction'));
$app->route('PUT /bucket/@id:[0-9]', array(new App\Http\Bucket, 'updateAction'));
$app->route('DELETE /bucket/@id:[0-9]', array(new App\Http\Bucket, 'destroyAction'));
$app->route('GET /api/note/:bucket_id', array(new App\Controllers\Note, 'indexAction'));
$app->route('POST /note', array(new App\Http\Note, 'createAction'));
$app->route('PUT /note/@id:[0-9]', array(new App\Http\Note, 'updateAction'));
$app->route('DELETE /note/@id:[0-9]', array(new App\Http\Note, 'destroyAction'));
$app->start(); $app->start();

Loading…
Cancel
Save