Document the lib/models.js header, and a slight fix for links not getting their style in the included html from Svelte. See https://github.com/sveltejs/svelte/issues/2967

main
Zed A. Shaw 2 years ago
parent eba5034c8e
commit e4b94a8041
  1. 13
      admin/pages/DocsBrowser.svelte
  2. 21
      lib/models.js

@ -121,7 +121,18 @@
display: block; display: block;
} }
/* FOOTGUN: https://github.com/sveltejs/svelte/issues/2967
When you @html in Svelte it can't apply any styles from here.
You have to scope the a tag style inside module-header, BUT,
set it to global so Svelte will apply it to the whole doc,
not its special class.
*/
module-header :global(a) {
color: var(--color-text-inverted);
}
module-header { module-header {
display: block;
padding: 0.5rem; padding: 0.5rem;
background-color: var(--color-bg-inverted); background-color: var(--color-bg-inverted);
color: var(--color-text-inverted); color: var(--color-text-inverted);
@ -141,7 +152,7 @@
<right> <right>
{#if docs_data} {#if docs_data}
<module-header> <module-header>
<h1>{ url }</h1> <h1>{ url }</h1>
{#if docs_data.comment} {#if docs_data.comment}
{@html docs_data.comment} {@html docs_data.comment}

@ -1,3 +1,24 @@
/*
This contains the base classes for the `Model`s in the database. It uses
the [lib/ormish.js](/admin/#/docs/lib/ormish.js) module to build up classes for:
+ `User` -- A simple user model.
+ `Payment` -- A Payment model that is simple but can support Stripe, Paypal, and BTCPayServer.
+ `Product` -- A simple Product for the site.
+ `Media` -- Media information common to video and music files, but could work with anything.
+ `Livestream` -- Metadata for livestream sessions (see `client/pages/Livestream.svelte`).
+ `Site` -- Simple key=value store for settings you might want in your site.
As with all other code in this project these models are _complete_ but don't have everything
under the sun. For example, it acts as if `User` pays one time to access the entire site and
all `Product`. That is one very valid model of payment, and it's the simplest one which you
can then build on. The rationale is you get a starter kit that you can then mold into what you
need because this is simple enough to understand while also being useful to get started.
### Tests
You should look at the tests in `tests/models` for many examples of using these.
*/
import { knex, Model } from './ormish.js'; import { knex, Model } from './ormish.js';
import bcrypt from 'bcryptjs'; import bcrypt from 'bcryptjs';
import {v4 as uuid} from "uuid"; import {v4 as uuid} from "uuid";

Loading…
Cancel
Save