Compare commits

..

No commits in common. 'a16d9da8b6cac3d46b22f9ebb5c627c35884ba0b' and '19a45791347c0875af69c885fc745f2d90a730bf' have entirely different histories.

@ -1,4 +0,0 @@
{
"/spritemap.js": "/spritemap.js?id=2dda73ecee3bb668b395026efda6524c",
"/public/css/styles.css": "/public/css/styles.css?id=c80a1181f87f3c3ef715844b545559f4"
}

@ -5,7 +5,7 @@
"packages/*" "packages/*"
], ],
"scripts": { "scripts": {
"build": "yarn workspace frontend run build", "build": "yarn workspace server run build",
"start": "yarn workspace server run start" "start": "yarn workspace server run start"
} }
} }

@ -1,9 +1,6 @@
{ {
"name": "frontend", "name": "frontend",
"version": "0.1.0", "version": "0.1.0",
"scripts": {
"build": "npx mix"
},
"dependencies": { "dependencies": {
"@tiny-components/plain-ui": "^0.6.0", "@tiny-components/plain-ui": "^0.6.0",
"riot": "^6.1.2" "riot": "^6.1.2"

@ -1,3 +0,0 @@
@import
'@tiny-components/plain-ui/src/scss/plain-ui';

@ -1,24 +0,0 @@
{{# layout('layout') }}
{{# section('content') { }}
<h1 class="site-header__title">
{{ page.data.title }}
</h1>
<div class="container">
<div class="grid">
<div class="col-12">
<div class="content">
{% if settings.404_message %}
{{ settings.404_message }}
{% endif %}
</div>
</div>
</div>
</div>
{{# endsection }}
{{# push('footer') { }}
{{# } }}

@ -0,0 +1,19 @@
{% layout 'layout.liquid' %}
{% block siteHeader %}
<h1 class="site-header__title">
{ site.404_title }
</h1>
{% endblock %}
{% block siteMain %}
<div class="container">
<div class="grid">
<div class="col-12">
<div class="content">
{ marked.parse(site.404_message) }
</div>
</div>
</div>
</div>
{% endblock %}

@ -1,43 +0,0 @@
<!doctype html>
<html lang="{{ it.settings.data.default_language }}">
<head>
<meta charset="utf-8">
<title>
{{ it.page.data.title }} | {{ it.settings.data.project_name }}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{ asset('/public/css/styles.css') }}" rel="stylesheet" type="text/css">
</head>
<body class="site-body {{ it.templateClass(it.page) }}">
<header class="site-header">
<div class="bar">
<div class="bar__start">
{{# if (isHome(it.page)) { }}
<h1 class="site-header__title">
{{ it.page.data.title }}
</h1>
{{# } else { }}
<a class="site-header__title">
{{ it.page.data.title }}
</a>
{{# } }}
</div>
</div>
</header>
<main class="site-main">
{{! it.body }}
</main>
<footer class="site-footer">
<div class="site-footer__copyright">
</div>
</footer>
</body>
</html>

@ -0,0 +1,46 @@
<!doctype html>
<html lang="en_EN">
<head>
<meta charset="utf-8">
<title>
{{ page.data.title }}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/css/styles.css" rel="stylesheet" type="text/css">
{% block head %}{% endblock %}
</head>
<body class="site-body page-{ siteClass(page) (page.data.slug) ? slug : 'home' }">
<header class="site-header">
{% block siteHeader %}
<h1 class="site-header__title">
{{ page.data.title }}
{{ options.data.title }}
</h1>
{% endblock %}
</header>
<main class="site-main">
{% block siteMain %}
{% endblock %}
</main>
<footer class="site-footer">
{% block siteFooter %}
<div class="">
</div>
{% endblock %}
<div class="site-footer__copyright">
</div>
</footer>
{% block script %}{% endblock %}
</body>
</html>

@ -1,14 +0,0 @@
{{# layout('layout') }}
{{# const store = await it.injectStore('post') }}
{{# const posts = await store.find() }}
{{# if (posts.data && posts.data.length > 0) { }}
{{# posts.data.forEach((post) => { }}
{{ post.title }}
<img src="{{ it.mediaUrl(post.teaser_media.id, { 'width': 500 }) }}" />
{{! it.marked.parse(post.teaser_content) }}
{{# }) }}
{{# } else { }}
{{# } }}

@ -1,11 +1,13 @@
{{# layout('layout') }} {% layout 'layout.liquid' %}
{% block siteMain %}
<div class="container"> <div class="container">
<div class="grid"> <div class="grid">
<div class="col-12"> <div class="col-12">
<div class="content"> <div class="content">
{{! it.parseMarkdown(it.page.data.content) }} { marked.parse(page.data.content) }
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %}

@ -1,11 +1,13 @@
{{# layout('layout') }} {% layout 'layout.liquid' %}
{% block siteMain %}
<div class="container"> <div class="container">
<div class="grid"> <div class="grid">
<div class="col-12"> <div class="col-12">
<div class="content"> <div class="content">
{{! it.marked.parse(it.page.data.content) }} {{ page.data.content }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %}

@ -1,84 +0,0 @@
const mix = require('laravel-mix')
const path = require('path')
require('laravel-mix-purgecss')
// plugins
const SvgSpritemapPlugin = require('svg-spritemap-webpack-plugin')
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel applications. By default, we are compiling the CSS
| file for the application as well as bundling up all the JS files.
|
*/
mix.webpackConfig({
module: {
rules: [{
test: /\.riot$/,
use: [{
loader: '@riotjs/webpack-loader',
options: {
hot: false
}
}]
}
]},
plugins: [
new SvgSpritemapPlugin([
'./node_modules/@tiny-components/plain-ui/src/icons/mono-icons/svg/*.svg',
'./icons/*.svg'
], {
output: {
filename: 'public/symbol-defs.svg',
chunk: {
keep: true
},
svgo: {
plugins: [{
name: 'convertStyleToAttrs',
active: true
},{
name: 'removeStyleElement',
active: true
}, {
name: 'removeAttrs',
params: {
attrs: 'fill'
}
}]
}
},
sprite: {
prefix: 'icon-'
}
})
]
})
mix
.setPublicPath('../../public')
//.js('js/app.js', 'public/js')
.sass('scss/styles.scss', 'css')
.purgeCss({
extend: {
content: [
path.join(__dirname, 'js/**/*.riot'),
path.join(__dirname, 'views/*.liquid')
]
}
})
.options({
terser: {
extractComments: false,
},
processCssUrls: false
})
.copyDirectory('node_modules/@tiny-components/plain-ui/src/fonts/**', '../../public/css')
.version()

@ -15,56 +15,37 @@ const server = fastify()
* *
*/ */
import * as Eta from 'eta' import { Liquid } from 'liquidjs'
import view from '@fastify/view' import view from '@fastify/view'
import { asset, templateClass, isHome, injectStore, mediaUrl } from './helpers/eta.js'
import { marked } from 'marked' const engine = new Liquid({
root: path.join(path.resolve(), '/../frontend/views'),
extname: '.liquid',
})
server.register(view, { server.register(view, {
engine: { engine: {
eta: Eta liquid: engine
},
root: path.join(path.resolve(), '/../frontend/views'),
extname: '.eta',
// adding function to templates
defaultContext: {
asset: asset,
templateClass: templateClass,
isHome: isHome,
injectStore: injectStore,
marked: marked,
mediaUrl: mediaUrl
},
options: {
tags: [ '{{', '}}' ],
includeViewExtension: true,
parse: {
exec: "#",
interpolate: "",
raw: "!"
},
useWith: true,
async: true
} }
}) })
/** /**
* adding preHandler * adding preHandler
* *
* *
*/ */
import SettingsStore from './stores/settings.js' import SettingsStore from './stores/Settings.js'
// getting options from directus add to all views // getting options from directus add to all views
server.addHook('preHandler', async function (request, response) { server.addHook('preHandler', async function (request, response) {
const settingsStore = new SettingsStore() const settingsStore = new SettingsStore()
const settings = await settingsStore.find() const settings = await settingsStore.find()
response.locals.settings = settings response.locals = {
settings: settings
}
}) })
// check url for paged // check url for paged
@ -72,27 +53,30 @@ server.addHook('onRequest', async function (request, response) {
const url = request.url const url = request.url
let pathname = url.split('/').shift() let pathname = url.split('/')
pathname.shift()
// default value for paged // default value for paged
let paged = 1 let paged = 1
// check if pathname has values and is not 404 // check if pathname has values
if (pathname.length > 0 && request.url !== '/404') { if (pathname.length > 0) {
// try to get number
const result = Number(pathname[pathname.length - 1]) const result = Number(pathname[pathname.length - 1])
// is result is an integer // is result is integer
if (Number.isInteger(result)) { if (Number.isInteger(result)) {
paged = result paged = result
// remove last from pathname, add default url to request, // remove last element
// and check if pathname has more than one, join pathname for new url
pathname.pop() pathname.pop()
request.raw.url = '/'
// @TODO change, thats looks strange
if (pathname.length > 0) { if (pathname.length > 0) {
request.raw.url = pathname.join('/') request.raw.url = pathname.join('/')
} else {
request.raw.url = '/'
} }
} }
} }
@ -118,7 +102,7 @@ import postHttp from './http/post.js'
// page and static has always the last routes, if no route before match, it try get a page // page and static has always the last routes, if no route before match, it try get a page
import sitemapHttp from './http/sitemap.js' import sitemapHttp from './http/sitemap.js'
import pageHttp from './http/page.js' import pageHttp from './http/page.js'
import publicHttp from './http/public.js' import staticHttp from './http/static.js'
server server
.register(commentHttp, { .register(commentHttp, {
@ -130,6 +114,6 @@ server
}) })
.register(sitemapHttp) .register(sitemapHttp)
.register(pageHttp) .register(pageHttp)
.register(publicHttp) .register(staticHttp)
export default server export default server

@ -1,85 +0,0 @@
/**
* function similar to blade asset
*
* @param $path
* @return string
*
*/
function asset($path, $prefix = '/public')
{
// get flight
$app = Flight::app();
// getting basePath
$basePath = $app->get('basePath');
// path to mix-manifest
$file = $app->get('basePath').'mix-manifest.json';
if (file_exists($file)) {
$manifest = file_get_contents($file);
$files = json_decode($manifest, true);
if (isset($files[$prefix.$path])) {
$path = str_replace($prefix, '', $files[$prefix.$path]);
}
}
return $path;
}
/**
* getting name of view as slug
*
* @param array $page
* @return string
*
*/
function canonical()
{
if (isset($_SERVER['HTTPS'])) {
$canoncial = 'https';
} else {
$canoncial = 'http';
}
$canoncial .= '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
return $canoncial;
}
/**
* getting title for head
*
* @param array $page
* @param array $site
* @return string
*/
function title($page, $site)
{
$title = [];
if (isset($site['data']['title'])) {
$title[] = $site['data']['title'];
}
// if not homepage set page title first
if ($page['data']['slug']) {
array_unshift($title, $page['data']['title']);
} else {
$title[] = $page['data']['title'];
}
return join(' | ', $title);
}
function styles($values) {
$result = '';
if ($values && is_array($values)) {
$result = implode(' ', $values);
}
return $result;
}

@ -12,8 +12,8 @@
const directusResponseHandler = { const directusResponseHandler = {
single(entity, response) { single(entity, response) {
// if data not exists or data is empty redirect to 404 // if data is empty redirect to 404
if (!entity.data || entity.data.length === 0) { if (entity.data.length === 0) {
return response.redirect('/404') return response.redirect('/404')
} }
@ -25,7 +25,7 @@ const directusResponseHandler = {
entity.data.template = 'default' entity.data.template = 'default'
} }
response.locals.page = entity return entity
} }
} }

@ -1,138 +0,0 @@
import slugify from 'slugify'
import { marked } from 'marked'
import * as fs from 'fs'
import path from 'path'
const basePath = path.join(path.resolve(), '/../../')
/**
* etaHelpers
*
* collection for helpers to extend eta
*
*
*/
/**
* asset - checks manifest.json for given path and return
* file path with id for cache busting
*
*
* @param {String} publicPath
*
*/
function asset(publicPath)
{
// getting basePath
let result = publicPath
// path to mix-manifest
const file = basePath + 'mix-manifest.json'
if (fs.existsSync(file)) {
const manifest = fs.readFileSync(file)
const files = JSON.parse(manifest)
if (files[publicPath]) {
result = files[publicPath]
}
}
return result
}
/**
* templateClass - parse template name to css-classname,
* use prefix, default is "page"
*
*
* @param {Object} entity
* @param {String} [prefix='page']
* @return {String}
*
*/
function templateClass(entity, prefix = 'page') {
if (entity.data && entity.data.template) {
prefix += '-' + entity.data.template
}
return prefix
}
/**
* isHome - check if entity is home,
* checks for permalink
*
*
* @param {Object} entity
* @return {Boolean}
*
*/
function isHome(entity) {
let result = false
if (entity.data && entity.data.permalink && entity.data.permalink === "/") {
result = true
}
return result
}
/**
* injectStore - import store, check if store exists and
* create object from class
*
*
* @param {String} name
* @return {Object}
*
*/
async function injectStore(name) {
const importPath = './../stores/' + name + '.js'
const filePath = basePath + 'packages/server/stores/' + name + '.js'
// if class not exists, throw exception
if (!fs.existsSync(filePath)) {
throw new Error(name + ' not exists!')
}
const StoreClass = await import(importPath)
const store = new StoreClass.default()
return store
}
/**
* mediaUrl - create url for assets from directus,
* default options are with access_token for permissions
*
*
* @param {String} id
* @param {Object} options
* @return {String}
*
*/
function mediaUrl(id, options = {})
{
let query
// merge options, default is access_token
options = Object.assign({
'access_token': process.env.DIRECTUS_API_TOKEN
}, options)
// create query
query = '?' + new URLSearchParams(options).toString();
return process.env.DIRECTUS_API_URL + '/assets/' + id + query;
}
export { asset, templateClass, isHome, injectStore, mediaUrl }

@ -17,19 +17,9 @@ export default async function(fastify, opts) {
* *
*/ */
fastify.get('/404', async function(request, response) { fastify.get('/404', async function(request, response) {
// create object for handling in template
const page = {
data: {
title: '404'
}
}
return response return response
.code(404) .code(404)
.view('../views/404', { .view('../frontend/views/404')
page: page
})
}) })
} }

@ -1,11 +1,11 @@
import path from 'path' import path from 'path'
import PageStore from './../stores/page.js' import PageStore from './../stores/Page.js'
import directusResponseHandler from './../handlers/directusResponse.js' import directusResponseHandler from './../handlers/directusResponse.js'
/** /**
* Page * page
* *
* @author Björn Hase <me@herr-hase.wtf> * @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License * @license http://opensource.org/licenses/MIT The MIT License
@ -29,8 +29,7 @@ export default async function(fastify, opts) {
// getting single page // getting single page
const page = await pageStore.findOneByPermalink(request.url) const page = await pageStore.findOneByPermalink(request.url)
directusResponseHandler.single(page, response) response.page = directusResponseHandler.single(page, response)
}) })
/** /**
@ -41,7 +40,8 @@ export default async function(fastify, opts) {
* *
*/ */
fastify.get('/*', async function(request, response) { fastify.get('/*', async function(request, response) {
return response.view('../views/templates/page/' + response.locals.page.data.template) return response.view('../frontend/views/templates/page/' + response.page.data.template, {
'page' : response.page
})
}) })
} }

@ -1,6 +1,4 @@
import PostStore from './../stores/post.js' import PageStore from './../stores/Post.js'
import directusResponseHandler from './../handlers/directusResponse.js'
import path from 'path' import path from 'path'
/** /**
@ -27,8 +25,8 @@ export default async function(fastify, opts) {
const postStore = new PostStore() const postStore = new PostStore()
// getting single page // getting single page
let post = await postStore.findOneBySlug(request.params.slug) let post = await store.findOneBySlug(request.params.slug)
directusResponseHandler.single(post, response) directusResponseHandler.one(post, response)
}) })
@ -40,6 +38,8 @@ export default async function(fastify, opts) {
* *
*/ */
fastify.get('/:slug([-a-zA-Z0-9]{0,255})', async function(request, response) { fastify.get('/:slug([-a-zA-Z0-9]{0,255})', async function(request, response) {
response.view('../views/templates/post/' + response.locals.page.data.template) response.view('../frontend/views/templates/post/' + response.post.data.template, {
'page' : post
})
}) })
} }

@ -1,6 +1,6 @@
import path from 'path' import path from 'path'
import PageStore from './../stores/page.js' import PageStore from './../stores/Page.js'
import directusResponseHandler from './../handlers/directusResponse.js' import directusResponseHandler from './../handlers/directusResponse.js'

@ -18,7 +18,7 @@ export default async function(fastify, opts) {
*/ */
fastify.register(fastifyStatic, { fastify.register(fastifyStatic, {
root: path.join(path.resolve(), '/../../public'), root: path.join(path.resolve(), '/../../public'),
prefix: '/public', prefix: '/static',
preCompressed: true preCompressed: true
}) })

@ -1,8 +1,7 @@
{ {
"name": "server", "name": "server",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true, "requires": true,
"lockfileVersion": 1,
"dependencies": { "dependencies": {
"@directus/sdk": { "@directus/sdk": {
"version": "9.14.2", "version": "9.14.2",
@ -224,11 +223,6 @@
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
}, },
"eta": {
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/eta/-/eta-1.12.3.tgz",
"integrity": "sha512-qHixwbDLtekO/d51Yr4glcaUJCIjGVJyTzuqV4GPlgZo1YpgOKG+avQynErZIYrfM6JIJdtiG2Kox8tbb+DoGg=="
},
"etag": { "etag": {
"version": "1.8.1", "version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
@ -392,6 +386,11 @@
"set-cookie-parser": "^2.4.1" "set-cookie-parser": "^2.4.1"
} }
}, },
"liquidjs": {
"version": "9.39.1",
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-9.39.1.tgz",
"integrity": "sha512-TFu19Cml0K2T34UY50ZKUApHgiiEaayqNW9J3o3ubLQCuhMFhY7jqwNpY1oVvvAJxCCxVqL6bJnGc1Fktth0Fw=="
},
"lru-cache": { "lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -619,11 +618,6 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
}, },
"slugify": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz",
"integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ=="
},
"sonic-boom": { "sonic-boom": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.0.0.tgz", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.0.0.tgz",

@ -12,9 +12,8 @@
"dayjs": "^1.11.4", "dayjs": "^1.11.4",
"dompurify": "^2.3.10", "dompurify": "^2.3.10",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"eta": "^1.12.3",
"fastify": "^4.2.1", "fastify": "^4.2.1",
"marked": "^4.0.18", "liquidjs": "^9.39.1",
"slugify": "^1.6.5" "marked": "^4.0.18"
} }
} }

@ -3,9 +3,6 @@ import { Directus } from '@directus/sdk';
/** /**
* Abstract Class for handling Directus Api * Abstract Class for handling Directus Api
* *
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/HerrHase/super-fastify-directus.git
* *
*/ */

@ -1,11 +1,8 @@
import DirectusAbstractStore from './directusAbstract.js' import DirectusAbstractStore from './DirectusAbstract.js'
/** /**
* Pages from Directus * Pages from Directus
* *
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/HerrHase/super-fastify-directus.git
* *
*/ */
@ -35,7 +32,6 @@ class PageStore extends DirectusAbstractStore {
'title', 'title',
'status', 'status',
'permalink', 'permalink',
'template',
'meta', 'meta',
'content' 'content'
], ],

@ -1,18 +1,14 @@
import DirectusAbstractStore from './directusAbstract.js' import DirectusAbstractStore from './DirectusAbstract.js'
/** /**
* Posts from posts * Posts from Directus
* *
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/HerrHase/super-fastify-directus.git
* *
*/ */
class PostStore extends DirectusAbstractStore { class PostStore extends DirectusAbstractStore {
/** /**
* set name of endpoint
* *
* *
* @param {string} endpoint * @param {string} endpoint
@ -30,11 +26,10 @@ class PostStore extends DirectusAbstractStore {
* @return {object} * @return {object}
*/ */
find(page = 1, limit = 20) { find(page = 1, limit = 20) {
return this.items.readByQuery({ return this.items.readOne({
fields: [ fields: [
'title', 'title',
'slug', 'slug',
'status',
'user_created.first_name', 'user_created.first_name',
'user_created.last_name', 'user_created.last_name',
@ -45,8 +40,9 @@ class PostStore extends DirectusAbstractStore {
'teaser_media.description', 'teaser_media.description',
], ],
filter: { filter: {
status : 'published', slug : slug,
published_at : { status : 'published',
published_at : {
'_nnull': true '_nnull': true
} }
}, },
@ -63,7 +59,7 @@ class PostStore extends DirectusAbstractStore {
* @return {object} * @return {object}
*/ */
findOneBySlug(slug) { findOneBySlug(slug) {
return this.items.readByQuery({ return this.items.readOne({
fields: [ fields: [
'title', 'title',
'slug', 'slug',

@ -1,7 +1,7 @@
import DirectusAbstractStore from './directusAbstract.js' import DirectusAbstractStore from './DirectusAbstract.js'
/** /**
* Settings from directus_settings * Settings
* *
* @author Björn Hase <me@herr-hase.wtf> * @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License * @license http://opensource.org/licenses/MIT The MIT License
@ -11,7 +11,7 @@ import DirectusAbstractStore from './directusAbstract.js'
class SettingsStore extends DirectusAbstractStore { class SettingsStore extends DirectusAbstractStore {
/** /**
* set name of endpoint *
* *
* @param {string} endpoint * @param {string} endpoint
* *
@ -21,7 +21,7 @@ class SettingsStore extends DirectusAbstractStore {
} }
/** /**
* get settings from endpoint * getting setting
* *
* *
* @return {object} * @return {object}

@ -1,11 +1,8 @@
import DirectusAbstractStore from './directusAbstract.js' import DirectusAbstractStore from './DirectusAbstract.js'
/** /**
* Comments * Comments
* *
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/HerrHase/super-fastify-directus.git
* *
*/ */
@ -14,7 +11,7 @@ class CommentStore extends DirectusAbstractStore {
/** /**
* *
* *
* @param {String} endpoint * @param {string} endpoint
* *
*/ */
constructor() { constructor() {
@ -24,9 +21,8 @@ class CommentStore extends DirectusAbstractStore {
/** /**
* getting page by permalink * getting page by permalink
* *
* @param {String} permalink * @param {string} permalink
* @return {Object} * @return {object}
*
*/ */
find(page, uuid, limit = 20) { find(page, uuid, limit = 20) {
return this.items.readByQuery({ return this.items.readByQuery({
@ -47,32 +43,6 @@ class CommentStore extends DirectusAbstractStore {
}) })
} }
/**
* getting page by permalink
*
* @param {String} permalink
* @return {Object}
*
*/
page(page, uuid, limit = 20) {
return this.items.readByQuery({
fields: [
'name',
'content',
'approved',
'belongs_to.comments_id'
],
filter: {
approved : true,
belongs_to : {
comments_id: uuid
}
},
limit : limit,
offset : ((page - 1) * limit)
})
}
} }
export default CommentStore export default CommentStore

File diff suppressed because it is too large Load Diff

@ -1,13 +0,0 @@
(self["webpackChunkfrontend"] = self["webpackChunkfrontend"] || []).push([["spritemap"],{
/***/ "?c20d":
/*!******************************!*\
!*** spritemap-dummy-module ***!
\******************************/
/***/ (() => {
/***/ })
}]);
Loading…
Cancel
Save